Now, I am by no means a Vim expert. I heard about it once on the CIG podcast episode on How To Code. One the things that Martin (one of the co-hosts) said was is that if you know about Vim, you either got to it because you were looking for something like it or you hate it…or something like that. It was funny back then. Needless to say, I got curious and looked it up. “Ohh 👻, a bit intimidating!”, I thought. A couple of months after, I installed it, but never really touched it (or so I thought?).
Anyway, all this to say that today I actually got my feet wet with Vim. I was following a couple of the videos from Liveoverflow that I mentioned yesterday. I think that once you are familiar with it, it can feel really powerful.
I have read, specially on Twitter, that people actually ask the “how do you quit Vim?” question a lot. Little did I know that it was the
:wq I used to insert (
i) and save (
:w) a message, and quit (
:q) when merging 2 branches with git.
Other Vim commands I learned today were:
:syntax on, to…well…highlight the syntax of the code bein edited;
:set number to display the line numbers. I also learned that in order for you to set these or other commands as default once you open Vim, you have to edit (or create, if it doesn’t exist) the
.vimrc file in your Home directory and add the lines with the commands you want.
Once you open Vim with the
vim command, you can either press
i to start typing,
o to insert a new line and start typing, or
Shift + G to go to the end of the file. You can run these commands at any point, just make sure that you are in command mode and not “typing mode”. Oh, and I also learned that, when in command mode, you can press
dd and it will delete the line where the cursor is at. 🙃