Help - Search - Members - Calendar
Full Version: VI: what's the big deal?
OESF Forums > General Forums > General Support and Discussion > General Discussion
CoreyC
For the diehard VI users:

I'm wondering how such a complex editor got so popular. Why do you use VI? People like to say that other editors like nano and pico tend to mess things up, but I find it much easier to mess something up using VI than using pico.

To me, trying to learn how to use VI is like playing a game that my 5 year old son made up. ZZ to save and exit? come on wink.gif

This should probably be in one of those flamewars posts biggrin.gif
jdralphs
Amen! I've never been a VI fan, or even VIM for that matter ... never used Pico -- my favorite Z editor would have to be ee.
Ling
VI is one of those geek big penis deals. I learned to use vi because it was the only game in town when I had to administer a XENIX 286 machine (that served 9 users just fine, the 386 handled 15). I learned just enough to do minimum editing of system files. Now I use KEdit, or similar. If you get a quick reference and practice a bit, you can get by. There are psychos who actually author documents in vi. I imagine they are some of the same folks who will attempt their own vasectomy. OK now all of you geeks who are backtraceing my IP address so you can subscribe me to 1000's of publications, I am just kidding. I back in the glow of you vi annointed.
dmilligan
I use it every day at work. Its a tool. There are better ones out there for sure. Back a few years ago when I went to school, it was one of the main editors to quickly get something done. Cant say its a great editor but when you only have a telnet session into a box and need to edit a file without the nicety of a windowing system, its ideal. I tend to use VisualC++ as my editor of choice as I have learned how it works and can move around quite quickly with it. SlickEdit is ok but doesnt emulate 100% or at least it didnt and that was more annoying to me then using VI. With VI I know its behavior and dont expect it to act like the VC editor. SlickEdit should but isnt 100% so that 1% or 2% difference really annoys me. Rather use VI then constantly back trackiing to fix things because the editor isnt 100%.
Of course if you think VI fanatics are bad, there is also the emacs camp. Never really used it myself since VI suits me.
dh
I must say, I only had a very short experience with VI, trying to edit the file to get my WiFi card to work. What a pain! I always hated the editor in DOS, but it's much easier to use than VI. I found I could edit my file OK, but never did figure out how to save and exit. I kept thinking I had, but my file hadn't changed. Very frustrating.

What saved me was finding Zeditor and later TreeExplorerQT with it's built-in text editor. These are both great apps for anyone that doesn't know the basics of Linux. I'd recommend them (especially TreeExplorer) to any non-Linux person getting a Zaurus.

I would like to go back and learn to actually use VI since I understand it is very powerful and one of the reasons I got a Z was to learn a bit about Linux. Maybe a project for the long New England winter. biggrin.gif
SmackMyBishop
VI isn't about ease of use, it's about productivity.

If you're just using it as a notepad where you have to use 'i', 'ESC', and ':wq', then yeah, it's probably not a good choice for you. But there isn't much competition when it comes to moving text around without reaching for a mouse, setting up and using macros quickly, dealing with large amounts of text efficiently, doing complex search and replaces, etc., all over a low bandwidth SSH connection.

Before you bash it, give it a shot: http://www.vi-improved.org/tutorial.php

-Smack
zxerx
This thread sounds like a troll, but I'll bite. I've been using vi for about 15 years and now I can't live without it. Yes, it is initially hard to use (took me a couple of years to get proficient) and has all sorts of obscure editing modes and commands, but what you can do with it is simply amazing - from a programmer/sysadmin point of view.

Lets put it this way, if pico, joe and nano were family hatchback cars, then vim would be a formula one racing machine. Anyone can drive a hatchback, but few would be able to handle a F1 racecar.

My advise is use the right tool for the job. If all you've got to do is edit the occasional config file, then use something simple. If you're spending 8+ hours a day in front of an editor and need some real power, vim is worth the steep learning curve.
Tehas
QUOTE
but when you only have a telnet session into a box and need to edit a file without the nicety of a windowing system, its ideal.


I agree!

