如何在Vim中的括号(或引号或...)之间进行选择? [英] How to select between brackets (or quotes or ...) in Vim?

查看:151
本文介绍了如何在Vim中的括号(或引号或...)之间进行选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我肯定曾经有一个用于这种东西的插件,但是现在我需要它,我似乎(自然)找不到它,所以我只想问一个简单易懂的问题.

I'm sure there used to be a plugin for this kinda stuff, but now that I need it, I can't seem to find it (naturally), so I'll just ask nice and simple.

在方括号,引号或匹配字符列表之间进行选择的最简单方法是什么?

What is the easiest way to select between brackets, or quotes, or generally a list of matching characters?

   write ( *, '(a)' ) 'Computed solution coefficients:'

例如,在这里我想选择(a)Computed solution coefficients:.

For example, here I'd like to select (a), or Computed solution coefficients:.

我对多行不感兴趣,只是在一行上发生的情况.

I'm not interested in multiline, just cases which occur on one line.

推荐答案

使用要在括号内获取的任何导航键,然后可以使用yi(yi)复制匹配括号内的所有内容.这也适用于方括号(例如yi])和花括号.除了y,您还可以删除或更改文本(例如ci)di]).

Use whatever navigation key you want to get inside the parentheses, then you can use either yi( or yi) to copy everything within the matching parens. This also works with square brackets (e.g. yi]) and curly braces. In addition to y, you can also delete or change text (e.g. ci), di]).

我尝试使用双引号和单引号,并且它似乎也可以正常工作.为了您的数据,我这样做:

I tried this with double and single-quotes and it appears to work there as well. For your data, I do:

write (*, '(a)') 'Computed solution coefficients:'

将光标移动到C,然后键入yi'.将光标移至空白行,点击p,然后获取

Move cursor to the C, then type yi'. Move the cursor to a blank line, hit p, and get

Computed solution coefficients:

CMS指出,这也适用于可视模式选择-只需使用vi)vi}vi'

As CMS noted, this works for visual mode selection as well - just use vi), vi}, vi', etc.

这篇关于如何在Vim中的括号(或引号或...)之间进行选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