A Vim User
May 6, 2019
5 minutes read

I am a Vim user, and I have been using Vim for a while. I did not use Vim for a long time as some define a long time. I have been using it for about 2 years or so.

Emacs was my default editor throughout college. I have used it for classes, writing Latex for math documents and papers. I have used Emacs for C++ development. I used Emacs as a mail client, as an IRC chat client, as a personal to-do, as a file system explorer, and as an editor. I used it very much how any emacs user who likes emacs would use it.

I stopped using it for two reasons. The first was because I started to feel pain. I did not know why that was. I switched my keyboard and started using the Microsoft Ergonomic Keyboard 4000, and that did not help. I figured it could be because of Emacs, and when I stopped using Emacs, my hand felts much better. The second reason was because these editors are simple to use with languages like C# and Java without complex setup. Auto-complete in these languages is not easy; the inheritance and interface implementation can be complex even within the standard library. It is not easy to memorize the methods available in a class, or the signature of a method, or even the namespace of a method. Thus, because my development after college was mostly Java and C#, I switched to IntelliJ and Visual Studio.

When I started developing more in Go, I had some options: VSCode and Vim. They were equally popular among Go developers, and so I picked it. I was happy with it, and the customization I needed as well as the extensions were available.

I moved to work for another company, and my development is done in many languages, and most importantly, it is done primarily on a remote server. VSCode was not a good option at the time because remote development on VSCode is slow. I switched to Vim.

Why Vim? Why not Emacs? I was afraid that Emacs will cause me the pain again, and so Vim is the obvious alternative. There was no scientific study that I did to choose: it was merely whatever quickly available. Emacs has evil-mode available as well, but Vim was straight forward. I do not have a large amount of customization, and I did not want to spend a lot of time on that.

Vim had few advantages for me, while some commonly proclaimed advantages weren’t helpful for me.

  • Vim default keybindings were good. The keybindings were meant to navigation, and they are indeed useful for navigation.
  • Vim has a portable configuration file. This includes for any configuration I have such as keybindings and packages. This was important because I need to have the editor experience on two machines.
  • Vim integrates very well with other OS tools such as grep and gpg.
  • Vim is a terminal editor. This means that I can use it quickly with applications such as mutt.

Vim is ubiquitous, but that was never a priority to me. I am a developer, and I can install my tools on my development machine. This could be important for system administrators, when they need to remote into many machines without having to configure them.

Vim is not the best editor ever. It has some constraints and disadvantages. However, given my situation and my needs, I choose Vim.

I configure Vim lightly. My philosophy is: do not configure something unless I needed it in the past enough times to notice the pain. I never had to use NERDTree for example until recently because I had the need to switch between a large number of files quickly. I do not use packages such as Fugitive because I use the regular git command line and I am fine with it. All the key bindings I have are the following:

nnoremap <silent> <leader>F :NERDTreeToggle<CR>
nnoremap <silent> <leader>f :NERDTreeFocus<CR>
nnoremap <silent> [b :bprevious<CR>
nnoremap <silent> ]b :bnext<CR>
nnoremap <silent> [q :cprevious<CR>
nnoremap <silent> ]q :cnext<CR>

And all the functional configurations I have are these:

" javascript configuration
autocmd BufWritePre *.js,*.json PrettierAsync
autocmd FileType javascript let g:prettier#autoformat = 0
autocmd FileType javascript set tabstop=2 
autocmd FileType javascript set shiftwidth=2 

" golang configuration
autocmd FileType go let g:go_fmt_command = "goimports"
autocmd FileType go nmap <leader>b  <Plug>(go-build)
autocmd FileType go nmap <leader>r  <Plug>(go-run)
autocmd FileType go nmap <leader>t  <Plug>(go-test)

" latex configuration
autocmd FileType tex set textwidth=80

" mutt configuration
autocmd BufNewFile,BufRead */neomutt-* set noautoindent filetype=mail wm=0 tw=78 nonumber digraph formatoptions+=w spell

I am certain that VSCode is easier to configure, or that Emacs can do more things with an easier configuration language. But again, my needs is what dictated my editor.

I would say that I am satisfied with Vim. Not extremely happy, but not disappointed either. I still use IntelliJ for Java development because Java configuration for Vim is not straight forward, and that IntelliJ has significantly better support for Java (this is hardly controversial).

There is one major issue with Vim: once you are used to navigation in Vim, it is hard to switch back to anything else. That is why I have Vim plugin inside any other editor I use, as well as the browser.


Back to posts