I recently had a friend ping me with 2 questions about vim. They were: “How do I open multiple files?” and “How do I find a specific file?” He admitted that both questions were easily googleable. However, there’s something to be said about asking someone you know to be a prolific vim user. I answered his questions with a stream of consciousness that could have easily been confused with mania. Being thus inspired, I decided to organize my thoughts and publish my very own (opinionated) beginner’s guide to vim.

Before we can dive in to the world of vim plugins, we must first start with a plugin manager.

There are 2 well traveled paths.

vim-plug vs. pathogen

I prefer vim-plug.

Once you have chosen a plugin manager, you must take the next step by stealing specific people’s vim configuration (called vimrc for short) and using it as if it were your own 😈 Make sure you don’t copy entire vimrcs! Copy the lines you want to try out or adopt.

Here’s mine: https://github.com/yefim/dotfiles/blob/master/.vimrc

Notice the giant block of all the plugins I use. Feel free to install any of them. Now to address the specific questions.

Opening multiple files

For opening multiple files, there are 3 paths: splits, tabs, and buffers.

I must be honest. I have never used tabs or buffers. I only use splits - both vertical and horizontal.

I have handy key bindings for navigating between splits with just the keyboard: Ctrl+h, Ctrl+j, Ctrl+k, and Ctrl+l. You’ll find these in my vimrc.

I also use this amazing plugin that resizes my currently focused split to maximum size called Golden Ratio. I’ve never seen any other editor have a plugin quite like it. It takes some time to get used to but I definitely recommend using Golden Ratio because it allows you to comfortably have 4 splits open at once.

File discovery

For file discovery, there are also many, many paths. Some like NERDTree. Some like CtrlP. Some like fzf. Some memorize the filesystem and know which file to open with the :vsplit or :e command. I’m the last one 😳

For the times when my memory fails, I fall back to searching the code (grep, silver searcher, ripgrep, whatever). Ack.vim helps bring code search into vim so I never have to leave my editor. You’ll notice I have some keyboard bindings for it as well in my vimrc.

Before I go, I want to leave you with one vital nugget.

INSTALL ALE
IT WILL CHANGE YOUR LIFE

And lastly, remember step 1: pick a plugin manager. Use that plugin manager to install all the aforementioned plugins. I hope that was helpful.

-Yefim