Remapping :Wq to :wq in vim

天涯浪子 提交于 2019-11-30 18:04:37

You can create a simple vim command that is basically an alias for wq. Place the following in your ~/.vimrc file:

command! Wq wq

For more help see:

:h :command

You can also use ZZ which is the same as :wq<CR>

Ingo Karkat

Though abbreviations suggest themselves for this (:cnoreabbrev Wk wk), their main disadvantage is that they are also applied in other places, such as when using Wk in a search pattern.

With the cmdalias plugin, you can define an alias:

:Alias Wk wk

PS: There is no :wk command, did you mean :wn[ext]? For a simple :w, have a look at this question

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!