引用中提到的运算符列表:h operator:
The motion commands can be used after an operator command, to have the command
operate on the text that was moved over. That is the text between the cursor
position before and after the motion. Operators are generally used to delete
or change text. The following operators are available:
|c| c change
|d| d delete
|y| y yank into register (does not change the text)
|~| ~ swap case (only if 'tildeop' is set)
|g~| g~ swap case
|gu| gu make lowercase
|gU| gU make uppercase
|!| ! filter through an external program
|=| = filter through 'equalprg' or C-indenting if empty
|gq| gq text formatting
|g?| g? ROT13 encoding
|>| > shift right
|<| < shift left
|zf| zf define a fold
|g@| g@ call function set with the 'operatorfunc' option
Run Code Online (Sandbox Code Playgroud)
引用视觉模式如何与运算符一起使用:h operator:
Instead of first giving the operator and then a motion you can use Visual
mode: mark the start of the text with "v", move the cursor to the end of the
text that is to be affected and then hit the operator. The text between the
start and the cursor position is highlighted, so you can see what text will
be operated upon. This allows much more freedom, but requires more key
strokes and has limited redo functionality.
Run Code Online (Sandbox Code Playgroud)
所以我明白,如果我在视觉模式下选择几个单词并按d,所选单词将被删除,因为d运算符可以通过运动键或通过在视觉模式下选择文本来指定其操作数。
但我发现,如果我在视觉模式下选择几个单词并按x,那么所选单词也会被删除。但x不是运营商。虽然这应该有效,但我无法从 Vim 的帮助中理解。
您能否帮助我了解哪些命令适用于在视觉模式下选择的文本,哪些命令不能,以及我如何从 Vim 的帮助中找出这一点?
首先,d不要删除,他们:d[elete]会删除。使用“delete ”这个词是一个严重的错误,它在 Vim 的文档中重复出现,因此几乎在网上随处可见。使朋友真正删除某些内容的唯一方法是使用“黑洞”寄存器,.dd:help "_
其次,您可以通过向下滚动一点来找到问题的答案:help其次,您可以通过从引用的内容
Additionally the following commands can be used:\n : start Ex command for highlighted lines (1) |v_:|\n r change (4) |v_r|\n s change |v_s|\n C change (2)(4) |v_C|\n S change (2) |v_S|\n R change (2) |v_R|\n x delete |v_x|\n [\xe2\x80\xa6]\nRun Code Online (Sandbox Code Playgroud)\n\n阅读:h x并再次向下滚动一点,或者更简单地说,跟随v_x行尾的标签。
您的问题写得很好,布局也很好,但您应该更明智地花费时间和精力。例如,阅读第一个屏幕。
\n