Today I would like to write about some of the magic of Vim! I usually study how to code faster learning new Vim commands, some of my favourites are f and t, they’re really handy when you need to change parts of a line and these parts are not wrapped by anything, such as marks, brackets or a simple word.

We’d better see an example:

// specify an alternate install location for Bower
bower: {
  dir: 'app/scripts/vendor'

we would like to erase scripts/vendor from the code above, and the cursor is in the dir word, to achieve our goal we could do fs to go there and then 3dw, but the second command could be replaced by dt'.

If we wanted to delete app/ we could do dT', but if we wanted to jump to the last slash (from our actual position, the first s in scripts) and then delete everything behind and inside the marks we could do f/ and then dT'.

This example was really easy, but if you didn’t know these commands it’s a fast solution when you couldn’t just delete an inner word (diw), something between quotation marks (di'), etc.

These are the things that make me love Vim. :-)