1

在本文下面的vim宏,作者给出了解释。我了解一些但不是全部。

:qccwcommand<Esc>:w<Ctl-W>jj<Enter>q

这个宏(包括记录开始/停止,如果你想知道的话)会将当前的 'path_to_command' 单词更改为 'command',将文件写入磁盘,将窗口拆分更改为 grep 搜索结果,下移一行在结果中并导航到该结果的位置。

Q1。在这里做什么ccw?是否与cw(更改单词)有关,但我不确定。

Q2。:w 一定要写,对吧?

Q3。在这里做什么<Ctrl-W>jj?以下是:h CTRL-W_J有关内容,但我不确定我是否正在研究正确的帮助,也不确定在这种情况下帮助的含义。

                                        *CTRL-W_J*
CTRL-W J    Move the current window to be at the very bottom, using the
    full width of the screen.  This works like closing the current
    window and then creating another one with ":botright split",
    except that the current window contents is used for the new
    window.
4

1 回答 1

5

您感到困惑,因为ccw从字面上看,该命令序列并没有真正的意义!

最初的qc意思是“在寄存器c中开始宏录制”

然后下一个cw意味着更改单词(例如删除下一个单词并让编辑器处于插入模式)

还要注意最后的命令是一个q: 这意味着完成宏录制。在做需要大量重复的事情时,宏非常有用!!1 --> http://vim.wikia.com/wiki/Macros


然后,他在博文中的解释包含了Q2和Q3的答案

This macro (which includes the record start / stop, if you’re wondering)
will change the current ‘path_to_command’ word to ‘command’, write the file
out to disk, change window splits to the grep search results, move down one
line in the results and navigate to that result’s location. I ran the macro
by hitting @c and then verifying the line selected was one that I wanted to
change. For a few instances where I did not want to change the line, I
manually navigated to the next search result and then re-ran the @c macro.

Q2 - 是的,保存文件:“ write the file out to disk

Q3 - 这<Ctl-W>jj<Enter>是一系列 Vim 键盘命令,用于从 vimgrep移动到 quickfix 窗口中的下一个条目,正如他所指出的那样:“ write the file out to disk, change window splits to the grep search results, move down one line in the results and navigate to that result’s location.

于 2014-01-05T09:37:54.570 回答