Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In normal mode why does `q:` bring up a command history?

Tags:

vim

neovim

If I am in vim normal mode and I type q: a quick-fix window pops up with a history of recent commands.

I'm stumped at how this works, q is for recording macros, is it unexpected behaviour because the : is not a register?

I looked in :help q but couldn't see anything that made sense there.

like image 648
Adzz Avatar asked Oct 20 '25 12:10

Adzz


2 Answers

If you follow :help ":, you'll see that register : is a read-only register. Recording a macro into it is not possible. Therefore, there's no clash with macro recording.

The q: command enters the command-line-window; yes, this is similar in appearance (and also somewhat in behavior) to quickfix windows. You'll find it documented at :help q:, or :help cmdline-window.

like image 198
Ingo Karkat Avatar answered Oct 22 '25 03:10

Ingo Karkat


q: in normal mode results in displaying the command line history

A history is maintained of ex commands, searches, expressions input lines and debugging mode commands.

The normal command, q:, puts you in the ex command history where you edit your command history. It has similarities to the ex command, :history.

The following help articles discuss this:

:help cmdline-history :help cmdline-window

There is a lot of value in being able to review these histories.

Ingo addresses your questions pertaining to registers and clashing.

like image 44
Patrick Bacon Avatar answered Oct 22 '25 02:10

Patrick Bacon