13

VIM! ViM! vim! Vi Improved! Emacs (Wait ignore that one). What’s this mysterious VIM? Some believe mastering this beast will provide them with untold mastery over the forces of command line editing. Others would just like to know, how you exit the bloody thing. But in essence VIM is essentially a command line text editor at heart and it’s learning curve is so high it’s a circle.

There’s a lot of posts on the inter-webs detailing how to use that cruel mistress that is VIM. But rather then focus on how to be super productive in VIM (because honestly I’ve still not got a clue). This focus on my personal journey, my numerous attempts to use VIM in my day to day work. To eventually being able to call myself a novice.

My VIM journey started in 2010 around the same time I was transiting some of my hobby projects from SVN to GIT. It was around that time, that I attempted to run “git commit” in order to commit some files into one of my repositories.

Notice I didn’t specify the “-m” flag to provide a message. So what happened next. A wild command line editor opened in order for me to specify my message, foolish me assumed this command editor was just like similar editors such as Nano. So much CTRL + C’ing CTRL + Z’ing, CTRL + X’ing and a good measure of Google, I was finally able to exit the thing. Yeah…exit it. At this moment the measure of the complexity of this thing should be kicking in already, but it’s unfair to judge it based on today’s standards of user friendly-ness. It was born in a much simpler time. Before even the mouse graced the realms of the personal computing world.

But anyhow I’ll cut to the chase, for all of you who skipped most of the post to get to this point, it’s “:q!”. That’s the keyboard command to quit…well kinda this will quit the program. But…You know what just go here: The Manual. In-fact that’s probably not going to help either, I recommend reading on :p

My curiosity was peaked. So I went off in search of a way to understand this: VIM thing. It seemed to be pretty awesome, looking at some video’s on YouTube, I could do pretty much what Sublime text could but from the terminal. Imagine ssh’ing into a server and being able to make code edits, with full autocomplete et al. That was the dream, the practice…was something different. So I decided to make the commitment and use VIM for editing one of my existing projects.

So fired the program up and watched the world burn behind me. Ahhh…why can’t I type anything, no matter what I typed nothing seemed to appear on screen. Surely I must be missing something right? Right! After firing up the old Google machine, again it would appear there is this concept known as modes. When VIm starts up it defaults to a mode called “Normal” mode, hitting keys in this mode executes commands. But “Insert” entered by hitting the “i” key allows one to insert text.

Finally I thought I think I understand how this VIM thing works, I can just use “insert” mode to insert text and the arrow keys to move around. Then when I want to execute a command, I just press “Esc” and the command such as the one for saving the file. So there I was happily editing my code using “Insert” mode and the arrow keys, but little did I know that my happiness would be short lived, the arrow keys were soon to be a thorn in my VIM journey.

Join me for part two of this rant in which we learn the untold truth about arrow keys, touch typing and vimrc created from scratch. Until next time..

:q!

Comments
  • 3
    There is a game called "pacvim" on linux.

    It is a pacman game we all know, but your controls are vim commands. You move with k, l etc.

    It really helped me to tackle the second learning curve, that starts after you learn to fully type in vim.
  • 2
    @illegaldisease Ah cool. I'll need to give pacvim a go sounds like it would be right up my alley. Gamified vim tutorial. Yeah getting the hjkl keys down is half the battle for sure. I think as developers the arrow keys are so engraved in our day to day workflow.
  • 2
    @infiniteshroom Yes. Arrow keys are convenient enough, but when it comes to vim, they are completely obsolete. Also, who needs home key when you can have gg ? :)
  • 1
    @illegaldisease Yes so true. f key is your friend as well. Remember finding out about relative numbering as well that totally blow my mind. Arrow keys really are obsolete in vim.
Add Comment