Skip to content

Instantly share code, notes, and snippets.

@Vftdan
Created October 17, 2020 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vftdan/3139709a5bc8f4c16a5d01f743aa2a30 to your computer and use it in GitHub Desktop.
Save Vftdan/3139709a5bc8f4c16a5d01f743aa2a30 to your computer and use it in GitHub Desktop.
Aliases for vim command mode. (Function is not mine.)
" Command mode aliases
function! SetupCommandAlias(from, to)
exec 'cnoreabbrev <expr> ' . a:from
\ . ' ((getcmdtype() is# ":" && getcmdline() is# "' . a:from . '")'
\ . '? ("' . a:to . '") : ("' . a:from . '"))'
endfunction
command! -nargs=* Calias call SetupCommandAlias([<f-args>][0], join([<f-args>][1:]))
Calias calias Calias
Calias nvim visual
Calias W! w!
Calias Q! q!
Calias Qall! qall!
Calias Wq wq
Calias Wa wa
Calias wQ wq
Calias WQ wq
Calias W w
Calias Q q
Calias Qall qall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment