3 ms·
Three things gave a background to my decision to start learning Vim: * A nagging desire to drop Mac OS X in favor of Linux and, therefore, the necessity to fin
by johncoltrane 14y ago
Three things gave a background to my decision to start learning Vim:
* A nagging desire to drop Mac OS X in favor of Linux and, therefore, the necessity to find an alternative to TextMate.
* TextMate's learning curve is very flat and very short. After years of heavy usage, I was bored.
* I've seen a couple of "magic" Vim screencasts that left me drooling like an idiot.
Because of the first point, I've spent a significant portion of 2009 trying out all the Linux/cross-platform editors/IDEs I could find: Gedit, Geany, Kate, Scribes, Redcar, Emacs, Vim, Eclipse, Komodo, IntelliJ IDEA… I've tried them all. I wanted completion (even basic), some kind of snippet system, themeability, fast navigation… and all of it was available in one form or the other in most of those editors/IDEs.
Because of the second point, the over all design of the editor, the steepness of its learning curve and all sorts of subjective details (keyboard friendlyness, scriptability, active community…) were also weighted when trying out all those editors/IDEs.
Because of the second and third point, I was very curious about Vim. It was the most "special", advanced users seemed to be able to fly and it was cross-platform. The String Calculator Kata In Python screencast (http://vimeo.com/8569257 http://vimeo.com/8569257) by Gary Bernhardt, despite showing an heavily customized Vim, was mesmerizing. It's very subjective, I know, but I felt that Vim was just my kind of "special".
But yeah, it was really "special". All my attempts to use it had been very frustrating and I was about to settle on Eclipse.
Then came the right occasion: I had a totally empty week before me. Nothing to do at work, my kid was at his grandparents'… So I decided to give Vim a serious try.
I decided to start right at the beginning: $ vimtutor, which I did a good twenty times. After each session, I opened an old html or js or txt file and tried to apply my new knowledge. Of course the first day or two were very unproductive and frustrating but I had a lot of time and no obligation of prductivity so kept trying. After a week, I knew all the basic commands but I was definetely not ready. When, finally, I had some real work to do I naturally turned to my trusty old TextMate while I spent a couple of hours every night watching screencasts, reading tutorials, practicing and, above all, doing the biggest rookie mistake: trying to turn Vim into a TextMate clone.
I installed lots and lots of plugins, filled my .vimrc with hundreds of lines I didn't understand copypasted from people I didn't know and tried to map 1 to 1 Vim's and Textmate's keyboard shortcuts. After a few weeks at this rate, my Vim was an horrible and slow mess. It took a lamentably failed attempt to use Vim on a VPS for me to actually accept my failure and decide to go back to square one.
I deleted the content of my .vimrc and of my .vim/ and tried $ vimtutor again. I was a new "student": more open minded, more willing to learn. It was only at that time that I found myself suddenly blown away by the elegance of Vim's design and, yes, the SIMPLICITY of its language. Before that, aJc/ and Co. didn't really make much sense. After that, it took one month or so for me to finally make the switch after "solidifying" my newfound zen.
For me, it was mostly a question of design. And of being in the right state of mind.
So no, I won't prove you why Vim is better than X. That would be pointless because a. I don't care about you or the editor you use and b. I'm perfectly satisfied with the choice I made and I don't feel the need to convince myself through others that I was right.
Use whatever tool you prefer/know/need/can afford.
Instead I will show you a few things I THINK are cool.
yy5p to duplicate the current line 5 times
:g/pattern/norm @m to apply macro m to all lines matching "pattern"
:'<,'>norm yss<li> to turn a bunch of visually selected lines into list items (the '<','> is added for you by Vim and the yss part is provided by Surround.vim)
:ts <tab> to select tags from a <tab>-navigable list
<C-x><C-l> (mapped to ,= here) to complete lines
<C-x><C-f> (mapped to ,: here) to complete filepaths
dat to remove a whole html tag
ci( to delete the content of parenthesis and enter insert mode
R to enter replace mode
<C-a> and <C-x> to increment/decrement a number (with an optional count)
<C-r>= in insert mode to insert the result of an expression
vatat to select a whole table row from within one of its cells
:s/foo/bar the best search/replace mechanism I've ever used
<C-o> and <C-i> to jump through the jumplist
ma 'a to create a mark and jump to it. that's pure beauty.
/?{}wWeEbBfFtT and all the other motions and text-objects that make moving around so horrible in every other editor
and so on…
I understand that most if not all of it can be achieved in most code editors but, in my opinion, none allows me to do all that in such an elegant and natural manner.
- robomartin 14y agoThis is, by far, the most intelligent and useful post I've seen in my attempt to get some answers and understand. I am as hard-headed and as anyone else. I am also as understanding as anyone else. Change only happens out of necessity and curiosity. I am curious to learn, otherwise I wouldn't spend all this time and take the abuse of some who choose to be total aholes and not take the kind of approach you have taken to at least help someone --not just me, but anyone who may have touched vi and failed-- understand where the strengths may be. Based on your story it is clear that vi is not a weekend project. I am interested in learning so that I can have an opinion that is based on more than the "fuck this" reaction I have had over the last twenty years every time I've touched it on many platforms. I am also impressed by your process and dedication to exploring the space. One can only respect that approach and the conclusion you reached. I too have used a ton of editors. For some reason I've never had the patience to really get into vi. But now I will. Because I owe it to myself to know what everyone is so impressed with. What happens from there is a different matter. Also, thanks for not resorting to insults or calling me a troll as others who never seem to contribute anything of value have done. Thanks again. BTW, if you have more screencast links feel free to share them. I'd appreciate it and I am sure that others who are reading this and might have had the same level of rejection of vi would too.
- johncoltrane 14y agoHTH. There are many screencasts available on the net, paid and free. The best ones happen to be free. Drew Neil's screencasts at http://vimcasts.org/ http://vimcasts.org/ are laser-cut, focused and short. Each video is about one or two specific use-case so you don't get overwhelmed by dozens of "cryptic" commands. The production value is amazing (not in the Michael Bay meaning of the word). Derek Wyatt's Vim Tutorial Videos at http://www.derekwyatt.org/vim/vim-tutorial-videos/ http://www.derekwyatt.org/vim/vim-tutorial-videos/ are the opposite: messy, lighthearted, funny, hysterical and packed with gold nuggets. You'll probably need to watch them a few times if you really want to extract practical knowledge. Peepcode has three Vim-related screencasts but I think they are really bad, specially the "Play-by-Play" one. Yes. Vim is not a weekend project. There's no way you can reach your previous level of productivity in one weekend or two. May I suggest you, based on my own experience, to not install any plugin and not copy someone else .vimrc? Play around with $ vimtutor, exercise on random files (not on serious stuff), read the help (:help<Enter>), watch a bunch of screencasts to get the feel of what it's all about. After the weekend is over you will either be craving for more or be disgusted. Consider both outcomes as a succes and move on to the next step.