The Vim epiphany

zombie posted @ Thu, 20 May 2010 04:58:53 +0800 in VIM with tags vim epiphany , 1589 readers

 Switching from the world of easy-to-use modeless editors (Notepad, TextMateBBEditXcode etc) to the unfamiliar modal landscape of Vim requires a large effort. I suspect that a fairly common outcome is that, without sufficient motivation and commitment, many people end up giving up and going back to what they were comfortable with before.

If you're one of the lucky ones, this won't happen to you and you will instead arrive at an "epiphany moment" (or perhaps a series of small epiphanies) in which you feel like you finally understand what all the fuss is about, and decide that this is the editor that you would like to take for your lawfully wedded wife, or husband as the case may be.

Some people never experience that moment, and some experience it in entirely different ways with an entirely different editor, like Emacs. Others never have an "epiphany" with any editor, but instead settle in comfortably with an editor like TextMate or an IDE like Eclipse.

In this brief article I'm going to try to convey the essence of my personal "epiphany" with Vim in a way that will be understandable to anybody, even someone who's never touched Vim, as long as it is read with a receptiveness and a desire to "get it" and find out what all the fuss is about.


Vim is extremely powerful, but that's not what this is about. Emacs is extremely powerful too, as is any number of IDEs. Being able to do super-complicated stuff isn't something that can set an editing environment head and shoulders above the rest, but is rather a minimum base-line requirement.

For me the thing that matters about Vim is actually the simple stuff. The basic, repetitive editing actions which you do literally a thousand times a day. If an editor can make those things as easy as possible for me, then it's won my heart.

This is why Emacs could never truly win me over. The easy stuff just didn't feel easy enough; the key combinations too uncomfortable and the customization (using Emacs Lisp) had too high a barrier to entry.

Vim, on the other hand, instantly felt right: easy-to-remember, mnemonic key commands; excellent default settings out of the box; easy customization using a familiar, C-like scripting language; comfortable keyboard access (almost no modifier keys or sequences of multiple keys being held down).

Let's illustrate with a quick example:

if (foo)

Imagine you're editing the above snippet and the cursor is at the end of the fourth line (shown with a vertical bar, |) and you decide that you want to insert an additional function call above that line.

With a "normal" text editor your typical pattern will be:

  1. Hit the "up" cursor key to go to the previous line
  2. Hit "Return" to open up a new line
  3. Start typing the additional function call

Note that if your editor is indentation-aware at least you won't have to worry about tabbing over before you start adding your function call, because you'll already be in the fourth column.

Now let's compare the Vim way of doing this:

  1. Hit "O" to open a new line above the current line
  2. Start typing the additional function call

The obvious advantage here is that we've achieved what we wanted in two steps rather than three; a very important distinction when we're talking about something that you probably want to do dozens or even hundreds of times in a normal day of coding. This two-step pattern is something that will come up again and again in Vim: "prepare to do something" and then "do it".

The not-so-obvious advantage but equally important in my mind, is the fact that with Vim there is a much smaller cognitive gap between what you want to do, and how you instruct the editor to actually produce the result that you want. That is, what you want to do is "open a new line above the current line", and the way you do it is to type "O", which is the Vim command for "open a new line above the current line". This command will work as you would expect no matter where the cursor is on the line.

In a normal editor on the other hand, the cognitive gap is larger. We can make the gap even more evident if instead of placing the cursor at the end of the line we imagine that it is somewhere in the middle (perhaps we moved it there to correct a typo). Note the cognitive gap between what we want to do (open a new line above the current line) and what we actually have to instruct the editor to do in order to get what we want:

  1. Hit the "up" cursor key to go to the previous line
  2. Hold down "Command" and the "right" cursor key to jump to the end of the line
  3. Hit "Return" to open up a new line

So that's three steps and only one of them actually matches up with our final intention (opening a new line); the first two steps instead have us thinking about completely unrelated things, like moving to the previous line (a line we don't even want to edit) and jumping to the end of a line (again, not even one we want to edit).

If you give Vim a try and start analyzing how you do things in Vim and how you do them in your old text editor, you will see this kind of pattern emerge again and again. The distance between what you want to do andhow you do it tends to be so much shorter in Vim.