If you're stuck where you can't boot into QT, you could always use vi to edit files and such.
dh
QUOTE
Before you bash it, give it a shot: http://www.vi-improved.org/tutorial.php

Thanks, I'll check it out. As I say, it's not easy for a beginner, but obviously has it's strengths and I certainly want to learn more.
What's really good is that there are apps out there that make the Zaurus accessible for people like me who are not Linux professionals but still want to unleash some of the power of the device.
cane_cubo
In part this is one of those "how can possiblt like the colour blue?" arguments. I use vim to code in Lisp, and it has a few intricate options that make it really useful for the job. I always found the two modes thing to be a big pain (even after years of using it, though rarely as my primary editor), but in vim the two mdoes overlap to some extent -- at least you can move the cursor without leaving edit more.

Personally I don't think there is a more powerful editor on the Z. Until, say, slickedit gets ported over (I wish).
nevarrie
being an advanced user I have to say I love vi and vim for the things I do...though when I have to train new people on how to uses it for simple things I send then to using textpad and past in the content they need or scpinght the file up to the server. Once you learn how to uses things like search and replace, and how to copy and paste with out a mouse vi can be very powerful depending on what you are needing to do...

I have used several machines that are console based that vim was a life saver since I has a way to copy and paste sections of text, search for a string an have it replaced with another string, and have syntax high lighting to see that I had the syntax of a file correct...

I have to say the main reason I have got good with using vi is because I know it is installed on every linux and solaris box by default...though I know it is becoming less common as default on linux since I know gentoo now has nano instead of vi...Thought then again I started doing text editing on Word Perfect 4 for dos in the mid 80s when you had to know special commands to do fancy things...once you learn how to do it there is a whole new world of things to do...though I am not sure if the is much of a new to know it really well if you spend most of our time in a gui and do not have to worry much about sshing into a server and fixing files...I have people I work with that alwasy scp the files down and edit then scp the files back up form their windows machine when they are finished editing in thier faverate editor...

For me vi is great and if you have the time I would recommend learning it if you do editing of text files(expecially remotely) otherwise vi may not be something you want to spend your time leaning other then knowing "i" for insert "ESC" to get out of insert more "h" for left "j" for down "k" for up, "l" for right, and ":wq" to save and quit. Just rember if you know vi almot all the time you will have an editor on most Unix servers...
qx773
Before vi, there were line editors like ed and edit which resemble EDLIN in MSDOS. Compared to ed or edit, vi is more efficient for editing. Back in the old days, computers were expensive, costing tens of thousands of dollars for machines that had only 64KB of RAM, so cheaper non-programmable dumb terminals were more common. Some terminals were essentially dot matrix printers with a keyboard attached to them, communicating at 110 baud, or about 11 characters per second, like a typewriter, so you could not do full screen editing on them, so you had to use ed or edit. That is probably one of the reasons why the C language is so concise, using single character tokens for a lot of its syntax. With ed or edit, you had to use substitution commands to replace some text with revised text rather than editing text in-place. Video display terminals, such as the VT100, that allowed full-screen editing with vi saved a lot of paper and allowed for editing text in-place. Graphical user interfaces and mouse input devices did not exist when vi was created, and not all terminals had arrow keys or page up and page down keys for easy navigation. One good thing about vi is that it is available on almost every Unix version and variant due to historical reasons.
cowcow
I've to agree the plain VI sux..however, VIM is different, it has far more features than pico/nano/joe. The default vi that came with Z is elvis, a lighter variant of plain vi. I've administered SUN/Linux boxes and programmed alot, VIM is really powerful if you know how to use it, in environment where a GUI editor is not available, that's the most powerful editor (emac is another, actually wink.gif
sriley
You'll find vi (or a variant of it) on just about every *nix box in the world. Basic competence can be a real help when you end up on one of them. Keeps you from having to just stare dumbly at a shell prompt.
Anonymous
It took me about a week to start using VIM and being to love it... Something I've noticed that may be of help is that a lot of times the default installation will not have a sane .vimrc file in your home directory. Usually there's one kept in /usr/share/vim/vimXX/vimrc_example.vim that you can just copy to ~/.vimrc, and I gaurentee it's a lot more usable.... things like being able to use arrow keys in insert mode, an indication of what mode you're in in the lower-left corner, syntax highlighting, indentation, etc.
ScottYelich
vi has a small foot print and is ubiquitous ... due to its age, it also has some history.
Sure, you can get small emacs (ue), and others... but vi has history and is ubiquitous.

