My Vim Configuration (2020)

Photo by Kevin Ku on Unsplash

Yup. Here’s another “here’s my Vim configuration” post. These are a dime a dozen these days, as it seems “hip” to post your Vim config. That being said, as a programmer I often find it useful to see other people’s configuration, as sometimes it gives me an idea, or I learn a new trick. So, with that spirit in mind, here is my configuration.

For my Vim configuration I use Plug to manage plugins, so if you use another plugin management system, your mileage will vary. Also, I have some keybindings specific to the programming languages I spend the most time in, namely Go, Javascript, and Typescript. So without further ado, here’s the config.

Let’s break down the fun parts. Some of the settings above are to change default Vim behavor. Others are plugins.

Leader Key

A leader key is a way to execute commands using a sequence of key strokes. In my Vim configuration I have set the leader key to comma on line 52.

Buffer Navigation

On line 33 I have setup Vim to remember my cursor position when navigating between buffers. Without this, every time I changed buffer the cursor was reset to the beginning of the line. That got annoying fast.

Global Clipboard

On line 45 I’m setup to use the global system clipboard. By default Vim has registers for the clipboard which is managed internally. I find it easier just to integrate with the system clipboard, personally.

Relative Line Numbers

On line 100 I set Vim to display relative line numbers. If you turn on line numbers it will normally default to displaying absolute values. Relative shows the line number relative to the cursor position. This is super handy for navigation. Couple this with the vim-numbertoggle plugin on line 19, which shows absolute line numbers when in insert mode, and I get the best of both worlds!

NERDTree

NERDTree is a directory and file explorer for Vim. It’s a great way to navigate your project files and directory. I’ve bound <leader>1 as my key combination to toggle NERDTree on/off.

Fuzzy Finder

Simply the best way to search for text in files while in Vim. It opens a window with search results which you can navigate and see a preview.

junegunn/fzf.vim — Fuzzy finder. Simply the best way to search for text in files while in Vim. Opens a window with search results which you can navigate, getting a preview. I’ve set this up to use RipGrep, which is a crazy fast grep replacement.

Lightline

Lightline is a really nice, lightweight status bar. I’ve got mine configured pretty close to the recommended, basic configuration, and have added the current Git branch I’m working on (using Fugitive). See lines 11 and 176–185.

The Rest of It

The rest of the configuration should be easy enough to follow. I have comments for what each configuration item does. Do note, however, that a number of these plugins requires configuration and installation of 3rd party tools (such as Ripgrep, Fuzzy Finder, etc…).

Overall I’m pretty happy with what I’ve got. If you have an awesome configuration tip drop it in the comments! Cheers!

--

--

--

Just a guy who loves his wife, kids, and writing software.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Invoice Gen(Invoice Generation and Management) using .Net Core and EF Nulled

LIQUIDUS (LIQ) Team Voice AMA on October the 1st, 20:00 UTC!

Using AWS EBS Volumes in Kubernetes To Store Persistent Data for Kubernetes Versions > 1.23

Thoughts and learning from ffconf 2017

day 2

Reaper tips n tricks #3 — Dual mono or stereo? Who cares….

How To Set Up Cronjobs on MacOS — Kelvin Mwinuka

48 hours to the google play-store apocalypse

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
Adam Presley

Adam Presley

Just a guy who loves his wife, kids, and writing software.

More from Medium

25 Awesome Linux Command One-Liners

Every git command you’ll need to develop that new feature

How to fix a broken branch after a git merge or git rebase

Developing in a Linux Container on Windows 11 (without Docker Desktop)