Remapping :Wq to :wq in vim

后端 未结 3 1122
醉酒成梦
醉酒成梦 2021-01-04 10:48

A lot of times, when I want to save a file in vim and immediately exit thereafter, I accidentally type :Wq instead of :wq.

Vim naturally gives me this error:

3条回答
  •  走了就别回头了
    2021-01-04 11:26

    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
    

提交回复
热议问题