Musings on switching to Vim
As a self taught developer, I am always looking out for ways to improve my software dev kit and knowledge. A big part of any developer dev kit is an editor.
My editor of choice has always been anything made by Jetbrains. I used to make use of PHPStorm - well that’s the only sane IDE for PHP development. I also used the 30 days trial for Rubymine earlier this year when I was searching for a new language to learn. I ended up not learning Ruby and picked up Go instead. Go being a new language didn’t have much editor support - compared to say Java or Python - but luckily Jetbrains were developing this IDE called Gogland. Awesome, I got that installed.
But Gogland was a bit heavy and unstable. I decided to go back to Sublime text, it was blazingly fast but just too basic. I heard good things about VS code - a friend uses this and it seems a little popular in the Go community. I then tried it but did run into a problem which I concluded it being another of Microsoft’s unending software mess. It was related to setting up a plugin for Go development. To be frank, I cannot remember the details of that issue as I wasn’t even keen on using a Microsoft product on my lovely Elementary os.
So I went back to a terrain I used to know so well. Atom. I have a love-hate relationship with this editor. The love part is that it was the editor I used to write the code that ended up being my first open source PR and my first open source library. The hate part is the same reason I hate any other Electron app.
I had run out of options. Then I ran into a post on
r/golang that says something like Vim-go is gold. I then visited
vim-go’s github repo.
2 months later. I am sold and have made use of vim exclusively for all text/code editing ever since.
My Early struggles
I struggled. A lot.
The first pain point was understanding modes. I would type about 4 characters and nothing would get printed to the screen
only to realize I was in normal mode. Damn, I would then have to press
Or if I did mistakenly press
I, i would be editing the source code at some other place different from where I did intend to.
Or was it
hjkl ? Holy cow. Even 2 months after, if you ask me which maps to a corresponding arrow key,
it would take me about a millisecond to answer that.
Although, muscle memory helps me a lot. I don’t even have to remember which is which, I just place my hands on the keyboard and navigate through.
Another thing I struggled with was productivity loss. I would spend time thinking about what command I was to type.
Both commands actually do the same thing. Delete(cut) this line, go 4 line upwards and paste the text there. The first command copies the text, goes 4 lines up, paste then return to the line it copied the text from then delete. While the second one deletes the line immediately (more like cut), go 4 lines upwards then paste.
Or was it
16l only to learn somewhere else you could use
lw or just
Or God help you find that invisible character in your source code (maybe caused by a vim snippet or something). It always ruined my compilation. I would end up switching to Sublime text to look for and delete it.
But like any other thing, it was a learning phase. I proceeded with great courage and determination. I then learnt a lot in the proceeding weeks but was never confident I knew enough to get stuff done, so I kept Sublime text around. 2 months later, Vim (Neovim actually) is only editor installed on my PC. I just couldn’t stand Sublime text any much longer. 0
Switching to Vim was even more enhanced by plugins that simulated features I was used to from Jetbrains and Atom. Here is a handful of them
scrooloose/nerdtree- A file explorer on steriods.
tpope/vim-fugitive- Everything you need to do with Git. This plugin is so sick, it made me appreciate the split diff UI mode on Github.
w0rp/ale- Linting on steriods. Shows you warnings and errors as you type and oh, Vim doesn’t lag a bit.
airblade/vim-gitgutter- Symbols for git diffs in files as you type.
simnalamburt/vim-mundo- Local history for files. This is on par with that Local history feature from Jetbrains. I have this mapped to
<C-z>like regular undo.
With that said, I don’t see myself making use of another editor in the nearest future. Heck, I helped a cousin edit some file on LibreOffice the other day and I literally was bleeding internally. Ok maybe I might use another but it has to be
- Another vim fork :)
- A Jetbrains IDE with vim mode.
- Emacs + Evil.
PS : Checkout my vim config file. It is a little bit disorganized since I have been learning on the go but hey.
0 - I learnt there is a Vim (vintage) mode in Sublime text though.