diff options
| author | kkard2 <[email protected]> | 2024-12-28 11:32:58 +0100 |
|---|---|---|
| committer | kkard2 <[email protected]> | 2024-12-28 11:32:58 +0100 |
| commit | bd9c746f367dfa68ebc7dbd5ef6157e3fd247b90 (patch) | |
| tree | d9c703360320e0b3f8beceeea3390ef8ca86b538 /nvim/ftplugin | |
| parent | a7b27faa7a3ec2ec9fa2d1dcb4e6b7b5fb49b639 (diff) | |
this works better
Diffstat (limited to 'nvim/ftplugin')
| -rw-r--r-- | nvim/ftplugin/php.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/nvim/ftplugin/php.lua b/nvim/ftplugin/php.lua index a496f8a..33276d5 100644 --- a/nvim/ftplugin/php.lua +++ b/nvim/ftplugin/php.lua @@ -1,4 +1,10 @@ -local copy_indent_macro = "<Esc>0\"_d$?.<CR><cmd>noh<CR>0\"myw<C-o>0\"_d$\"mpa" +local copy_indent_macro = "<Esc>0\"_D" -- clear current line + .. "?.<CR>" -- find first non-empty line above + .. "^\"yy0" -- copy indentation to y register + .. "<C-o>" -- return to original line + .. "\"yp" -- paste y register + .. "<cmd>noh<CR>" -- clear highlight + .. "A" -- enter insert mode vim.keymap.set({ "n" }, "o", "o" .. copy_indent_macro, { buffer = 0 }) vim.keymap.set({ "n" }, "O", "O" .. copy_indent_macro, { buffer = 0 }) |
