init.vim, I have the following:
ca WQ wq
What would be the equivalent in my
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
!!Note: this solution only works on Neovim >= v0.10; see @ruuter's answer if you are on an older version of neovim.
Command abbreviation is treated as just another keymap mode by
nvim_set_keymap. The equivalent of
ca WQ wq in lua is:
vim.keymap.set("ca", "WQ", "wq")
I had a hard time discovering this, as the help text in
lua.txt help file does not actually list out the modes! It does however tell you to see
h: nvim_set_keymap which lives in the
api.txt help file, and that's where abbreviations are mentioned!