And the reason this is so important is because it applies to operations which are so common while editing code. Things like:

  • opening up a new line before the current line
  • opening up a new line after the current line
  • appending to the current line
  • deleting a line
  • moving a line
  • copying a line

Learn these basics and you will be loving Vim already. The basics alone are enough to make a compelling case. But that's not all you get.

Vim makes the basics easy but it also makes the hard stuff easy too. You don't have to learn all the high-level "power features" on day 1, but as you go you will gradually pick them up, one by one. Things like macros, multiple clipboards ("registers" in Vim lingo), awesome buffer/window management, amazing customizability. And all of this in a rock-solid environment which can handle any number of files and files of any size.


Original post:

maki said:
Sep 03, 2018 07:45:06 AM

What is Really Going on with your post. I am also writing on this topic in my and I am glad that you have shared this amazing work of yours with us. Thank you for your help.

dissertation writing said:
Oct 13, 2018 03:59:41 AM

Why don't I get such invitations? I love food and always look for new place to visit and try it out. You are lucky man, thanks for sharing your experience

Rylan Landon said:
Dec 29, 2018 11:34:45 PM

Genuinely I just read through it again yesteryear and yet We numerous head to fix it and today I wanted to study it again ever again considering that it is somewhat well written. Accountants East Grinstead

agen bola sbobet Ind said:
Apr 02, 2019 07:02:37 PM

Thanks for sharing this useful information here

bandar bola online r said:
Apr 06, 2019 08:30:52 PM

Thanks for sharing with us this useful post. because I have to visit your site weekly for new updates.

biodieseluniversity. said:
Apr 23, 2019 11:32:06 PM

Converting from the universe of easy to utilize modeless editors named Notepad, TextMate, BBEdit, Xcode etc to the unaccustomed modal scenery of Vim needs a large energy. We thought will be good source for them. I am doubtful that an honestly shared result is that, without adequate incentive and commitment, many people leave and go back to what they were contented with before. said:
May 21, 2019 08:38:29 PM

Swapping from the world of simple to utilize modeless editors to the unacquainted modal scenery of Vim needs huge effort. He didn’t like much. I am doubtful that a justly common consequence is that, without adequate incentive and promise, many people quit and go back to what they were contented with beforehand, because of the comfort zone.

help with a disserta said:
Sep 26, 2019 02:05:59 PM

I haven't quite understood the difference between Vim and Emacs. All I got was that they are both really powerful.

online dissertation said:
Oct 28, 2019 07:21:20 PM

If you want to make the hypothesis successful and effective, keep in mind that it should be measurable and tested.

dissertation hypothe said:
Oct 28, 2019 07:23:30 PM

At first sight, the idea of starting to work on the doctoral dissertation is challenging and intimidating.

dissertation intro said:
Dec 02, 2019 06:30:05 PM

I understand nothing from the written above.

Matthew LoftusHills said:
Jun 17, 2020 02:00:58 PM

This is really informative post, I love to see this post, I am working for Carolina Demolition Services company which provides complete demolition services after property damage and during reconstruction. We handle demolition projects after a fire or water damage has occurred and during structural remodels and additions.

123Movies: Watch Mov said:
Oct 18, 2021 04:20:56 PM

d statistics and contact. just load the internet website and search for what you would really like. what is extra, it is absolutely unfastened. Soap2day is your personal internet site which helps you experience your unfastened time with looking preferred movies soap2day has a massive series of nice films for you. soap2dat

123Movies: Watch Mov said:
Oct 19, 2021 02:10:12 AM

We haven't published recently and the public is using our online web site for online movie and TV streaming. You will not be able to create an account online on our Internet to use it because it is regularly rented with the help of everyone around the world without any regulation.solarmovies

123Movies: Watch Mov said:
Oct 19, 2021 11:22:56 AM

gomovies is one many of the only films to take a look at without downloading films on lineonline. there are numerous net sites available to movement media but now not all of them are free. in place of using them, you can watch our gomovies new net site modern-day complete-length movies online for gratis . another right factor about our gomovie expert website is which you in reality can watch television collection and television indicates thereon . We haven’t released lately and plenty of people are the usage of our internet on-line for on line films and tv streaming. to apply it you're doing now not were given to create an account on our internet web pageonline as it are often hired with the aid of all of us spherical the sector without any on lines. gomovies

SEO said:
Feb 27, 2022 06:26:18 AM

I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. โรงงานผลิตครีม

