Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Given three sample lines:

some('lorem _ ipsum');
$some['lorem _ ipsum'];
<span class="some _ class">

(cursor is in _ position)

Which is the fastest way to select (for pasting in other place):

  • text between ' quotes
  • expand the selection to include the parenthesis
  • text between parenthesis
  • text between < and >
share|improve this question
add comment

1 Answer 1

vi' will select text between quotes (use va' to include the quotes themselves)

If you're already in visual mode, another a( or ab will expand to include the parentheses

vi( or vib will select text inside parentheses; va( or vab will select including the parentheses.

Similarly for vi[, va[, vi<, va<, etc.

See :help text-objects for more information.

Consider also skipping the selection step, and just yank (copy) them (yi', ya(, etc.) or deleting (cutting) them (da', di<, etc.) before pasting somewhere else.

share|improve this answer
    
Thanks, any other options than inside? (as inside this does not work in IdeaVim (plugin for PHPStorm IDE) ) –  takeshin Sep 10 '11 at 14:11
1  
I don't know anything other than what it says at :help text-objects. I don't use that plugin, and would never even consider it if it interfered with such basic vim functionality. –  frabjous Sep 10 '11 at 14:16
    
And ci will change the text inside. –  Ryan A. Mar 18 '13 at 20:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.