DEV Community

Discussion on: Vim for starters - the minimum you need to know

Collapse
 
joegaudet profile image
Joe Gaudet

You missed the truly best feature of vim, the i directive.

Say you have this code:

function(foo, bar) {
  // some stuff
}

To select the entire params list, with the cursor in command mode and inside of the params type:

vi(

Now you can copy it or what ever

To select the entire function body

vi{

Better yet, you may want to redefine the param list:

ci(

Which deletes the params and switches you into insert mode

And finally say you are editing some HTML,

<p>Delete this message</p>

You can use:

cit

To clear everything inside of a tag.

Collapse
 
thor574 profile image
Thor Hovden

Ah, thanks!!