In Vim is there more than one way to leave insert mode?

后端 未结 5 1165
抹茶落季
抹茶落季 2021-02-05 11:44

There are several commands that do something and then enter insert mode. Are there also commands that leave insert mode and do things?

For example, I frequently do this.

5条回答
  •  粉色の甜心
    2021-02-05 12:25

    If you'd like to map a few keys to do things like save a file while in insert mode, you can use the imap command. This binds F2 to exit insert mode and save the file:

    :imap  :w
    

    This binds F2 to exit insert mode, save the file, and re-enter insert mode:

    :imap  :wa
    

    Or:

    :imap  :w
    

提交回复
热议问题