Coolest Vim Features

Visual Mode “o”

This small but relatively un-mentioned key command can switch your cursor from one side of a selection to the other. It’s brilliant!

Go into visual mode with “v”, make a selection then simply press “o” to jump your cursor to the other side of the selection.

Skipping To Empty Lines “}”

I use this all the time. Way better than jumping up and down using CTRL-d and CTRL-u you can jump to empty lines using “}“ for forwards and “{” for backwards.

If you have code that’s pretty tightly formatted this command is huge. At my work we use prettify (a linting tool) which makes sure everyone codes in succinct blocks, usually with an empty line in-between. So when I jump to an empty line I usually know it’s gonna be the start or end of a code block.

Go To Opening Curly Brace “[{”

If you’re inside a pair of curly braces you can press “[{“ to jump to the opening brace from any position. Similarly you can use “]}” to jump to the closing one.

Once you’re at a brace this is almost exactly how “%” behaves I find that “]}” is much quicker and more intuitive to press and now I hardly ever use “%”.

Note, this will also work with brackets using “[[” and “]]” and it works with parenthesis as well, “[(“ and “])”.

Bangin 🔥.

Go To First Instance In a Split

You can use “gd” to jump to the first instance of a word in the file. It’s really useful for jumping to imports or a function definition. But you can also have vim make a split so that your original position is still in view.

Put your cursor over the word you want to find and press “CRTL-w i”


Vim allows you to diff any buffer you want using :diffthis. This is super useful, for not only comparing files and git diffing but I also often use it to compare objects as well.

For example I might be logging some objects into my console and I want to know what the difference is between those objects. The problem is they’re pretty big and really similar.

I can copy and paste both of those objects into their own buffers…

Then call :diffthis on each buffer and Vim will show me the difference…

Viola! The date’s changed.


Vim remembers every position you’ve been to in any file across any number of sessions and you can jump between these positions using CTRL-o (backwards) and CTRL-i (forwards).

It basically means CTRL-o is an an undo for file positions. If I end up somewhere random in a big script file, which often happens when you’re searching for a function definition or variable, I can just use CTRL-o to jump backwards until I get back to the position I was working from.

You can also enter :jumps to have a look at them. It gives you the number of the jump, the line number of the file, the column number and a one-line preview (if the file’s still in vim’s buffers).

Why doesn’t every text editor have this feature?

Mapping terminal commands.

It’s easy to run terminal commands in command mode by entering :!.

I’ve been working on a React Native project for the past year. There’s a cli tool called adb for Android which lets you input text into a physical Android device from your computer’s terminal.

adb shell input text "my text"

This is really useful for pasting text from your computer to the Android device for example.

I have a mapping that lets me do it from inside Vim.

map <leader>at :!adb shell input text ""<Left>

Doing space-a-t will write the command to the command mode then all I have to do is enter the text I want.