Command-line and ex modes

Command-line mode is entered by typing a colon (:) or when searching for text with / or ?, and allows you to input a command until you hit Enter. Command-line mode provides some useful shortcuts:

  • The up and down arrows (or Ctrl + p and Ctrl + n) let you traverse command history one by one 
  • Ctrl + b and Ctrl + e let you go to the beginning and the end of the line respectively
  • The Shift or Ctrl keys combined with left or right arrows allows you to move by words

A highly useful shortcut is Ctrl + f, which opens an editable command-line window with a history of the commands you ran:

For editing purposes, it's a regular buffer, so you can find a command you've executed before, edit it (the way you'd edit any text in Vim), and execute it again. You can press Enter to execute the line your cursor is on or Ctrl + c to close the buffer.

You can learn more about working with command-line mode by looking up :help cmdline-editing.

Vim has a variation of the command-line mode called ex mode, which is entered by pressing Q. Ex mode is a compatibility mode with Vim's precursor—ex. It allows you to execute multiple commands without exiting the mode after each command, but has very limited uses today.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.51.241