Vim — Improve Your Speed

Vim provides many ways of moving around documents as well as jumping between buffers. In this article we are going to focus on some useful tricks to improve your speed even further.

Operate with Search Motion

E.g. in the below sentence if we want to delete the words in bold. Other than using f{char} or t{char} another easier option is to use the search motion.

Type d/is<CR> and it becomes

To expand on this further, you can use vim-sneak which let you jump to or operates on any locations with 2 characters.

E.g.

Type 2dzis and it becomes

You can also use this with other modifiers, e.g. “v” for selection or “c” to change the words.

Performing Operations with Text Objects

This should sound familiar to any Vim users.

Type ci” then you can change the words inside the double quotes even though your cursor position is not within “”

However, this will not work for the following cases if your cursor is not within the braces or brackets.

Here comes targets.vim. Targets.vim adds various text-objects to give you more targets to operate on. Once installed “ci{“, “ci[“, “ci<” should work correctly for the above scenarios.

On top of that you can use “cin<text-object>” select the next pairs.

E.g.

Type cinB or cin{ you can now change the words within {}

I hope these tricks will be of help to any Vim users.

Do also check out the following articles.

Programmer and occasional blogger.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store