I don't like it, but I can usually change an IP or so with it. I'd certainly rather have vi
than ed, etc.

Scott
ps: emacs on the Z is painful... but I'm glad to have it.
raybert
A little vi history: Bill Joy (formerly of Sun) is largely credited for writing the initial versions of vi while at Berkley. Here's an interesting interview with him from 1984 where he discusses the origins of vi and, for those with the stamina to read the whole thing, a few more interesting insights from the land of 1984:

    http://www.cs.pdx.edu/~kirkenda/joy84.html

For my part, I resisted learning vi for a long time. There is an enhanced version of vi (somewhat like vim) called vile and for the longest time I could be heard saying that "vile" was in fact the BEST name for vi. wink.gif

The long and the short of it is ubiquitousness. If you work only on GUIs, you have no need for any version of vi. If you work on terminal-based unix systems, vi is a must. It's the only editor that you can be virtually certain will be available on any system you visit. So if you're in that business, you will eventually be forced to succumb to vi. You have been warned... wink.gif

~ray
datajerk
vi rocks for the following reasons:

1. Ubiquitous. All UNIX and Linux platforms have it.
2. Can be small and self contained. (unlike emacs).
3. Optimal for reduced key keyboards. vi only needs ctrl, shift, and esc keys. Years ago arrows did nothing. This is a big plus for me. I never have to have my hands stray to another part of the keyboard or grab the mouse (or worse--the stylus). F1-F12, don't need them.
4. Robust pattern matching.
5. vi has a great GUI called xterm. You should try it.

vi is not a word processor, just a simple text editor.

If you work with UNIX/Linux you cannot avoid it. Someday you will be in an environment out of your control with vi as the only editor available.
Anonymous
I guess what most of you vi & vim bashers is missing is that vi is a _text editor_ and not a word processor. It allows you to quickly cut, copy and paste text (for instance) all without a mouse or having to use the arrow keys in place of the mouse. For example, if I have the sentence:

The quick brown fox jumps over the lazy dog.

with the cursor over the capital "T", I can:

delete the whole line in two keystrokes: dd (delete twice)
copy the whole line with one keystroke: Y (yank the whole line)
copy the word "The" with three keystrokes: y3l (yank three characters to the right)
copy the sentence to the first 'j' in three keystrokes: ytj (yank 'til j)
move the cursor to the end of the line in one keystroke: $
begin to append text to the end of the line in one keystroke: A
move this line after the line below it in three keystrokes: ddp (delete line and paste)
undo the delete & paste in two keystrokes: uu (undo twice)
make the "T" lowercase in one keystroke: ~ (change case)
Change the word "The" to "Any" in six keystrokes: cwAny<esc> (change the word to "A", escape)

Anyone can learn these keystrokes, because they are all based on mnemonics (like "d" for delete) with some experience and patience. Does everyone need to do this sort of thing? No. Who _does_ need to do this kind of thing? Mostly people who work with tons of text files: programmers, system admins and the like.

Do word processors allow you to do the same sorts of things? Of course, but not as efficiently because mostly they use selection rectangles, etc. with a mouse or arrow keys. So, yes, pico can let you do some of this stuff, but not with as much economy of keystrokes.

_That's_ why people like vi: fewer keypresses (which is painfully obvious when you're telnetted into a slow machine over a slow network connection).
padishah_emperor
I've used vi for so long I can't remember. But it's easy to use compared to the others I had to use in the ye olde days of computing. I only know a few commands but that does me fine..

dd Delete line
A Append
:w Write file
:q Quit

That's all I'll ever need for quick editing of /etc/fstab or /etc/hosts etc...

But my favorite editor is mc (Midnight Commander) which does a good job at editing, esp in Xterm under X on my Z ;-)

