Keeping it simple: vim

I've been writing code using vim for almost 20 years at this point. Its keybindings are my default; it's in my blood. When I first started using vim there was a minimal plugin could find things on but in general it was sink or swim. I'm thankful for that, since it forced me to aggressively climb vim's learning curve (turns out :help is actually helpful).

As time passed, I gradually added plugins for various functions - fuzzy finding, grepping, themes, VCS, etc. At one point, my .vimrc was many hundreds of lines long...and it was still largely configuration (vs functions or code I'd written). It was clunky, difficult to make portable, and felt like a mental weight any time I had to interact with it.

So, a few years ago, I decided to "reset". Delete my artisinally-crafted
dotfile and start over. Let the tools do the work instead of trying to get vim to do everything.

It's been a fantastic experience.

This is my entire .vimrc as of March 2020:

syntax off
set number
set relativenumber
set colorcolumn=100
set hidden
set autoindent
set wildmenu
set wildignore+=*/_build/*,*/deps/*,*/.git/*
set path=**
set expandtab
set ts=2
set sw=2
set sts=2
nnoremap ,f :find 
nnoremap ,b :buffer 
highlight LineNr ctermfg=grey
highlight CursorLineNr ctermfg=grey

This is much closer to vanilla vim; if you exclude cosmetic configuration, it's only 13 lines. I can almost type it from memory. Which solves the portability and performance implications of plugins.

Simplifying my vim setup has had another advantage: it's slowed me down as a programmer. :find requires you to think through simple regex. No syntax highlighting means you have to read the code. Using autojump for navigation means you have to stop and switch tools to get around. Initially this drove me a little crazy but a few really great things have come out of it:

  • It's become easier to be thoughtful about what I need to do before doing it. Since the barrier for entry is "higher" - things take longer - it's forced me to think through what I actually need to do before just stabbing around in the dark.
  • I no longer plan out a code change against the code itself. Navigation is more difficult, so it's become easier to write out a solution first then apply it once the problem is solved. Anecdotally, this has allowed me to eliminate broken or incomplete solutions earlier in the process.
  • I've had to become more familiar with grep, git, find, and Bash. Part of me wishes I didn't have to do this - you can get 95% of the way there with simpler tools - but I appreciate having to grow and being more capable when encountering an edge case.

So that's my vim setup. I'm not suggesting it's for everyone! I know very good programmers that have vim set up with all kinds of bells and whistles. But it's surprised me with something that is for everyone: slowing down. Haste makes waste, as they say.

More from dubdromic
All posts