VIM for Windows - What do I type to save and exit from a file?

白昼怎懂夜的黑 提交于 2019-11-28 14:55:41
nunopolonia

Press ESC to make sure you are out of the edit mode and then type:

:wq
eckes

Instead of telling you how you could execute a certain command (ESC:wq), I can provide you two links that may help you with VIM:

However, the best way to learn VIM is not only using it for Git commits but as regular editor for your everyday work.

If you're not going to switch to VIM, it's nonsense to keep it's commands in mind. In that case, go and set up your favourite editor to use with Git.

Esc to make sure you exit insert mode, then :wq (colon w q) or ZZ (shift-Z shift-Z).

  • Press i or a to get into Insert mode, type message of choice

  • press several times ESC to get out of Insert-Mode, or any other mode you might have ran into by accident

    • to save, :wq, :x or ZZ

    • to exit without saving, :q! or ZQ

EDIT:
To reload a file and undo all changes you have made...
Press several times ESC and then enter :e!.

A faster way to

  • Save
  • and quit

would be

:x

If you have opened multiple files you may need to do a

:xa

:q! will force an unconditional no-save exit

    :wq!

The exclamation mark is used for overriding read only mode.

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