Skip to content

Instantly share code, notes, and snippets.

@wolandark
Created September 30, 2023 00:36
Show Gist options
  • Save wolandark/6af85607ee26055bb519ac69d03edb07 to your computer and use it in GitHub Desktop.
Save wolandark/6af85607ee26055bb519ac69d03edb07 to your computer and use it in GitHub Desktop.
Settings for using an alternative keymapping in Vim
let g:alt_keymap = 'persian' " Change to your prefered keymap located at $VIMRUNTIME/keymap/
let g:alt_enabled = 1
function! CallToggleKeymap()
if g:alt_enabled
call ToggleKeymap()
endif
endfunction
function! ToggleKeymap()
if &keymap == ''
execute 'setlocal keymap=' . g:alt_keymap
silent !echo -ne "\033]12;cyan\007"
redraw!
autocmd VimLeave * silent !echo -ne "\033]112\007"
else
set keymap=
silent !echo -ne "\033]112\007"
redraw!
endif
endfunction
command! SwitchKeymap call CallToggleKeymap()
function! ListKeymapFiles()
:Explore $VIMRUNTIME/keymap/
endfunction
" Optionally create custom key mappings to SwitchKeymap command
@wolandark
Copy link
Author

keymap-2023-09-30_05.36.13.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment