summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nvim/ftplugin/php.lua8
-rw-r--r--nvim/init.lua10
2 files changed, 9 insertions, 9 deletions
diff --git a/nvim/ftplugin/php.lua b/nvim/ftplugin/php.lua
index a34bb10..8d7c165 100644
--- a/nvim/ftplugin/php.lua
+++ b/nvim/ftplugin/php.lua
@@ -1,10 +1,10 @@
-local copy_indent_macro = "<Esc>0\"_D" -- clear current line
+local copy_indent_macro = "<Esc>^\"_d0" -- clear current indentation
.. "?.<CR>" -- find first non-empty line above
.. "<cmd>noh<CR>" -- clear highlight
.. "^\"yy0" -- copy indentation to y register
- .. "<C-o>" -- return to original line
- .. "\"yp" -- paste y register
- .. "A" -- enter insert mode
+ .. "<C-o>0" -- return to original line
+ .. "\"yP" -- paste y register
+ .. "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 })
diff --git a/nvim/init.lua b/nvim/init.lua
index c0182b1..7d20a4f 100644
--- a/nvim/init.lua
+++ b/nvim/init.lua
@@ -64,13 +64,13 @@ vim.keymap.set("v", ">", ">gv")
vim.keymap.set("v", "<", "<gv")
-- copy indent from line above
-local copy_indent_macro = "<Esc>0\"_D" -- clear current line
+local copy_indent_macro = "<Esc>^\"_d0" -- clear current indentation
.. "?.<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
+ .. "^\"yy0" -- copy indentation to y register
+ .. "<C-o>0" -- return to original line
+ .. "\"yP" -- paste y register
+ .. "a" -- enter insert mode
vim.keymap.set("i", "<S-Tab>", copy_indent_macro)
-- insert line break under cursor in normal mode
vim.keymap.set("n", "<C-j>", function()