Vim is one such skill that I'm truly happy that I learned and I wish I learned it a few years before.
Whether you are a developer or just a person who loves coding, you would have probably heard of Vim the text editor. Well, I'm here to share my experience on learning vim and how it improved my workflow.
My initial reaction about vim was like 'why in the world anybody would use this ?'😅. Also, just like other people I did struggle to get out (quit) of vim. But watching other people on the internet using vim was mesmerizing. The way the cursor jumped between lines and all that fancy ways to edit text really made me wanted to learn vim.
After using vim for a few months, these are things I learned and realized about vim.
Vim is designed in such a way that it allows the user to edit without using the mouse, or without moving the hand too much from the keyboard(especially when using the home row technique to type). This gives a nice user experience, especially when coding for long hours, as I don't have to keep switching from keyboard to mouse all the time. And I think this is the main idea that sets vim apart from any other text editor.
Editing over writing
Vim focuses on editing rather than writing new. This is especially true when it comes to coding, as most of the time either we are editing some existing files or copy-pasting code snippets from StackOverflow rather than writing new code all the time.
vim has a superb set of keybindings(shortcuts) for editing, whatever you want to do whether it is deleting text, moving lines, editing multiple lines at the same time, jumping between files, using a terminal to execute a program, or pretty much any way you like to edit text, vim definitely has a quick and easy way of doing that.
How I learned vim
I spent a couple of days learning the basics movements, different modes, copy-paste key bindings and, searching text. Then for the next week, I forced myself to use vim for editing and coding and after a while, my muscle mind connection started to improve therefore my speed improved a lot. (I'm talking about a 5x to 10x increase in speed)
There is so much more to learn about vim, I'm still a beginner. Below are some online resources that I found useful when learning vim.
How I use vim for coding
If editing a single file or working on a project where there are only a few files, I'll definitely go with native vim. But if I'm working on a larger project which includes a lot of files and external modules I'll use Vscode(which is my favorite editor) with an extension called vscodevim, which allows me to use vim keybindings inside vscode. Till now I haven't seen any issues using it this way.
And for most of the IDE's, there will be a tool/extension available for using vim keybindings. If I'm using any editor or IDE the first I'll do is to look for a vim extension that supports it.
Happy Coding 😊