Discover the best of the web!
Learn more about Digg by taking the tour.
vi survival guide
nuxified.org — A comprehensive guide to a famous text editor "vi", written in vi itself.
- 895 diggs
- digg it
- kday, on 10/12/2007, -32/+7just use nano
- freezombie, on 10/12/2007, -1/+18and what if it's not installed ? true,, nano is getting more common, but it is not as omnipresent as vi... which is a reason to learn at least the basics of vi.
if you had read the introduction.... - dwwatk01, on 10/12/2007, -1/+13I agree with freezombie...vi is just something you have to know if you are a unix/linux poweruser.
- Lazybones, on 10/12/2007, -13/+7I would have to agree with kday on this one. vi is overkill for most tasks. It is a very power full tool but it is actually faster to describe how to dowload an install nano that it is to describe all of the keyboard shortcuts required to do the simplest task in vi.
- jrsims, on 10/12/2007, -4/+8Great tutorial.
Read up, *nix noobs! You can always count on vi to be there when you need it. - jgtg32a, on 10/12/2007, -15/+5VI no digg
Only text editior where you have to type to add text
Use EMACS - TheReport, on 10/12/2007, -1/+10"Use EMACS"
Some Unix systems dont have Emacs, vi is virtually on all of them. To not even consider an alternative is just plain blindsiding yourself. - GreatBunzinni, on 10/12/2007, -1/+2I'll only consider Emacs when I will genuinely have the need for a text editor which doubles as an email client.
- Murdats, on 10/12/2007, -0/+6"Only text editior where you have to type to add text"
im sorry is there something I am missing, you mean when using notepad, emacs etc i can just will the text into existance? - greyfade, on 10/12/2007, -0/+1@trejkaz:
one thing that Gentoo frustrates me about is that it comes with nano in the default configuration of the minimal liveCD... but no vi.
- freezombie, on 10/12/2007, -1/+18and what if it's not installed ? true,, nano is getting more common, but it is not as omnipresent as vi... which is a reason to learn at least the basics of vi.
- VImEnforcer, on 10/12/2007, -1/+6The simple fact is, that most people don't want to bother spending some time learning the vi/m commands. vi/m is the purest text editor and like freezombie said, it is present on all UNIX systems, as opposed to other ones.
- aThing, on 10/12/2007, -5/+3Huh? Are you for or against this article?
- aThing, on 10/12/2007, -0/+3"The simple fact is, that most people don't want to bother spending some time learning the vi/m commands."
That sounds anti-vi, but the other part was pro-vi, hence my confusion. - kaidadragonfly, on 10/12/2007, -0/+2Psh, the only real editor is ed.
http://www.gnu.org/fun/jokes/ed.msg.html
- agilethumbs, on 10/12/2007, -14/+5Yeah this is relevant. What's the next top Digg, a DOS survival guide?
- artemster, on 10/12/2007, -7/+8"A comprehensive guide to a famous text editor "vi", written in vi itself."
No, next top dig is guide to famous text editor notepad written in notepad. - furryball, on 10/12/2007, -12/+2"How to plug your computer's power cord to the outlet!!!1111 Necessary skillz for all tru hakkerz!"
- artemster, on 10/12/2007, -7/+8"A comprehensive guide to a famous text editor "vi", written in vi itself."
- zzzzbest, on 10/12/2007, -7/+2Does vi have spellcheck? If it does, he didn't use it.
- greyfade, on 10/12/2007, -0/+1version 7 does.
- cranium, on 10/12/2007, -2/+10It's true that vi isn't for everyone. I've been using it for 15 years, it's a huge boost to my productivity, but yes it was kind of a drag at first.
- controlguy, on 10/12/2007, -13/+3A "survival guide" ??? I shouldn't need a "survival guide" for anything but the wilderness. When editing a simple text file, nano is perfectly efficient. When coding, I prefer something more featured than vi anyway.
It kind of reminds me of that old joke: emacs would make a great operating system if it only had a decent text editor. - spudge, on 10/12/2007, -12/+6Innovations happened for a reason, we should embrace them rather than holding onto a 30 yr old program. All one gains from vi is a heightened sense of elitism. Small footprint/wide distribution is no excuse to hold on -- just install a superior alternative if a system only has vi.
Also if that's all a system has, trash the system, honestly.- pauldonnelly, on 10/12/2007, -1/+8Vi is popular for a reason; we shouldn't dump it because it's old. Newness is no reason to prefer an editor if the old one works as well or better (which I assure you, Vim does).
And how does trashing a system because it has only one text editor installed make sense? - spudge, on 10/12/2007, -9/+4Trash it, and install something that has a better feature set. It makes perfect sense. And it's not about the quantity of the text editors installed, but about the quality. And I put forth that vi/vim are not necessarily quality for today, granted mainly in the area of usability -- hence this guide in the first place.
When I use the word innovation I assume improvement. In the case that it's not an improvement I'd question its status as innovation. Take for example Vista, hehe nevermind. - randomc0de, on 10/12/2007, -1/+4@spudge
Fact is, if you want to do advanced text editing without a GUI, you need to use keyboard commands. Why switch to some new system that just has different commands? Can you recommend a text editor that can do search/replace, autoindenting, and all the things vi can do, simply over ssh? That's why we need vi. - strcmp, on 10/12/2007, -2/+5@spudge
It is very clear to me that you do not know what usability means. Vi and vim are very usable because their interfaces are so easily accessible. Most commands are invoked with only a single keystroke (no modifier keys).
What you probably meant to say is that vi is not very discoverable; i.e. there is no way you could use it without reading the documentation. So yes, one must "learn" vi quite differently than one would "learn" Notepad. But the point is that once you discover the interface, vi is very usable. - bbbenson, on 10/12/2007, -0/+2yes, you are right, oh wise one. why have we never listened to your kind before? we should toss all the 30 y/o systems in computers, like system scheduling, logic gates, and clock-ticks; for they are old, and all old systems should be chunked. indeed. oh wait. we never listened to your kind, because you are no more than a troll. troll elsewhere.
oh. vi is there for a reason: quick, powerful, intuitive editing. if you want to debug, use something else (emacs, pico sux at debug, imho), but when you need to fix, vi/m fixes. but, you know, its old. like unix, or process scheduling. - Crazen, on 10/12/2007, -1/+1@spudge
Enlighten us, what do you propse vim get replaced with?
- pauldonnelly, on 10/12/2007, -1/+8Vi is popular for a reason; we shouldn't dump it because it's old. Newness is no reason to prefer an editor if the old one works as well or better (which I assure you, Vim does).
- jerub, on 10/12/2007, -0/+4As a long time vim user, every other long time vim user I know starting as a result of:
a) having to know vi in the dark ages.
b) being taught vi or vim by a wisened guru.
c) trying out 'vimtutor', which is essentially a textfile you open, and go through a series of excercies in using vim. Navigation, insertion, deletion, copying, changing, undo, search/replace.
I write code for a living, and I use vim for all the code I write. I've looked at other editors, and many of them manage to implement a lot of vim's features. Programs like Textmate on the Mac make me serious consider switching, but I'm not sure I could go back to notepad style editing.. - bobthebuilder25, on 10/12/2007, -0/+1what would be nice: combine the ability to drap and drop, copy/paste sections of text, and also be able to escape to the VI command mode where you can do things with key commands that are faster than using the mouse.
basically, the INSERT mode of vi with mouse capabilities, in addition to vi's other handy modes- aThing, on 10/12/2007, -0/+3http://www.nuxified.org/vi_survival_guide#Apx.1
- freezombie, on 10/12/2007, -0/+2adding to aThing: VISUAL mode in VIM's GUI interface gvim has mouse support.
- Moshcrates, on 10/12/2007, -4/+0How funny is it that I am sitting here working on cache read and writes. vi is satan. Command editor for batch creation > vi
- ratsg, on 10/12/2007, -0/+2This isn't meant to be a slam on the author of the article. I am sure that it is a fine article. But there are sure a large quantity of vi tutorials out on the Internet.
- rasterbator, on 10/12/2007, -0/+2I preferred using pico when I was studying UNIX administration. It's good to have options. Period.
- Crazen, on 10/12/2007, -1/+3System Administration using pico, I'm assuming this was a trade school or something, and you don't really work as an administrator
- jimmiejaz, on 10/12/2007, -1/+5:wq
- ShadowGT, on 10/12/2007, -1/+3Voila, In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished, as the once vital voice of the verisimilitude now venerates what they once vilified. However, this valorous visitation of a by-gone vexation, stands vivified, and has vowed to vanquish these venal and virulent vermin van-guarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta, held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose vis-a-vis an introduction, and so it is my very good honor to meet you and you may call me "vi"
- aThing, on 10/12/2007, -1/+1That was... intresting.
- Uruviel, on 10/12/2007, -0/+1 1 on your geek points. Chapeau. I never really got the chance to memorize it all.
However the character is simply named "V" not Vi
- retawd, on 10/12/2007, -5/+4I'm still waiting for vii. Microsoft is almost on version 12 and these Unix people are only on version vi? I think we know who is better. I tried that Linux thing and no wonder they have to give it away. It won't even run the newest version of Internet Explorer or my AOL cd.
- mcgirt, on 10/12/2007, -0/+5nano is great but if you're an admin for 1000+ systems and they all have vi and nothing else...then you must learn vi. any serious linux/unix user should know the basics of vi.
- Crazen, on 10/12/2007, -0/+2vim is far more powerful than almost any other editor. The fact that it's everywhere isn't the only reason to use it.
- sblowes, on 10/12/2007, -0/+2VI separates the boys from the men. Although... a good emacs tutorial would be nice once in a while.
- DougTanner, on 10/12/2007, -6/+1Am I the only one here who had to use Emacs/Vi in University and utterly HATED it? There's a reason things like that don't exist in modern OSes, it's called progress people...
- Godzilla, on 10/12/2007, -1/+3@Doug
Emacs and Vi do exsist in the majority of modern OS's. - grapetonic, on 10/12/2007, -1/+0You know, I really HATED Emacs for about two years ago. And I mean HAAATED! But then on one C++ exam at the University the only text editor we were allowed to use was Emacs. So the night before I programmed a little with Emacs and learned the commands and whatnot. And now, I love Emacs. I know that it's pretty bloated but after you've configured it the way you want you will never go back to the Ctrl-C Ctrl-V days.
- Crazen, on 10/12/2007, -0/+2Progress doesn't mean it's something that everybody has to be able to use. You could use notepad exclusively because it's easy to use, but if you were to learn how to use vi and your a system administrator or a programmer then your FAR more productive. Progress could be power, and vim has lots of it.
- Godzilla, on 10/12/2007, -1/+3@Doug
- neko, on 10/12/2007, -1/+0The only essential vi survival command I learned is
"Oh no I forgot to customise $EDITOR and $VISUAL and now it's started vi for me"
:q! - Tynan, on 10/12/2007, -1/+1Unless you're an elitist idiot, you'll understand that vi/m is not for everyone.
I'm a computer science major and I haven't figured it out, nor do I intend to.
Go ahead and include it - but it should not be the first option presented (unless its in a package made exclusively for ultranerd linux junkies who spell Microsoft with a dollar sign). It's way too complex.- egorgry, on 10/12/2007, -0/+3if you want to be a unix admin take the time to learn VI. It's a crucial skill if you work in financial where hpux is dominant and the suits don't want non hp approved software on their trillion dollar enterprise systems. It's really not that hard. I was a poor community college drop out and I learned it. If you don't have to don't bother It's like learning algebra to become a plumber. It all depends on where you want to focus your carrer but if you're a CS major and you are still unsure of the direction you are going to take then go ahead and learn the basics. It's very powerfull and you can then be an elitist idiot that can talk down to lesser humans. ;) Just wait until M$ Vi$ta comes out!!
- Cinder6, on 10/12/2007, -0/+2*Remembers his first experience with Vi when installing FreeBSD and being told by the handbook and others to "open vi".* Man, that was confusing at first, but I haven't looked back. If a HS student can figure it out, surely a CS major can.
It may not be for everyone, but...meh. - Crazen, on 10/12/2007, -0/+2LOL vi is too complex and you're a computer science major. I suggest you go back to looking at a degree in liberal arts.
- CrankyPants, on 10/12/2007, -1/+1vi is useful when there's nothing else handy but I agree that there are much better text editors out there for more complex tasks. Simple admin tasks and scripting: vi's your daddy
but
Copy/Paste and free form text editing alone is a reason to avoid it. vi is outdated -- there's a reason the GUI was developed. Insisting otherwise IS elitist- Cinder6, on 10/12/2007, -0/+1Try GVim.
- 5555, on 10/12/2007, -0/+4Not to sound elitist, but I don't understand why everyone complains that vi is so 'difficult'. Do people realize you do NOT have to learn ALL of its commands and functionality? All I ever use and have ever really needed in vi is to know the following:
i/ESC - toggle insert/normal mode
jklh - are the 'arrow' keys. preceeding with a number will move you that many spaces (e.g. type '9j' = down 9 lines)
G - end of the file
H - top of the file
x - delete a character
dd - delete a line
:q - quite w/o saving in normal mode
:wq - quit with saving in normal mode
These commands- Cinder6, on 10/12/2007, -0/+3Well said, but you forgot my favorite feature: '.' Just press the period button and you repead the last command.
Also, :q doesn't save w/out quitting; it asks you. :q! saves w/out quitting. (This is in vim-6.x and vim-7.x, in my experience; I forget if plain Vi is different).
To those who complain you have to press a button to go into Insert Mode, remember that Vi/m *is* a modal text editor. Personally, I really like that feature, but if you don't like it, you can always change the behavior in ~/.vimrc.
- Cinder6, on 10/12/2007, -0/+3Well said, but you forgot my favorite feature: '.' Just press the period button and you repead the last command.
- shangothrax, on 10/12/2007, -0/+1Personally, I use Vim for editing all my config files.
I used to use nano/pico, but I was bored one day, so I figured I'd give Vi/Vim a second chance...haven't looked back from that point of view.
However, I still use a more featured editor (IDE/Textpad/Kate) for my larger coding endevours (read: large projects).
My recommendation: learn the basics. The more you learn, the better. One of the things I did learn from using Vi/Vim was to be more detail-oriented. Seriously, there were times I found code-snippets where they weren't supposed to be due to careless keystrokes...this is why I still use other things for my larger coding projects as mentioned above.
However, I don't recommend Vim for everyone. The above is only for people who *want* to learn. Elitist people need to take a chill-pill and realise that not everyone thinks the way they do. Seriously. - CharlesDarwin, on 10/12/2007, -3/+1The intro sucked ass! Is this Remedial Creative Writing or a relevant article?
- carve, on 10/12/2007, -1/+0I had to use vi when I learned Fortran in the mid 90's. It sucked ass. Our prof kept saying it was a "powerful" text editor and made it use it. WTF is a "powerful" text editor? It makes letters and symbols! I wound up using the much more intuitive and user friendly pico. IMHO, if it isn't obvious how to use a text editor the moment you open it up, it probably isn't a very well thought out design. These things don't need to be complicated and intricate.
- Crazen, on 10/12/2007, -0/+2You wanna save carpel tunnel, and do actually program or are a system administrator then you would know what vi is for. I don't think your the right audience. You might want to refrain from making such broad statements without knowing what you're talking about.
- user98887, on 10/12/2007, -3/+1VI - I am forced to use this at work.
We have moved on in time and space, now there is this thing called a graphical user interface. Even Unix has it - Xwindows.
It has an amazing array of decent editors.
Why would you still rub sticks together to make a fire, when you can use a lighter.- freezombie, on 10/12/2007, -0/+2does "vi" include gvim in your case ? it has a GUI.
If used and learned correctly, [g]vi[m] can be much more of a lighter than a pair of sticks. I do not say it is for everyone, but I believe most can learn vi if they actually want to. This can be for different reasons. You may want to do so o make your limitation more bearable. - jay314, on 10/12/2007, -1/+1I agree with user98887..
Sure, vi/vim/whatever is probably a terrific editor for sysadmins who don't mind memorizing tons of one- and two-character commands and coming up with cute mnemonics to remember them. But I can't imagine seriously editing any type of large coding project with ANY terminal editor. Why? Well, a good GUI editor can:
display more than 80 characters per line,
change fonts and font sizes (and display any unicode character),
work with a scroll wheel,
have dialog boxes that (for instance) show you all available options without memorizing the damn things,
show documents side-by-side and with tabs,
have menus that show even new users exactly what features exist,
have status bars to indicate large amounts of useful information.
Has nobody here actually used something like UltraEdit, SciTE, or the editor in Visual Studio? Or are you hiding your heads in the sand back in the stone age? - Crazen, on 10/12/2007, -0/+1You can do all that with gvim... And almost all of it with vi. If you need a mouse to code, you're not a very good programmer... I don't care what platfrom you're programming for Linux, mac, or windows.
And yes I've use Visual Studio, Codewarrior, UltraEdit, Textpad, Eclipse (blows the others you've listed away)
Eclipse has been the only serious contender, but vi is a necessary tool for those that don't work within GUI envionrments on remote servers.
- freezombie, on 10/12/2007, -0/+2does "vi" include gvim in your case ? it has a GUI.
- Falconwing, on 10/12/2007, -1/+0All you need to remember about vi is how to exit the damn thing. It helps to remember this phrase:
"[Escape] this [colon] thing, [q]uit and do [not] [return]".
[ESC]:q![Enter] - jonnyfatman, on 10/12/2007, -0/+1Wow. I've been a bit afraid of vi(m) from when I was playing about with linux a few years ago. Just typed in 'vimtutor' into my terminal on my imac and to be honest, once you've learnt the commands, this does look like a really powerful tool.
My advice to people poo-pooing this editor not being user-friendly is to have a go at running vimtutor then after that, reassess whether it is simple to use or not.
Jeez, imagine if people didn't have driving lessons before being able to go out on the road! - Ukghster, on 10/12/2007, -2/+0The only thing you need to know and remember about vi:
:q!
