在哪里:命令历史存储?

时间:2009-04-20 17:09:37

标签: vim

我想知道:针对特定vim会话存储命令历史记录的位置。我知道我们可以滚动并搜索历史记录。我的目标是使用反复试验来执行我执行的部分命令,并创建一个vim源文件。

5 个答案:

答案 0 :(得分:15)

它存储在$ HOME / .viminfo

从vim help命令:

The viminfo file is used to store:
- The command line history.
- The search string history.
- The input-line history.
- Contents of registers.
- Marks for several files.
- File marks, pointing to locations in files.
- Last search/substitute pattern (for 'n' and '&').
- The buffer list.
- Global variables.

答案 1 :(得分:5)

您还可以使用q::<CTRL-F>命令在迷你缓冲区中打开最近的命令历史记录

 OPEN

 There are two ways to open the command-line window:
 1. From Command-line mode, use the key specified with the 'cedit' option.
    The default is CTRL-F when 'compatible' is not set.
 2. From Normal mode, use the "q:", "q/" or "q?" command.  *q:* *q/* *q?*
    This starts editing an Ex command-line ("q:") or search string ("q/" or
    "q?").  Note that this is not possible while recording is in progress (the
    "q" stops recording then).

 When the window opens it is filled with the command-line history.  The last
 line contains the command as typed so far.  The left column will show a
 character that indicates the type of command-line being edited, see
 |cmdwin-char|.

您可以在此窗口中移动,并像普通缓冲区一样进行复制。点击命令<Enter>将执行它。

答案 2 :(得分:2)

您正在寻找histget()histadd()histdel()这些功能。

编辑:viminfo文件将包含来自多个会话的历史数据,我猜你已经知道了,根据你提出问题的方式。

答案 3 :(得分:1)

它位于文件.viminfo(如果你在Windows上,则为_viminfo)。它应该在您的主目录的任何传递中。

答案 4 :(得分:1)

:h viminfo-file-name

HTH: - )