Learning Vim (Update)

Three months ago, I started my journey of learning how to use Vim. And since then, I slowly and painstakingly integrated it in my day-to-day workflow. Which I have to say, never lacked instances of confusion and frustration that made me reach to my mouse and open that good ol' Visual Studio Code.

I worked through those growing pains and fast forward to now, I am exclusively using Vim as my text editor. I was able to also appreciate the power and beauty of it which at first I thought was just being romanticized by elitist developers who likes obscure tools.

Learn just enough to do the basic things

It's no secret that Vim has a myriad of commands and technique combinations, which in fact could be overwhelming for someone who is just starting to learn it. Instead of trying to learn all of these commands all at once, I focused my attention on the things that I know will be useful in my daily workflow.

Here are a few things that you must know and ingrain in your muscle memory:

  1. Move, delete and make selections by character, word, line, and block of code
  2. Undo, redo, and save changes
  3. Copy and pasting
  4. Go to a particular line number
  5. Indent and unindent a block of code
  6. Switching between command mode, insert mode, and visual mode
7. Lastly of course, how to exit Vim

Start doing basic configurations and add as needed

Once you became comfortable enough performing all the basic commands, start to tinker around the configurations and try to make Vim more functional and more suited to your needs.

1. Configure .vimrc

Vim out-of-the-box looks bare and can be frustrating to use – no line numbers, no auto indentation, and syntax highlighting. To fix that, you need to configure this little configuration file known as .vimrc – it's like VS Code's settings.json file.

Nothing fancy but it gets the job done

2. Install NERDTree

Vim does have a built-in file system explorer but it is not intuitive and just doesn't look good so I didn't bother using it.

I didn't mind not having a file system explorer at the start but when the project starts to get bigger and have a lot of directories, it became difficult to navigate around. It's also nice to have decent visual on how the whole project structure is starting to shape up as it grows. I just looked for something that's simple and just works, so I installed the NERDTree plugin.

Vim with NERDTree file explorer plugin

3. Install a good theme

A text editor wouldn't be complete without a good theme. And since you'll be looking at this thing for hours on end, you need something that's easy on the eyes. There's a plethora of options out there (you can even make your own), but gruvbox's retro color scheme wouldn't be a bad choice.