Shu Uesugi

Goodbye Vim, Hello Sublime Text, and My Final .vimrc

After 3 years of using Vim, I decided to make a switch to Sublime Text 3.

For the past year or so, I’ve used the following editors:

  • Terminal Vim: For editing code for work (mostly building a Rails app). Not using MacVim b/c I use tmux.
  • Sublime Text 3: For editing blog posts and other one-off text files.
  • TextMate 2: For finding-and-replacing on large projects. Much better at this than Vim/ST3.

From now on, I’ll only be using ST3. Here are some reasons. TL;DR: Vim made me OCD about perfecting .vimrc, even though all I needed was an editor that’s good enough.

  • I’m probably much faster at manipulating text in Vim than in ST3, but I also waste a lot of time re-configuring vim. My .vimrc never feels right, and I’m OCD about making it marginally more robust after each tweak. I edit my .vimrc at least once a week, which is bad. I always feel like I can come up with a slightly better way to remap keys. You can combine keys in Vim, so .vimrc’s potential is unbounded. In contrast, ST3 is not as customizable, and hence there’s an upper limit to the amount of configuration I’d do with ST3.
  • In addition, every now and then, I discover a new Vim bundle, which I expect to make me far more efficient than those n00bs using ST3, but I get disappointed every time. 80% of my Vim productivity comes from 20% of the core keystrokes and tools I use, and they are often not the shiny new bundles.
  • To make things worse, so many bundles seem to break randomly on terminal Vim, and it’s usually impossible to debug. GitGutter plugin had performance issues on terminal Vim, and I just couldn’t fix it. Also, bundles often don’t play nicely with each other. For example, DWM.vim occasionally breaks NERDTree, and YankRing pretty much overwrites all of the basic mappings.
  • ST3, on the other hand, is slower at manipulating text but requires much less configuration, at least for someone OCD like me. This is the biggest reason why I made the switch.
  • I often do project-wide find-and-replace, and ST3 is much better at it than Vim is. Although TextMate 2 has a much nicer find-and-replace dialog, that’s the only feature I’m using from TextMate 2, so I might as well use ST3 all the way.
  • Many plugins have become compatible with ST3/Package Control—this wasn’t the case a year ago.
  • I hated ST3’s vintage mode, mainly because I couldn’t figure out how to remap keys or sync the settings with my .vimrc, but over the past year I got reasonably fast at ST3 without using the vintage mode. I was hoping for actualvim project to mature, but that didn’t happen.

…Plus all the reasons outlined on: Just Use Sublime Text.

Vim is a lifelong journey. Even now I want to convert this text, which I wrote in Vim at 80 columns wide, to non-fixed width text, and I’m going to go search for how to do it. I’m probably going to learn something in the process. At year 4 of Vimming.

For me, life is too short to want to touch .vimrc every week.

My Final .vimrc on Gist

I’ve always feared that people would judge me as a non-serious programmer if I used ST3 instead of Vim or Emacs. I realized that I was wrong, but just as a record, I’ll copy paste my no-longer-updated .vimrc here to demonstrate my current Vim knowledge (and OCD-ness).

Plugins Used

  • vim-gitgutter — Git changes on the sign column.

    As mentioned before, it slowed down occasionally and I couldn’t figure out why.

  • vim-airline — Nice statusbar for Git.

    Works well out of the box.

  • base16-vim — The ultimate color scheme.

    Since its inception, lots of themes have been added. Check them out here.

  • cmdalias_vim — Create aliases for commands

    Useful for commands you don’t use often.

  • vundle — Package manager for Vim plugins

  • auto-pairs — Pair parentheses and other delimiters

  • css.vim — Better syntax highlighting for CSS

  • vim-easy-align — Align code blocks

    Switched from Tabular, but forgot why I made the switch.

  • vim-textobj-indent — Useful with vim-extend-region.

  • vim-textobj-line — Useful with vim-extend-region.

  • vim-textobj-user — Useful with vim-extend-region.

  • ctrlp.vim — The best fuzzy file finder out there.

  • vim-easymotion — Vim motions on speed

    Easymotion is now maintained by @haya14busa, and he’s awesome. Lots of improvements in 2.0.

  • vim-move — Move lines up and down.

  • undotree — Undo manager. I never used it though.

  • vim-textobj-rubyblock — Useful with vim-extend-region.

  • vim-better-whitespace — Trims whitespaces.

  • ag.vim — Project-wide search using ag, a faster version of ack.

    I place .vimrc-private in each project directory and do something like this:

    " Search Ruby nnoremap <leader><leader>r :Ag <Space>-G="*.rb" <S-Left><Left> " Search JavaScripts nnoremap <leader><leader>j :Ag <Space>-G="*.(js\|coffee)" --ignore-dir=public<S-Left><S-Left><Left> " Search Stylesheets nnoremap <leader><leader>s :Ag <Space>-G="*.(css\|scss)" --ignore-dir=public<S-Left><S-Left><Left> " Search View Files nnoremap <leader><leader>v :Ag <Space>-G="*.(html.erb\|html.slim\|slim)" <S-Left><Left>

  • nerdtree — Directory/File management

  • syntastic — Syntax checker

  • vim-polyglot — Syntax bundle

  • dwm.vim — Tiled Window Management for Vim

    My preferred way of window management, except it broke NERDTree and Quickfix too often.

  • vim-ctrlspace — The ultimate Vim buffer/session management.

    This is a new plugin and probably the most comprehensive buffer manager I’ve seen. Very high learning curve but recommended.

  • vim-choosewin — Like easymotion, but for windows

    Useful when I’m working on a big screen

  • vim-expand-region — Expand current selection

  • vim-multiple-cursors — Sublime-like multi-selection

    I use this feature a lot in Sublime, but not as often in Vim.

  • vim-visualstar — Make * work in visual mode

  • vim-commentary — Fast comment blocks

    Switched from NERDCommenter, but forgot why.

  • vim-dispatch — Run tests from Vim

    Integrates well with tmux. Protip: use execute 'Focus spring rspec %:' . expand(line('.')) to tell rspec to test the current line, and then do Dispatch.

  • vim-endwise — Automatically end in Ruby

  • vim-eunuch — Unix commands in Vim

  • vim-fugitive — Git in Vim. I use Gdiff and Gblame the most.

  • vim-git — Support plugin for fugitive

  • vim-repeat — Repeat plugin commands

  • vim-surround — Surrond code with delimiters

    Protip: for erb and markdown, use:

    let g:surround_45 = "<% \r %>" let g:surround_61 = "<%= \r %>" let g:surround_33 = "\r"

  • vim-unimpaired — A set of handy shortcuts

    I use [q and q] often.

  • YouCompleteMe — The ultimate completion manager

  • IndexedSearch — Show the number of occurrences in a search

  • vim-windowswap — Swap windows

  • GoldenView.Vim — Temporarily resize windows

    The only feature I use is GoldenViewResize. I let DWM.vim handle everything else.