As datajerk says, it's common across all UNIX families so therefore is good.
Anonymous
how do you wrap up a long line into a little nice paragraph in vi on z? on my other linux box, i would do :%!fmt
pmf
QUOTE
how do you wrap up a long line into a little nice paragraph in vi on z? on my other linux box, i would do :%!fmt


gqq - format current line

Or mark several lines with v and then do gq
clivel
I used to think that Vi was the best thing since sliced bread, I had been working on CP/M systems (remember it) using a line editor. When I first moved to Unix, I discovered Vi, and I fell in love.
A few years later, a change of job, and I found myself working on DOS systems. I managed to convince my boss to buy me a Vi clone for DOS, the damn thing was so unreliable, it kept on crashing and I was loosing work. My boss insisted that I switch to his favourite editor, "Brief" from "Underware Solutions", initially I resisted, but after a little bit of perseverance, I soon realised that Brief was and is still one of the best text editors ever developed. Even though I was a pretty accomplished Vi user, having used it all day every day for a few years, I was amazed it just how much slicker Brief was. Eventually Borland bought Brief, and let it die. I have never used a Borland produce since in protest (not that I think that Borland has noticed).
Roll forward a few years, Windows everywhere, high resolution screens, Brief in an 80x24 Dos box was getting a bit antiquated. Another job, and my Manager provided me with Codewright for windows. It does the job, and I have continued to use it over the years. but somehow it has never seemed to really inspire me.
Then I discovered Linux, looking for a text editor, I thought it would be great to return to my first love, Vi. Browsing the web, it appeared that VIM was one of the best implementations, and best of all, I could use it on both Windows and Linux. After a month of struggling I eventually gave up. Vi was great in it's time, but the world has passed it by. It is powerful, reliable, but a pig to use. I believe that everyone working on Unix/Linux should know a few Vi commands, it is on every system, and often the only way to get at the config files.
However, I can only assume that the current diehard Vi users have not looked at any alternatives other than perhaps Emacs.
Regards,
Clive
panyo
How do you set the delete key to work instead of sending ^? in vi on the SL5500? And while I am asking, I am not aware of emacs on the SL5500 with OZ. Microemacs is available, however. But how do I go to the menues? How do I get to the menues on ordinary emacs in non GUI mode for that matter?
Anonymous
QUOTE
I used to think that Vi was the best thing since sliced bread,

It still is. And Vim is even better.

QUOTE
Roll forward a few years, Windows everywhere, high resolution screens, Brief in an 80x24 Dos box was getting a bit antiquated.


I'm typing this in an 80x50 GVim window (invoked from a ZUG forum posting form text area in Mozilla/FireFox with Mozex) on a 1280x1024 X "desktop". It doesn't seem antiquated to me in the least.

QUOTE
Then I discovered Linux, looking for a text editor, I thought it would be great to return to my first love, Vi. Browsing the web, it appeared that VIM was one of the best implementations, and best of all, I could use it on both Windows and Linux. After a month of struggling I eventually gave up.


You chose to give up.

QUOTE
Vi was great in it's time, but the world has passed it by. It is powerful, reliable, but a pig to use.


Please reread some of the other posts in this thread which eloquently describe the power of Vi/Vim. Although you may not find Vi/Vim to be useful, many of us do.

QUOTE
However, I can only assume that the current diehard Vi users have not looked at any alternatives other than perhaps Emacs.


