From dfb049f52ff546af2d46edb821c30883b439e3d8 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Fri, 12 Mar 2021 13:28:08 +0200 Subject: [PATCH] [nvim] add a quick keymap switcher --- nvim/autoload/dotfiles/indent_motion.vim | 2 +- nvim/plugin/editing.vim | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/nvim/autoload/dotfiles/indent_motion.vim b/nvim/autoload/dotfiles/indent_motion.vim index 31b51f4..780d351 100644 --- a/nvim/autoload/dotfiles/indent_motion.vim +++ b/nvim/autoload/dotfiles/indent_motion.vim @@ -55,7 +55,7 @@ function dotfiles#indent_motion#run(direction) endfunction " -function dotfiles#indent_motion#indent_level_of(linenr) "{{{2 +function dotfiles#indent_motion#indent_level_of(linenr) if getline(a:linenr) ==# "" return -1 endif diff --git a/nvim/plugin/editing.vim b/nvim/plugin/editing.vim index ec77a41..3fb2af5 100644 --- a/nvim/plugin/editing.vim +++ b/nvim/plugin/editing.vim @@ -106,10 +106,6 @@ set commentstring=//%s nnoremap nnoremap - nnoremap kk set keymap& - nnoremap kr set keymap=russian-jcuken-custom - nnoremap ku set keymap=ukrainian-jcuken-custom - nnoremap Q " normal mode @@ -138,6 +134,19 @@ set commentstring=//%s " }}} +" Keymap switcher {{{ + + nnoremap kk set keymap& + nnoremap kr set keymap=russian-jcuken-custom + nnoremap ku set keymap=ukrainian-jcuken-custom + + nnoremap DotfilesSwapKeymaps + let g:dotfiles_prev_keymap = &keymap + command! -nargs=0 DotfilesSwapKeymaps let [g:dotfiles_prev_keymap, &keymap] = [&keymap, g:dotfiles_prev_keymap] + +" }}} + + " Search {{{ " ignore case if the pattern doesn't contain uppercase characters (use '\C'