[nvim] add a quick keymap switcher

This commit is contained in:
Dmytro Meleshko 2021-03-12 13:28:08 +02:00
parent 0a3c9b7424
commit dfb049f52f
2 changed files with 14 additions and 5 deletions

View File

@ -55,7 +55,7 @@ function dotfiles#indent_motion#run(direction)
endfunction
" <https://github.com/kana/vim-textobj-indent/blob/deb76867c302f933c8f21753806cbf2d8461b548/autoload/textobj/indent.vim#L120-L127>
function dotfiles#indent_motion#indent_level_of(linenr) "{{{2
function dotfiles#indent_motion#indent_level_of(linenr)
if getline(a:linenr) ==# ""
return -1
endif

View File

@ -106,10 +106,6 @@ set commentstring=//%s
nnoremap <C-n> <C-i>
nnoremap <C-p> <C-o>
nnoremap <leader>kk <Cmd>set keymap&<CR>
nnoremap <leader>kr <Cmd>set keymap=russian-jcuken-custom<CR>
nnoremap <leader>ku <Cmd>set keymap=ukrainian-jcuken-custom<CR>
nnoremap Q <nop>
" normal mode
@ -138,6 +134,19 @@ set commentstring=//%s
" }}}
" Keymap switcher {{{
nnoremap <leader>kk <Cmd>set keymap&<CR>
nnoremap <leader>kr <Cmd>set keymap=russian-jcuken-custom<CR>
nnoremap <leader>ku <Cmd>set keymap=ukrainian-jcuken-custom<CR>
nnoremap <C-o> <Cmd>DotfilesSwapKeymaps<CR>
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'