How do I exit the Vim editor?

后端 未结 10 2268
青春惊慌失措
青春惊慌失措 2020-11-22 02:26

I\'m stuck and cannot escape. It says:

\"type :quit to quit VIM\"

But when I type that it simply appears in the object body.

10条回答
  •  借酒劲吻你
    2020-11-22 02:57

    Vim has three modes of operation: Input mode, Command mode & Ex mode.

    Input mode - everything that you type, all keystrokes are echoed on the screen.

    Command mode or Escape mode - everything that you type in this mode is interpreted as a command.

    Ex mode - this is another editor, ex. It is a line editor. It works per line or based on a range of lines. In this mode, a : appears at the bottom of the screen. This is the ex editor.

    In order to exit Vim, you can exit while you are in either the ex mode or in the command mode. You cannot exit Vim when you are in input mode.

    Exiting from ex mode

    1. You need to be sure that you are in the Command mode. To do that, simply press the Esc key.

    2. Go to the ex mode by pressing the : key

    3. Use any of the following combinations in ex mode to exit:

      :q - quit :q! - quit without saving :wq - save & quit or write & quit :wq! - same as wq, but force write in case file permissions are readonly :x - write & quit :qa - quit all. useful when multiple files are opened like: vim abc.txt xyz.txt

    Exiting from command mode

    1. Press the escape key. You probably have done this already if you are in command mode.

    2. Press capital ZZ (shift zz) - save & exit

    3. Press capital ZQ (shift zq) - exit without saving.

提交回复
热议问题