aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-04-23 23:52:15 +0900
committernsfisis <nsfisis@gmail.com>2025-04-23 23:52:15 +0900
commit2be689e92b550f699da909f03ccfb4e6bfb1f80e (patch)
tree90f4f2a2ff2bb649fdd4d3294356b3e4488aba46
parent02eee049ac8076d94dd30173ff153dc959a23412 (diff)
downloaddotfiles-2be689e92b550f699da909f03ccfb4e6bfb1f80e.tar.gz
dotfiles-2be689e92b550f699da909f03ccfb4e6bfb1f80e.tar.zst
dotfiles-2be689e92b550f699da909f03ccfb4e6bfb1f80e.zip
nvim: use ]<Space> and [<Space> for go/gO
-rw-r--r--.config/nvim/lua/init/04-mappings.lua28
1 files changed, 3 insertions, 25 deletions
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', '<ESC>', { remap=true })
K.set('n', '<C-c>', ':<C-u>nohlsearch<CR>', { 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 [<Space> and ]<Space> are implemented by Lua functions.
+K.set('n', 'go', ']<Space>', { remap = true })
+K.set('n', 'gO', '[<Space>', { remap = true })
K.set('n', '<Space>w', '<Cmd>update<CR>')