Created
October 17, 2020 08:23
-
-
Save Vftdan/3139709a5bc8f4c16a5d01f743aa2a30 to your computer and use it in GitHub Desktop.
Aliases for vim command mode. (Function is not mine.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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