在正常模式下,为什么 `q:` 会显示命令历史记录?

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

如果我在 vim 正常模式下输入 q: 快速修复 window 弹出最近命令的历史记录。

我对它的工作原理感到困惑,q 用于记录宏,这是意外行为吗,因为 : 不是寄存器?

我查看了 :help q,但没有看到任何有意义的内容。

如果您关注 :help ":,您会看到寄存器 : 是一个 只读 寄存器。无法将宏录制到其中。所以和宏录制没有冲突。

q:命令进入命令行-window;是的,这与 quickfix windows 在外观上(在行为上也有所相似)相似。您会在 :help q::help cmdline-window.

中找到它的记录

vimhelp#q:

  1. From Normal mode, use the "q:", "q/" or "q?" command. This starts editing an Ex command-line ("q:") or search string ("q/" or "q?")...

When the window opens it is filled with the command-line history.

q: 在正常模式下导致显示命令行历史

维护 ex 命令、搜索、表达式输入行和调试模式命令的历史记录。

普通命令 q: 将您置于 ex 命令历史记录中,您可以在其中编辑命令历史记录。它与 ex 命令有相似之处,:history.

以下帮助文章对此进行了讨论:

:help cmdline-history :help cmdline-window

能够回顾这些历史有很大的价值。

Ingo 解决了您关于寄存器和冲突的问题。