Vim All The Things: Adding Keyboard Bindings to My Favorite Tools

First things first, I suck at Vim. So don’t expect this post to be about how to be a Vim god, nor will I teach you how to use it.

But I love this text editor! It takes me away from having to reach my mouse, saving precious battery (I think), and arm movement (how lazy can I get).

I hope to master Vim as time goes along. As with other things I bother learning though, I’m in no hurry.

What’s Vim, you ask? You’ve made it through 3 paragraphs already. Seems like you’re pretty interested. Here’s an article that may help you.

So what’s this post all about?

Let me focus on how I set up Vim-like bindings for the bash terminal prompt, VS Code ♥️, and Chrome. Yes, even in Chrome. I also configured Vim to serve as both my Git Mergetool and Difftool via VimDiff. This way I get to exercise my Vim-muscle fibers. I hope so will you.

Enable Vim Mode in Bash Prompt

This one’s easy. Just edit your .bash_profile or .bashrc file (whichever you’re currently using, but choose only one).

Doing this via bash terminal:

$ echo "set -o vi" >> ./bash_profile
$ source ./bash_profile

I believe this works both in Mac and Linux. Haven’t tried it with Windows Powershell or GitBash. Got it to work on Windows? Share it in the comments.

Add VSCodeVim Bindings to VS Code

I love Visual Studio Code. I’ll blog about it in the future.

Anyway, it’s really easy to add Vim mode to VS Code.

Just install the VSCodeVim plugin.

Navigate Chrome with Vimium

Again, adding the keyboard bindings to Chrome is just another plugin away.

Install Vimium Chrome Extension and release the hacker in you.

Setting VimDiff As Default Git Difftool and Mergetool

I’ve taken it to the extreme and forced myself to use VimDiff both as my default difftool and mergetool for Git.

Let’s do this via the terminal:

$ git config --global merge.tool vimdiff
$ git config --global merge.conflictstyle diff3
$ git config --global mergetool.prompt false
$ git config --global diff.tool vimdiff
$ git config --global difftool.prompt false

For more information about VimDiff, here are some additional resources:

Conclusion

Learning how to be effective in Vim is not at all easy. It involves a lot of finger memory, which can only be trained through perpetual repetition. Hopefully, we could get better at using this valuable tool by integrating it into most of our favorite applications and tools.

Do you know of any more ways to add the keyboard bindings to other applications? Please do share them in the comment section.


Originally published at RemLampa.com.