Are there vim or gVim commands for copying text between parentheses?

In the following code snippet, if I go to the first open parenthesis ( line starting with (spit

 (defn missing-accts "Prints accounts found in one report but not the other." [report-header mapped-data out-file] (spit out-file (str "\n\n " (count mapped-data) " " report-header "\n\n") :append true) . . . 

vim selects the first ( and closing parentheses ) .

Is there, and if there is, what is the vim command that can handle the entire merge command?

Thanks.

+4
source share
3 answers

Vim has such a team, and, fortunately, it is very simple. Just enter y% .

The reason for this is that % is because Vim calls the move command. It moves from one separator to the corresponding separator - in your case, from the opening bracket to the closing one. The y command allocates one line to the Vim buffer if it is called as yy , but the second y not required. Instead, you can create a motion of type % , after which Vim will withstand the text moved. So y% .

+7
source

Sequence

 va( 

will stand out from opening to closing brackets inclusive, and y will then delay it. Note that unlike the % command, you do not need to be placed on the bracket — you just need to be inside the sentence.

note that

 vi( 

will select everything inside the brackets, but not the brackets.

You can do this for curly braces ( { instead of ( ) and XML tags ( t - presumably for the tag)

+9
source

use% with y. press "y" once, then "%", your cursor should be turned on "(" when you enter the command.

+2
source

All Articles