在neovim中拉动一个单词时,请忽略落后的空间
因此,我在单词(YW)拉动时的问题是它也复制了尾随空间:
示例: 对此进行YW:
‖Hello World
导致复制Hello
,
但同样适用于:
‖LongVariableName = 'SomeValue';
复制longvariablename
的结果
是否有一种方法可以使我复制而不复制任何空间? (对我来说,在复制单词时很有意义)
So my issue when yanking a word (yw) is that it copies the trailing spaces as well:
Example:
Doing a yw on this:
‖Hello World
Results in copying Hello
But the same applies to:
‖LongVariableName = 'SomeValue';
Results in copying LongVariableName
Is there a way to make as such I copy without copying any space? (which for me makes sense when copying words)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
yiw
拉动“内字”文本对象(yaw
将包括一个额外的空间)。请参阅:帮助文本对象
。文本对象的一个不错的功能是,光标可以在对象上的任何位置(在这种情况下为单词)可以正常工作。
vim中有许多文本对象:
is
表示内部句子ip
表示内部段落i)
表示内括号等等!
另外,下面的评论@doktoroswaldo指出,您还可以使用
ye
从当前位置拉动,直到单词结束没有空间,e
是当前的单词w
是下一个单词的开始(这不是文本对象,因此在换句话中重复它会要求光标处于相同的位置)。You can use
yiw
to yank the 'inner word' text object (yaw
would include an additional space). See:help text-objects
.A nice feature of text objects is that the cursor can be anywhere on the object (in this case the word) for it to work.
There are many text objects in vim:
is
means inner sentenceip
means inner paragraphi)
means inner parenthesesAnd many more!
Also the comment below by @DoktorOSwaldo points out that you can also use
ye
to yank from the current position until the end of the word without the space,e
is the end of the current word,w
is the start of the next word (this is not a text object, so repeating it on other words would require the cursor to be in the same position).