社区 Wiki:“Vim:猛拉机制的高级用法”
社区 Wiki
正如 yank 系统的文档所示(感谢 Michal),Vim yank 系统似乎比标准剪贴板更复杂。因此,我认为如果 vim 老手能够向我们展示一些使用此机制的不同方式,那将是有益的。特别是在不使用重量级 IDE(例如 C++?)的情况下使用 vim 进行复杂项目。
原始问题
现在我使用 vim 来输入所有内容,而不仅仅是配置服务器,我不想理清以下琐事。我尝试制定 Google 搜索查询,但结果没有解决我的问题:D。
问题一:如何多次拉取和替换?
一旦我在复制历史记录中有一些东西(如果这就是它的名字),然后在命令模式下突出显示并使用“p”字符,替换的文本就会放在复制历史记录的前面;因此后续的替换操作不会使用我想要的文本。我认为在某些情况下这是一个有用的功能,但我在我的工作流程中不需要它。
问题二:如何输入文本而不导致线条向前波动?
我使用硬制表位以某种方式对齐我的代码 - 例如,
FunctionNameX ( lala * land );
FunctionNameProto ( );
当我弄清楚第二个函数需要什么时,如何插入它而不向上移动文本?
问题三有没有办法在同一台机器上的 gvim 实例之间拥有统一的 yank 历史记录?我有> 1 台显示器。只是想知道,atm 我正在使用突出显示+鼠标中键单击。
Community Wiki
As the documentation of the yank system shows (thanks Michal), The Vim yank system seems to be more intricate then a standard clipboard. I therefore think it beneficial if vim veterans could perhaps show us some different styles of making use of this mechanism. particularly with the usage of vim for complicated projects without the use of a heavyweight IDE (say C++ ?).
Original Question
Now that I am using vim for everything I type, rather then just for configuring servers, I wan't to sort out the following trivialities. I tried to formulate Google search queries but the results didn't address my questions :D.
Question one: How do I yank and replace multiple times ?
Once I have something in the yank history (if that is what its called) and then highlight and use the 'p' char in command mode the replaced text is put at the front of the yank history; therefore subsequent replace operations do not use the the text I intended. I imagine this to be a usefull feature under certain circumstances but I do not have a need for it in my workflow.
Question two: How do I type text without causing the line to ripple forward ?
I use hard-tab stops to allign my code in a certain way -- e.g.,
FunctionNameX ( lala * land );
FunctionNameProto ( );
When I figure out what needs to go into the second function, how do I insert it without move the text up ?
Question three Is there a way of having a uniform yank history across gvim instances on the same machine ? I have > 1 monitors. Just wondering, atm I am using highlight + mouse middle click.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
答案一: 来自 Vim 文档的相关引用(如果不是特别令人鼓舞的话)(请参阅
:help put-Visual-mode
):答案二: R(大写“R”)使您进入替换模式。
恐怕我缺少答案三。答案三: 不太符合“统一复制历史记录”规范,但 "+y 复制到剪贴板,如果剪贴板可用,则 "+p 从剪贴板粘贴。
Answer one: A relevant, if not particularly encouraging, qoute from the Vim docs (see
:help put-Visual-mode
):Answer two: R (the capital 'R') puts you in replace mode.
I'm missing answer three, I'm afraid.Answer three: Not quite matching the "uniform yank history" spec, but "+y yanks to clipboard and "+p pastes from clipboard if a clipboard is available.
拉入缓冲区
拉入缓冲区 b
并将
其放置。
我认为还有更多可用的命名缓冲区。
Yank into a buffer
yanks into buffer b
And
places it.
I think there are more named buffers available.