From 2be689e92b550f699da909f03ccfb4e6bfb1f80e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 23 Apr 2025 23:52:15 +0900 Subject: nvim: use ] and [ for go/gO --- .config/nvim/lua/init/04-mappings.lua | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to '.config/nvim/lua/init') diff --git a/.config/nvim/lua/init/04-mappings.lua b/.config/nvim/lua/init/04-mappings.lua index d119086..e9db72e 100644 --- a/.config/nvim/lua/init/04-mappings.lua +++ b/.config/nvim/lua/init/04-mappings.lua @@ -494,31 +494,9 @@ K.set('!', 'jk', '', { remap=true }) K.set('n', '', ':nohlsearch', { silent=true }) --- Lua function cannot be set to 'operatorfunc' for now. -vim.cmd([[ - function! Vimrc_insert_black_line_below(type = '') abort - if a:type ==# '' - set operatorfunc=Vimrc_insert_black_line_below - return 'g@ ' - else - for i in range(v:count1) - call append(line('.'), '') - endfor - endif - endfunction - function! Vimrc_insert_black_line_above(type = '') abort - if a:type ==# '' - set operatorfunc=Vimrc_insert_black_line_above - return 'g@ ' - else - for i in range(v:count1) - call append(line('.') - 1, '') - endfor - endif - endfunction -]]) -K.set('n', 'go', F.Vimrc_insert_black_line_below, { expr = true }) -K.set('n', 'gO', F.Vimrc_insert_black_line_above, { expr = true }) +-- "remap" flag is needed because [ and ] are implemented by Lua functions. +K.set('n', 'go', ']', { remap = true }) +K.set('n', 'gO', '[', { remap = true }) K.set('n', 'w', 'update') -- cgit v1.2.3-70-g09d2