Vim Recall繁體中文

Edit an old command like buffer text

q:

Example

Normal mode. Most recent Ex command: s/old/new/. Current line contains old.

Before
History command: s/old/new/ Current buffer line: old

  1. q: Command history opens · cursor on the final blank row
  2. k$hciwfresh<Esc> Select the previous command and edit it · s/old/fresh/
  3. <CR> Run edited command · old becomes fresh; history closes

After
Edited command: s/old/fresh/ Current buffer line: fresh

Details & Vim help

Open Ex command history in a window with Normal-mode editing.

Repair a long command using the same editing skills as ordinary text.

q: differs from :q. It cannot open during macro recording because q stops the recording. Executing a history line can write files or run shell commands.

Edit the command in the history window, then press Enter to execute that line.

Try it in Vim

  1. From Normal mode, type q:.
  2. Move to a historical command and edit it.
  3. Press <CR> to execute that line, or :q<CR> to close without executing.