This is our blog. It's mainly about programming, web developement and design, social web, coding habits and advice and miscellaneous geekery. You can subscribe to the feeds to never miss a bit.
Over the last few days, I heard so many people talking about how it’s so “has been” to use vim or another text editor for there’s a lot of IDEs out there. Let me clear this once for all : I I’m not insulting people who use IDEs, I’m not against IDEs. They’re not my choice, I have used several, tried a lot, and still stick to my editor of choice: VIM ! French people say: “Il n’y a que les imbéciles qui ne changent pas d’avis”, which means: “Only stupid people don’t change their mind”, but still… I’ve choosed my tools and from my experience, I just can’t find better.
Don’t believe me? Let me show you some very nice things one can use in vim easily and have a great coding experience:
1# Vim speaks the same language as you
Do you find yourself talking to yourself while coding? Saying something like: “paste this here, delete this, change every X with Y”? Yes you do! Even if you don’t pronounce these phrases, you think them :) vim is written in a way that when you think of an action you can easily type it.
Copy 3 lines, move 3 lines down and paste:
3yy 3j p (yy is for “yank or copy line”, “3j”: move down by 3 lines and “p” is for paste)
d3w : *d*elete 3 *w*ords
y4w : *y*ank 4 *w*ords
d$ : *d*elete everything to the end of line
viB: select (*v*isual) *i*nternal *block useful for selecting a block of instructions
2# Moving: if IDEs walk, vim swings
We don’t write code from the first character to the last one in a single pass, no one can do that! That’s why we say: “editing” files. We move through our code, change things, improve others and so on. Smart coders know that moving smartly in their code is saving a lot of time. And vim offers a wide variety of moves possibilities inside your code, that sometimes with just a single keystroke you can go forward or backward looking for something instead of scrolling.
Star and sharp: In normal mode you can use * and # to search for the word under the cursor. * searches forward for the word, while # searches backwards.
The % key: to jump to a matching opening or closing parenthesis, square bracket or a curly brace.
f followed by char : moves you to the next occurrence of char, and F does the same backwards.
G: end of file
Search don’t scroll: like gmail’s motto (search don’t sort) You can smartly move inside your code by looking for words, characters, phrases… and this could be done very easily. No dialog boxes to nag you, no buttons to click, no mouse to move, only type “/” for looking forward and “?” for the other direction.
3# THE greatest search and substitute power ever!
Basically search and replace in IDEs prompt you with a dialog to input text, check radios and then click on search or replace. And this is just the basic case, IDEs with regex find/replace have very scaring dialogs! Vim doesn’t need dialogs for this. Everything is in the command line. And boy! What a power! Writing the whole search and substitute features of vim would be a manual not a blog post.
4# THE best customization features ever!
Ok, every IDE out there come with many customization features too, but vim is the best in this field. In fact, vim’s key mapping are elegant and very powerful, color schemes are infinite, there are a lots of plugins, more than you ever dreamed of. You can write your own function to do what you want in vimscript and you can write your own plugins in your prefered language if you want (python, ruby…)
5# The weight and portability.
Vim is light, IDEs are not. Yes, some IDEs are available for the 3 main OSes too, but can you use eclipse with ssh easily?
6# The challenge and the pleasure of learning.
During my first steps with vim, I asked in #vim IRC channel how can I easily remember to type ESCAPE to go back to normal mode, and someone gave me the best answer one can give: “you’ll make errors, you’ll type “:w” in insert mode, this will hurt you every time, this will burn your fingers, but you’ll learn“. And this is very true. Vim has a very steep learning curve for someone used to IDEs and mouses, but the more you use it, the better you’ll feel. It’s very rewarding to see that YOU can itch what YOU want in YOUR memory. You’ll learn with vim how to learn good habits.
7# Minimalism and surviving
When you’re used to vim, you’ll be able to use any IDE on this planet, you’ll use them maybe better than people that are used to them. Notice that most IDEs ended by integrating the ability to use vim in their editors… such decisions can’t be wrong. Second, wherever you’ll be you can work on your code, because you’re not addicted and limited to IDE XY. You’ll survive.
That’s it folks, go ahead and learn vim. I bet, and will win the bet, that if you give vim a real try — and by “real” I mean really wanting to learn and not giving up at the first command you’ll see inserted in your text instead of having it executed — I bet you’ll love it! All these monkeys that used vi and still use vim can not be wrong.
EDIT: Just discovered this on bash.org : Everyone’s first vi session?
Some vim resources:
- Vim introduction and tutorial – IMHO
- Vi-IMproved tutorial (Socrates teaching vim to Glaucon. Very fun and instructing)
- Graphical vi-vim (neat cheat sheets to print)
- Efficient editing with vim
- An Extremely Quick and Simple Introduction to the Vi Text Editor
- Linux vi and vim editor: Tutorial and advanced features
- 7 Habits For Effective Text Editing 2.0 (A video presentation of Bram Moolenaar ; the creator of VIM )
- 7 Habits For Effective Text Editing 2.0 (Text version of the presentation)
Worth it?: Please digg it
P.S. Please, bear with me on my poor English, if you notice any error please report it to me and I’ll correct it and btw improve my English which is my 4th langage
Enjoyed this post? please subscribe to our feeds to stay informed.
Commenting is closed for this article.