From bd9c746f367dfa68ebc7dbd5ef6157e3fd247b90 Mon Sep 17 00:00:00 2001 From: kkard2 Date: Sat, 28 Dec 2024 11:32:58 +0100 Subject: this works better --- nvim/ftplugin/php.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'nvim/ftplugin/php.lua') 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 = "0\"_d$?.noh0\"myw0\"_d$\"mpa" +local copy_indent_macro = "0\"_D" -- clear current line + .. "?." -- find first non-empty line above + .. "^\"yy0" -- copy indentation to y register + .. "" -- return to original line + .. "\"yp" -- paste y register + .. "noh" -- 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 }) -- cgit v1.3.1