在下面的vim宏from this article中,作者给出了解释。我理解一些,但不是全部。
: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.发布于 2014-01-05 17:37:55
你会感到困惑,因为从字面上看,在命令序列中使用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 - yup,保存文件:"write the file out to disk“
Q3 - <Ctl-W>jj<Enter>是一系列Vim key命令,用于从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.“
https://stackoverflow.com/questions/20930426
复制相似问题