In my opinion no editor comes close to Vim. I don't want to use anything else. And, yes, I have tried other editors...
Anonymous
To each their own.
I've gone through a lot of editors and eventually settled on emacs, which I've been using for years
(xemacs believe it or not - you can get round the speed issues with gnuclient). Then I wanted a
good editor for the zaurus but didn't like the emacs clones that are out there. I gave vim a serious try
for the first time (I've fallen off that learning curve many times in the past) and now I'm using vim
everywhere. The more I learn to use it the nicer I find it.
My advice would be to try out what out there and settle with whatever grabs you. Vim has a steep learning curve to get to where it's efficient and this may not be worth it if you don't do much editing.
Tehas
Just today, a friend sent me a link to this... vi for Windows.

http://www.winvi.de/en/
nevarrie
QUOTE
However, I can only assume that the current diehard Vi users have not looked at any alternatives other than perhaps Emacs.


Any recommendtions on other editors to try...I find I am alway willing to try new editors...so far I have always come back to vim but I know there are always new programs out there and old ones that I have never tried before...I would love to see what other recommend as alternives that work as well as Vim...
padishah_emperor
Vi vs. Emacs?
Flame Wars: Episode IV?

Personally, I become ill at the thought of Emacs, I know it's supposed to be good, but I could never get to grips with it. I've never looked at many other alternatives, I just can't be bothered to learn new editors when I know enough vi to get on with. Vi rules ;-) so does mc's editor..
lucho
The biggest advantage of vi is that it is available on _any_ Unix box. I don't see any reason to use or learn vim -- it is highly customizable and very flexible, and that is its biggest disadvantage -- if you sit on computer that doesn't have your configuration you are lost.

I don't use vi as my primary editor (I use jed), but I know it well enough and use it on boxes that I don't login often. Amazingly, my fingers know what editor to type (vi, jed or acme) depending on the box I use smile.gif

As for which editor is best everybody knows it's ed -- ed is the standard editor. wink.gif
raybert
QUOTE
copy the word "The"  with three keystrokes: y3l (yank three characters to the right)


I can do that in two: yw (yank word) wink.gif

QUOTE
Brief was and is still one of the best text editors ever developed.


I must concur with this. Brief was awesome! The best thing about it is that it was totally programmable using a special compiled macro language. Most of the basic editor functionality was implemented in the same macro language and you could change it all you wanted. You could also implement major new features with ease. The only problem with this, of course, is that you were lost on someone else's machine. Oh well.

QUOTE
How do you set the delete key to work instead of sending ^? in vi on the SL5500?


It's probably easier to just use vi's delete key: x

~ray
bluey
QUOTE
(...)it was the only game in town(...)


This is why I learned to use VI, because situations like that can happen, and then I got myself just using it for everyday file editing tasks.

Each one uses what fits best to ones needs, you can use an electric screwdriver, it is better, but sometimes there's only a normal screwdriver...
datajerk
Another reason to learn vi is that you can use it to edit shell commands. I use this all the time:

bash/ksh:

set -o vi

Hit ESC

Now you are in vi mode, you and J/K through commands (sorry no arrows anymore), / to search for previous commands, you can insert, delete chars, jump by word or EOL. Very nice.

To get it back to arrorws type:

set -o emacs

You can use the arrows again and emacs commands as well.
bluedevils
agreed. VI is the basic editor for unix/linux. Once you are competent with it, you will no longer have to worry about what system you are on or whether it has nano or pico on it. You just go in and edit. When a unix system is down to init 1, it won't matter what unix machine you're on.

QUOTE
You'll find vi (or a variant of it) on just about every *nix box in the world.  Basic competence can be a real help when you end up on one of them.  Keeps you from having to just stare dumbly at a shell prompt.
bredroll
i would say folks, (speaking from non-pda vi use) if you know how to use it, then vi can be the best editor ever.

it has scripting and excellent syntax highlighting.

the reason it is on every unix system is because it is so so small, compared to emacs vi is absolutely tiny,

if you are a unix user, even if u prefer emacs, its always good to know vi well as sometimes you will have such a broken system to fix that the only thing that will still work is vi.

vim is alot easier than vi, (vim can emulate vi awell)

vim is simply vi with some more clever stuff that you will never see (often) built in.

seriously, (on a non-pda) once you get the hang of the commands, its great.

[insert] - switches you between insert and replace mode
[esc] - puts you in command mode
[esc] v - puts you in visual mode (for copy and paste etc)
[shift]aa - move between windows

- command mode -
:q # quit
:q! # quit without save
:w # save
:wq # save and quit
:u # undo
:split file.txt # open another file in a vertical split window
:read file.txt # read in file.txt at the current location

:-)
lucho
Sometimes the system is so broken that even vi doesn't work. That's why in addition to vi , I also know ed -- it always works. And, of course, it is much more obfuscated than vi smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.