Plugins I stopped using

These are all great plugins. I just wanted to keep my .vimrc minimal, harnessing as much default settings as possible.

  • lightline.vim — A light and configurable statusline/tabline for Vim.

    Why not? I switched from airline once, but didn’t see much benefit, so I switched back.

  • thumbnail.vim — A thumbnail-style buffer selector for Vim.

    Why not? Too overkill for me.

  • tabman.vim — Tab management for Vim.

    Why not? Too overkill for me.

  • vim-signature — Plugin to toggle, display and navigate marks.

    Why not? I don’t use marks. They’re a pain to keep track of, and I try to keep my files small.

  • vim-indent-guides — A Vim plugin for visually displaying indent levels in code.

    Why not? I use terminal vim, and didn’t work so great in it.

  • Delimitmate — Provides insert mode auto-completion for quotes, parens, brackets, etc.

    Why not? I liked auto-pairs better.

  • dragvisuals — Move around visual blocks.

    Why not? From More Instantly Better Vim. I use this feature a lot in Sublime Text, but not in Vim for some reason.

  • clever-f.vim — Extended f, F, t and T key mappings for Vim.

    Why not? Great plugin, but Easymotion covers my needs.

  • vim-skip — Simple movement script for Vim.

    Why not? Great plugin, but Easymotion covers my needs.

  • vim-startify — A fancy start screen for Vim.

    Why not? I stopped using sessions.

  • vim-signify — Show a VCS diff using Vim’s sign column.

    Why not? I use vim-gitgutter instead, but forgot why I made that choice.

  • vim-unstack — Vim plugin for parsing stack traces and opening the files

    Why not? Awesome plugin, but my stack traces have never been too complicated.

  • vim-nerdtree-tabs — NERDTree and tabs together in Vim, painlessly

    Why not? Useful plugin if you use NERDTree heavily. I try to limit the usage of NERDTree, so wasn’t too useful.

  • dwm.vim — Tiled Window Management for Vim

    Why not? Great plugin and used it for a really long time. I’ve since switched to GoldenView.vim.

  • vim-rspec — Run Rspec specs from Vim

    Why not? dispatch.vim did most of what I needed.

  • splitjoin.vim — A vim plugin that simplifies the transition between multiline and single-line code

    Why not? Seemed useful, but didn’t use it enough.

  • trailertrash.vim — Identify and Irradicate unwanted whitespace at the end of the line

    Why not? Switched to vim-better-whitespace.

  • Buffet.vim — A vimplugin for switching and managing buffer lists

    Why not? Switched to Vim-CtrlSpace.

  • open-browser.vim — Open URI with your favorite browser from your favorite editor

    Why not? Used this mainly for markdown files, but I now use Sublime Text for editing markdown.

  • mru.vim — Most Recently Used (MRU) Vim Plugin

    Why not? Again, switched to Vim-CtrlSpace.

  • wildfire.vim — Smart selection of the closest text object

    Why not? Switched to vim-expand-region in favor of repeating capabilities.

  • Gundo.vim — Vim plugin to visualize your Vim undo tree.

    Why not? Switched to undotree.

  • rainbow_parentheses.vim — Color matching parentheses

    Why not? MatchPren was good enough for me.

  • vim-yankstack — A lightweight implementation of emacs’s kill-ring for vim

    Why not? I switched from YankRing, but ended up just using registers.

  • Enchanted Vim — Persistent Very Magic Patterns in Vim Commands.

    Why not? I didn’t use very magic often.

  • Syntax Files

    Why not? Switched to vim-polygot.

Thank you Vim, Hello Sublime

Looking forward to writing production code in ST3. I might come back to vim when neovim becomes stable.

I might post my ST3 config later. If you’re looking for a resource on getting started with ST3, check out Sublime Productivity. If you’re a TL;DR’er, check out Alex Maccaw’s post.

If you have questions, message me on Twitter.