Vim 更改当前行后面出现的括号内的文本

Vim 更改当前行后面出现的括号内的文本,vim,Vim,我经常想更改括号内的文本。如果我的光标位于行的开头: Double quotes and single quotes work by default the way you're describing. Try the plugin https://github.com/wellle/targets.vim to make it work with parenthesis etc. This plugin adds some more text objects too.Here's anot

我经常想更改括号内的文本。如果我的光标位于行的开头:

Double quotes and single quotes work by default the way you're describing. 

Try the plugin https://github.com/wellle/targets.vim to make it work with parenthesis etc. This plugin adds some more text objects too.

Here's another option. Add the following code to your .vimrc file

    onoremap in( :<c-u>execute "normal! /(\rvi("<cr>
    onoremap il( :<c-u>execute "normal! ?)\rvi("<cr>
    onoremap in{ :<c-u>execute "normal! /{\rvi("<cr>
    onoremap il{ :<c-u>execute "normal! ?}\rvi("<cr>

默认情况下,双引号和单引号与您描述的方式相同


尝试该插件使其与括号等一起工作。该插件还添加了一些文本对象。

这里是另一个选项。将以下代码添加到.vimrc文件中

onoremap in(:执行“normal!/(\rvi(”
onoremap il(:执行“正常”?)\rvi(“
onoremap在{:execute“normal!/{\rvi(”
onoremap il{:执行“正常!?}\rvi(“
然后您可以键入
cin(
替换下一对括号内的文本。您也可以键入
cil(
替换最近一对括号内的文本(
n
表示“下一个”,而
l
表示“最后一个”)如您所见,我还使用了大括号,还可以使用方括号、引号等。由于这是一个运算符映射,如果我只想删除文本而不替换它,或者对一系列文本执行任何其他操作,我也可以键入
din(


我首先在本教程中学习了此映射:,我强烈推荐。

我不知道我怎么会不知道它适用于报价。我已更新了问题。有关SO的相关问题:以及网站上的相关问题: