Vim After A Month
My Vim Journey
I started learning vim in May this year. I wrote this article a month later on my phone while I was commuting upcountry. So bear with me as I was supposed to have released this a few months back.
Why did I decide to give Vim a go?
My very first code editor was Microsoft Visual Studio, a fully fledged integrated development environment from Microsoft. It has the ability to code, debug, test and deploy to any platform.
I used it to write C and C++ code for class work back in college - in 2015.
I was new to programming then, and later when I learnt about web development, I downloaded and used Notepad++ to write simple HTML and CSS. I then later learnt about Sublime Text from Bucky Roberts, of The New Boston Tutorials, and I quickly switched to it.
I later dabbled with Brackets and Atom for a while, but Sublime Text remained my primary text editor for long.
When I got my first job as a developer in 2017, I found that many devs in that company extensively used VScode. I switched to it and until May 2019, VScode was my primary code editor.
I believe I first met Vim in 2017 when I purchased a $5 droplet and server on Digital Ocean. It was (and still is) the only editor I could use on the server. I still didn't know what this 'vim' was. I just learnt how to edit and save files in it - and, of course, how to quit vim :).
It was until I joined Gobble.com's Engineering team (based in Toronto, CA), that I saw the full power of vim. Initially I used to think it was just a tool to make simple edits. I could't believe when I saw my colleagues use it like any other IDE! With syntax highlighting, code completion, vertical and horizontal panes, etc
Whilst still on the Gobble team, it was my engineering manager Chris Woodford who noted that my VScode workflow was too slow and tedious. I would write tests on VScode then switch to iTerm to run the tests, wait till they run, the switch back to VScode to add a breakpoint, go back to the terminal... Ugh! Talk of too much context-switching!
He then hinted to me the thought of switching to Vim for less context-switching, more productivity and faster work (thank you Chris!).
This was his comment:
Spring is actually a good season to learn something new. Might that be Vim for you Ruto? :)
Because I had seen the vim magic when him and I pair programmed, I was sold. I would learn Vim during the coming Spring season :)
How I learned Vim
My goal was to make vim this good
I know, it was a little far fetched but... who said aim for the moon?
I was lucky enough to find a team that was already using vim and was very supportive in its learning.
When I told my team lead, Adim, I wanted to learn Vim, he set up biweekly one-on-ones where we discussed Vim and shared resources on learning it.
He recommended to me Vimtutor then Thoughtbot's free Vim tutorials on Upcase, their classroom.
I did as advised.
And oh, after finishing the vimtutor, I deleted VScode, Atom and Sublime Text for good :).
I also watched Mike's video on learning Vim in a week, I loved it - youtube.com/watch?v=_NUO4JEtkDw
All in all, it was Thoughtbot that gave me a perfect headstart in Vim. Chris Toomey and Ben Orestein's tutorials on thoughtbot.com/upcase/vim really really helped me.
It was on Upcase that I learnt about the dotfiles - dotfiles are text-based configuration files that store the settings of almost every application, service and tool running on your system.
Chris and Ben used dotfiles to customise Vim into a very powerful IDE with syntax highlighting, easier and faster tests setup, faster typing, etc. Thoughtbot even open-sourced their dotfiles - github.com/thoughtbot/dotfiles, which you can use as a starting point - it's enough to get you started.
My number one recommendation is to use the Upcase tutorials on Vim to get started. Just follow along with Chris and Ben as they navigate the vim boat with you.
If you're also using iterm, I recommend disabling the greying out of inactive window panes on iterm's preferences.
Since vim is about productivity, I recommend you get yourself a very comfortable keyboard - the one that makes you smile at every keystroke :). Vim is all about hitting your keyboard and less trackpad or mouse.
I also recommend getting a second, bigger display screen or monitor. This way you will have a bigger playground where you can split your window into different panes and make you avoid swiping screens or opening and closing files in one small pane.
Collins Ruto This article interests me as I too use VSCode but some colleagues use VIM. I have a basic familiarity with VIM like you did but haven't turned it into a full IDE yet.
However, I can't help but ask, why didn't you just use VSCode's built-in terminal by pressing Ctrl+`? You can run tests, builds, and apps in there or do whatever else you want in the shell. Would you care to explain other benefits of Vim over VSCode? Thanks.
I really disliked VScode's inbuilt terminal. I loved running my tests in the terminal so I could have a full view of what was happening. I disliked the idea of having half code and half terminal on VScode - it really didn't impress me. Moreso, I loved splitting my terminal into different panes and tabs running different processes, the server, tests, redis, etc. VScode's terminal couldn't be of much help.
For comparison with other editors, Vim is an advanced text editor.
- It is ubiquitous - it is installed everywhere. All Linux distros have vim installed and set as the default editor. I am sure you have met vim in unexpected places too :)
- Vim is powerful. You can make complex edits quickly with advanced vim features such as macros, registers, command-repetition, autocompletion, text-objects, searching, filters, global substitution, etc. I know most text editors have some of these features, but Vim just takes it to a whole new level.
- Vim's knowledge is transferable - you can use vim's keybindings on your normal command line, or with Unix' man or less commands
- Vim is like a language. Once you start to master it, you start to think in it, which is awesome! Eg to delete 3 words, just type d3w! How cool is that :)
- Vim is thoroughly documented. Forgot a command? Just type :help and you have all the documentation with easy search
- Vim is fun! Once you learn it, it becomes super fun to use! These days I
get into the zoneas soon as I open my Vim editor, I just love it
Todd I hope that helps?
Thanks for this. I've been postponing learning last few months. Now definitely gonna do it.