SEO said:
Mar 10, 2022 05:20:38 AM

I hope you post again soon. Big thanks for the useful info. 안전놀이터

SEO said:
Mar 10, 2022 11:34:06 PM

I hope you post again soon. Big thanks for the useful info. 메이저사이트

SEO said:
Mar 11, 2022 08:13:13 PM

Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! jili slot เว็บตรง

SEO said:
Mar 12, 2022 07:59:26 PM

I was surfing the Internet for information and came across your blog. I am impressed by the information you have on this blog. It shows how well you understand this subject. Leedon Green Balance Units

SEO said:
Mar 18, 2022 05:07:30 PM

This is unique art and just few people can understand this art and doing this. Some kids are like this art and they have abilities to do this unique art with your unique mind. BRAND IDENTITY DESIGN AGENCY

seoo said:
Mar 19, 2022 02:35:49 AM

Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! 안전놀이터

seoo said:
Mar 26, 2022 04:21:56 AM

I love the way you write and share your niche! Very interesting and different! Keep it coming! Hair transplant cost in Turkey

Hibbah said:
Mar 31, 2022 09:34:04 AM

You’ve got some interesting points in this article. I would have never considered any of these if I didn’t come across this. Thanks!. listwy przypodlogowe

SEO said:
Apr 01, 2022 05:43:48 AM

Thanks For sharing this Superb article.I use this Article to show my assignment in is useful For me Great Work. ESPN live

SEO said:
Apr 01, 2022 07:16:48 PM

Great survey, I'm sure you're getting a great response. 의정부출장안마

Hibbah said:
Apr 02, 2022 04:34:19 PM

Thanks for your post. I’ve been thinking about writing a very comparable post over the last couple of weeks, I’ll probably keep it short and sweet and link to this instead if thats cool. Thanks. SHOPIFY WEBSITE DESIGN AGENCY

SEO said:
Apr 06, 2022 10:08:46 PM

I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. 먹튀검증사이트

SEO said:
Apr 08, 2022 11:14:44 PM

What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. 인천출장마사지

SEO said:
Apr 09, 2022 09:05:09 PM

SEO said:
Apr 10, 2022 04:42:57 AM This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work najbolji brokeri u hrvatskoj
Hibbah said:
Apr 10, 2022 09:28:23 PM

Thank you for taking the time to publish this information very useful! recarga jogo

SEO said:
Apr 11, 2022 10:22:54 PM

I know your expertise on this. I must say we should have an online discussion on this. Writing only comments will close the discussion straight away! And will restrict the benefits from this information. برنامج رامز موفي ستار

Hibbah said:
Apr 12, 2022 12:05:41 AM

I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks handicap parking placard

Hibbah said:
Apr 12, 2022 02:07:40 PM

I’ve read some good stuff here. Definitely worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. trust nannies bali

SEO said:
Apr 13, 2022 03:08:14 AM

Thanks For sharing this Superb article.I use this Article to show my assignment in is useful For me Great Work. 출장안마

Hibbah said:
Apr 14, 2022 01:26:32 PM

i never know the use of adobe shadow until i saw this post. thank you for this! this is very helpful. من شارع الهرم

SEO said:
Apr 15, 2022 11:00:10 PM

Stopping by your blog helped me to get what I was looking for. prototype building companies

Hibbah said:
Apr 16, 2022 03:40:57 AM

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. Thanks... rowery damka

Hibbah said:
Apr 16, 2022 12:37:04 PM

This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself.. recarga jogo

SEO said:
Apr 17, 2022 08:02:50 PM

Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject. bild zeichnen lassen

Hibbah said:
Apr 17, 2022 10:52:51 PM You understand your projects stand out of the crowd. There is something unique about them. It seems to me all of them are brilliant. المؤسس عثمان 91
SEO said:
Apr 18, 2022 01:44:37 AM

Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. Ki Residences Price

Hibbah said:
Apr 20, 2022 12:45:14 AM

We are a 100% prison Thai on line income organization, 100% bt unfastened organization with international elegance excellent products. It is an modern product from Far Infrared Glutathione Complex Innovation that has obtained global awards. the icon

SEO said:
Apr 20, 2022 07:04:12 AM

This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you. cbd tropfen

Login *

loading captcha image...
(type the code from the image)
or Ctrl+Enter