ccw在Vim宏中做了什么

 股民连长 发布于 2023-02-06 14:59

在下面的vim宏从这篇文章中,作者给出了解释.我理解一些但不是一切.

:qccwcommand:wjjq

此宏(包括记录开始/停止,如果您想知道)将把当前的'path_to_command'字改为'command',将文件写入磁盘,将窗口分割更改为grep搜索结果,向下移动一行在结果中导航到该结果的位置.

Q1.这是ccw做什么的?是否与cw(改变词语)有关但我不确定.

Q2.:w一定要写,对吗?

Q3.这是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.

David Lam.. 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 - 这jj是一系列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."

1 个回答
  • 你感到很困惑,因为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."

    2023-02-06 15:02 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有