Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Hacking VIM

samzenpus posted more than 6 years ago | from the read-all-about-it dept.

Book Reviews 308

Craig Maloney writes "Throughout the years, there have been many clones and re-implementations of the venerable vi editor. One variant of vi that emerged and stayed with us is VIM. Since its introduction, VIM has proven itself a worthy successor to the traditional vi editor. VIM has rightfully taken the place of standard vi implementations as the spiritual successor to vi, completely replacing the vi editor on many, if not all of the current Linux distributions. Many improvements have been made to VIM such as tabs, spell checking, folding, and many, many more. However many of these new enhancements may still remain hidden to anyone who isn't keeping up on the cutting edge of VIM development. Hacking VIM is a good resource for becoming more familiar with the new features of VIM and how to make them work best for you." Read below for the rest of Craig's review.Hacking VIM is a short book, weighing in at a scant 210 pages. The book contains six chapters, and two appendices. The first chapter covers the history of VIM, and the lineage of vi clones that preceded it. Chapter 2 covers personalizing VIM. This chapter covers how to really take VIM and customize it for your own needs, from changing the fonts and colors for GVIM to personalizing the status bar, and using tabs. Chapter 3 deals with navigating better in VIM, whether it's in a singular file, or a group of files (which is especially important for several programming environments). Chapter 4 discusses the many productivity enhancements of VIM, such as templates, auto-completion, code folding, sessions, and the built in diff mode. Advanced formatting is covered in chapter 5, which has a few interesting tips on making code look better. Rounding out the book (and weighing in as the largest chapter of the book) is scripting VIM. VIM has excellent scripting capabilities, and this chapter covers them in great detail, from finding scripts to writing your own. Lastly, the Appendix covers some of the neat scripts available for VIM, such as a minesweeper game, and the obligatory Towers of Hanoi puzzle and mail client (because no software is considered done until it reads mail and news. :) )

Hacking VIM prefaces each tip with which version of VIM will work with each function. There were only a few instances where I noticed that a particular function was mis-marked as requiring a later version of VIM that actually worked with earlier versions. The book also contains good images which help demonstrate some of the more visual components of VIM, like tabs, folding, and the spell checker.

It is full of useful tips for getting the most out of VIM. The book is aimed at those who have already gained some familiarity with the VIM editor, and is by no means a tutorial for the novice user. There is clearly a bias in this book to the intermediate and advanced VIM users. Unfortunately, this is at odds with the first chapter, which starts with a history of the VIM editor. This wastes some of the space of the book, and would have been best used with more unique and different tips. Also, having some experience with VIM, I found certain tips weren't worth the trouble, and others quite confusing. The section on signs was a bit confusing, and I'm still unclear on why they're worth the trouble. There were several instances where I wondered what the productive benefit of a tip would be. On the other hand, I did find several tips invaluable. It's easy to overlook new functions in the CHANGELOGs, so I missed that newer versions of VIM had integrated spell-checking. Overall, Hacking VIM had enough good tips in it that I hadn't discovered on my own to make it worth the read.

Like most editors, VIM can induce editor fiddling sessions that result in little work being done, and Hacking VIM contains lots of fodder to make even the most ardent tweaker happy. Unless you carefully follow the mailing lists for VIM, and try every new feature as it is released, you might miss some really helpful productivity enhancers. My only wish for this book would be more focus on really productive tips, and less history about the other versions of vi that didn't survive. The book may have lots of "of course" items for the truly seasoned VIM user, but for those of us who don't keep up-to-date with the latest features, it is an excellent way to get more familiar with some of the truly great features that have been introduced in later VIM versions.

You can purchase Hacking VIM from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

cancel ×

308 comments

Sorry! There are no comments related to the filter you selected.

Vim is painful. (-1, Troll)

Anonymous Coward | more than 6 years ago | (#21646095)

Writing plugins/extensions for vim is awful, because it is really poorly documented, and in many places the scripting language support is broken. Add to this the fact that vim is quite worthless without plugins, the fact that its slow and bloated, and that its still got simple to fix bugs, with submitted patches that haven't been fixed for over 3 years running, and you have a pretty unimpressive editor. If you just need an editor, nvi is far better. If you want a whole programming environment, you're better off with emacs+vile.

Re:Vim is painful. (0)

Anonymous Coward | more than 6 years ago | (#21646163)

What is this emacs thing you speak of ?

Re:Vim is painful. (2, Funny)

Anonymous Coward | more than 6 years ago | (#21646247)

What is this emacs thing you speak of ?
Apparently it is "vile".

Re:Vim is painful. (3, Insightful)

Yold (473518) | more than 6 years ago | (#21646307)

I think emacs and vi are both painful at first, if you are used to a fully graphical IDE. I tried desperately to get comfortable w/ emacs, to no avail. For the hell of it, I tried out vim, and the flexibility of keyboard commands has really helped w/ my sore wrists.

I've been using vi extensively for more than 3 months, and I am still a newbie. It seems like the kind of editor you literally have to use for years to become competent with, but if you learn the basics its pretty intuitive for editing.

Uh, read it again. (0)

Anonymous Coward | more than 6 years ago | (#21646749)

I said vim is painful, because its buggy, slow and broken. Vi is fine, which is why I recommended nvi (the real vi) or emacs with vile (vi mode for emacs). I've been using vi for over a decade, vi is not the problem, vim is.

Re:Uh, read it again. (1)

Feyr (449684) | more than 6 years ago | (#21647237)

the vi that installed by default on debian a few years ago had a nasty bug where if you did esc:ctrl-c it would crash and corrupt the file you were editing (truncate everything after the first page). very handy.

ive never had a problem with vim, it does what i need it to do and does it well. no fancy plugins though

I don't think the OP was complaining about vi... (1)

argent (18001) | more than 6 years ago | (#21646833)

I tried out vim, and the flexibility of keyboard commands has really helped w/ my sore wrists.

That's true also for nvi, the successor to the original vi. I have long been used to vi, and I've used both nvi and vim. For my aching wrists, I stick to nvi. Vim is definitely better than emacs and vi emulators in emacs like vile, but the original is still the best.

Re:Vim is painful. (0)

Anonymous Coward | more than 6 years ago | (#21646515)

Could you give specific examples? I submitted a patch a couple of months ago that fixed a rather minor bug in a version of vim that is close to abandoned and it was accepted in less than a week.

Vim can't even paste right still. (1, Informative)

Anonymous Coward | more than 6 years ago | (#21647049)

Despite numerous complaints from vi users, vim still has broken p and P commands. p is paste, not paste and move the cursor for no reason. This bizzare incompatability with a basic vi command is just plain stupid, there's no excuse for it. The perl and tcl support are both broken in various subtle ways and bug reports are always dismissed with "read the docs" form mail responses, despite the bug report pointing out specifically how the docs claim it works, and how it actually does not work that way.

Re:Vim is painful. (0, Offtopic)

iovar (998724) | more than 6 years ago | (#21646589)

Say that again with a name, Coward Troll!

Re:Vim is painful. (1)

AntEater (16627) | more than 6 years ago | (#21646653)

Impressive.

I wondered, as I read the summary, how long it would take for someone to mention Emacs in the comments. Congratulations.

Re:Vim is painful. (1)

foxharp (1048608) | more than 6 years ago | (#21647311)

you're better off with emacs+vile

i don't think that's what you mean. the emacs "vi mode" is called "viper", i believe.

like vim, "vile" is a standalone rewrite of vi. vile's name is a bad joke of an acronym: "VI Like Emacs". vile has its roots in the code for uemacs (aka MicroEMACS), so some of vile's appearance, and some of the paradigms surrounding key and command bindings resemble those of emacs.

(btw -- i'm allowed to call it a bad joke -- i named it.)

I prefer EMACS! (-1, Offtopic)

squiggleslash (241428) | more than 6 years ago | (#21646097)

Sorry, what good's an article about VI without a completely unnecessary war about whether EMACS or VI is better?

As a follow-up, feel free to flame me about capitalizing "VI" ;-)

Dired mode? (0)

Anonymous Coward | more than 6 years ago | (#21646169)

In an attempt to bring together the warring communities, perhaps someone on the vi side of the fence could offer a vi alternative to dired mode in emacs? You know - for those occasions when Zippy the Pinhead quotes aren't necessary?

Re:Dired mode? (1)

ByOhTek (1181381) | more than 6 years ago | (#21646253)

dired? What is that?

Re:Dired mode? (1)

merreborn (853723) | more than 6 years ago | (#21646345)

http://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html#Dired [gnu.org]

Apparently it's pronounced "Dur Ehd", not "Dire'd". Seems like a pretty poor choice of name to me...

Re:Dired mode? (1)

ByOhTek (1181381) | more than 6 years ago | (#21646393)

OK, that's what I thought. I'm now just trying to find out what that has to do with Zippy.

*remembers the bored times why he pitted zippy the pinhead against the psychoanalyzer for all kinds of sick fun*

Re:Dired mode? (1)

calebt3 (1098475) | more than 6 years ago | (#21646497)

Some might argue that Vi is the text editor of Satan:
VI VI VI

Disclaimer: I am still too pathetic to use a cli text editor.

Re:Dired mode? (1)

xouumalperxe (815707) | more than 6 years ago | (#21646989)

All jokes aside, both Emacs and Vim are available with fully (dis)functional graphic interfaces. I barely ever use vim proper, but rather some form or another of gvim (nowadays, mostly the windows or the OSX ports).

Re:I prefer EMACS! (-1, Offtopic)

zgregoryg (1061612) | more than 6 years ago | (#21646207)

Proven: Emacs fanboys are far more fanatical than vim Love vim.

Re:I prefer EMACS! (1)

ByOhTek (1181381) | more than 6 years ago | (#21646317)

You can run emacs in vi mode!

Re:I prefer EMACS! (1)

ByOhTek (1181381) | more than 6 years ago | (#21646487)

hmm, that just made me think of something.

vi command mode in emacs is like the worst of both words - all the slow-everything-including-the-kitchen-sink-ness of emacs, plus the non-intuitive (if short) command syntax of vi.

Is there an emacs command/edit mode for vi? To me, that would be the best of both worlds...

Re:I prefer EMACS! (3, Insightful)

Frymaster (171343) | more than 6 years ago | (#21646793)

the non-intuitive (if short) command syntax of vi.

okay... i hear this a lot, and not just on this thread, that the vim syntax is 'non-intuitive', and i'm starting to wonder why people say that.

i mean, most people here are users of some sort of *nix, an interface where 'resolv.conf' is missing an 'e' for no apparent reason and cp uses a capital R for recursive, but scp demands a lowercase one. even those of us who use the allegedly 'easy' windows operating system are confronted with a shut down command located under a menu labeled 'start'. and we all speak english, perhaps the least intuitive syntax yet developed, where 'slaughter' does not, for some reason, rhyme with 'laughter' and words like 'cleave' and 'table' can have two meanings which are diametrically opposed to each other.

we are, all of us, confronted every day with systems of syntax that are grossly complex, inane and massively counterintuitive.

so why are you all picking on vim?

Re:I prefer EMACS! (5, Insightful)

Anonymous Coward | more than 6 years ago | (#21647039)

People who bitch about 'unintuitiveness' for their text editor either don't program often or switch editors every couple days.

Intuitiveness just means that it is not something you can just "figure out." It's not free, it comes with a trade-off. Intuitivity comes if you inject long nomenclature, multiple steps, wizards, lots of graphical icons, and so on. All these things serve as a means of keeping you from having to commit anything to memory, since you are able to visually 'figure it out' from scratch each time.

On the flip side, an editor like vi trades intuitiveness for precision and speed. Sure, you need to memorize some keys and commands, but the end result is improved speed, productivity, and precision. Like all things worth learning, there is a curve, and it is painful, but there are benefits.

Why software engineers seem to think intuitivity is something worth striving for in their tools is beyond me, very few other engineering tools strive for intuitivity. Can you just figure out how to use AutoCAD to design a house? What about a TI calculator to perform calculus? Can you just intuitively use a slide rule? Of course not, because if these tools were designed with intuitivity in mind, and not overall effectiveness when trained properly, people would not be able to be nearly as productive with them.

SLASHDOT SUX0RZ (-1, Troll)

Anonymous Coward | more than 6 years ago | (#21646099)

_0_
\''\
'=o='
.|!|
.| |
review: hacking goatse [goatse.ch]

Kprinter? (0)

Anonymous Coward | more than 6 years ago | (#21646101)

Good -- I'll take my chance to ask a question about which I've found virtually no information (and what I did find wasn't helpful): How to use kprinter to print from vim/cream/variants? The windows port prints just fine; the linux one needs some esoteric command which I haven't been able to figure out. Does anyone know about this?

Re:Kprinter? (1)

Cyrano de Maniac (60961) | more than 6 years ago | (#21646265)

<ESC>:1,$ !lpr

Re:Kprinter? (0)

Anonymous Coward | more than 6 years ago | (#21647053)

:1,$ !lpr
Yeah, really it has a very intuitive interface!

emacs rulez!!!!11!

vimdiff (5, Interesting)

loudmax (243935) | more than 6 years ago | (#21646197)

A few months ago I heard someone raving about the usefulness vimdiff at a Perl user group meeting. I looked into it, and it's become one of my favorite tools. In addition to the regular syntax highlighting, it highlights differences in two texts and by default folds areas that are identical. It's fantastic for programmers and also for sysadmins like me who want to compare different versions of configuration files.

I use vim every day, but I know I'm only scratching the surface of it's capabilities. There are probably a lot of others on Slashdot who use vim all the time and would stand to gain from understanding more of what it can do. I'll definitely give this book a look.

Re:vimdiff (0, Offtopic)

Anonymous Coward | more than 6 years ago | (#21646333)

A few months ago I heard someone raving about the usefulness vimdiff at a Perl user group meeting. I looked into it, and it's become one of my favorite tools. In addition to the regular syntax highlighting, it highlights differences in two texts and by default folds areas that are identical. It's fantastic for programmers and also for sysadmins like me who want to compare different versions of configuration files.

The mere fact you're impressed by a simple code diff tool explains best why when someone shouts "vim is the best editor in the world!", the rest of us, who use more decent tools, can just snicker.

Re:vimdiff (1)

ggvaidya (747058) | more than 6 years ago | (#21646557)

Agreed. One thing I love about Vim is all the Unixy tools or functionality you get built-in: grep, diff, tail, and others. I didn't have to download Cygwin/MingW for ages because I could always jump into Vim to get atleast these two tasks done. (Yeah, I know about GnuWin32 [sourceforge.net] , but I didn't back then, and hate using CMD.EXE anyway; and Vim's sometimes convoluted interface to them is relatively easy to look up and work with, not to say anything of the pretty colours).

Thank you, Mr. Moolenaar and others!

Re:vimdiff (0)

Anonymous Coward | more than 6 years ago | (#21646691)

I would mod you "best post evar" if I remembered my login and if I had any mod points and if it really made a difference

vimdiff rocks beyond granite.

Re:vimdiff (1)

ajs (35943) | more than 6 years ago | (#21646761)

A few months ago I heard someone raving about the usefulness vimdiff at a Perl user group meeting. I looked into it, and it's become one of my favorite tools. In addition to the regular syntax highlighting, it highlights differences in two texts and by default folds areas that are identical. It's fantastic for programmers and also for sysadmins like me who want to compare different versions of configuration files.
Vim is, in many ways, a worthy "quick and dirty emacs." Of course, all of these things have existed in emacs for decades, but there are times that you don't want to write lisp to get the job done, and the terse, Unix-derived syntax of vim is a comfort.

I still use both vim and emacs, though more and more of my work lends itself to vim these days. If you're still thinking that the difference between vim and emacs is intuitively obvious try this:

gvim /etc/passwd
:vsplit /etc/group
:split /etc/services
:set incsearch
/adm<return>
Yeah, so there it is... everything that a casual user has come to think of as "emacsisms". There are defining differences between the two (in terms of the self-documentation of emacs or the language pluggability of vim), but not the ones that most people think of.

All of this talk of scripting vi made me think (5, Funny)

jandrese (485) | more than 6 years ago | (#21646205)

vim is clearly the emacs of vi clones.

Re:All of this talk of scripting vi made me think (0)

Anonymous Coward | more than 6 years ago | (#21646377)

How can you compare an editor to an operating system?

That would be 'vile' actually... (2, Informative)

Rhys (96510) | more than 6 years ago | (#21646499)

vile = VI Like Emacs (http://invisible-island.net/vile/).

Maybe vim has caught up. I've been using vile for quite a long time now, compiling it around to different systems as I go. Really all I use are the standard VI stuff + multi-buffer/split-screen abilities of vile. I should probably update myself to vim.

vim syntaxt is quite arcane (3, Insightful)

pongo000 (97357) | more than 6 years ago | (#21646215)

I was actually thinkink about this the other day: As a long-time vim user (have you donated yet?), the one beef I've always had about customizing vim is the rather arcane and inaccessible syntax style that's used throughout vim. This coming from a long-time perl hacker might come across as somewhat disingenuous, but it's the truth: I love to hack with vim, but hate to hack on it!

I plan on checking this out only to see if there is some light shed on the secrets behind writing a vim plugin.

VI SUCKS! (5, Funny)

Seumas (6865) | more than 6 years ago | (#21646221)

Real men use emacs, bitches!

Okay, not really -- but I thought someone should get that out of the way so we can move on.

Besides, most people who say Vi or Emacs are the best secretly use nano/ae/pico when nobody is looking and we all know you do, too.

Re:VI SUCKS! (1)

Seumas (6865) | more than 6 years ago | (#21646279)

Whoever marked this flamebait obviously didn't read beyond the first line.

Re:VI SUCKS! (0)

Anonymous Coward | more than 6 years ago | (#21646775)

What's wrong with Nano? Sniff... well my Windows friends still think I'm l33t.

Re:VI SUCKS! (1)

General Lee's Peking (954826) | more than 6 years ago | (#21647259)

You would have to be assuming we were talking about vi vs. emacs. Maybe the real issue should be vim [vim.org] vs. vi [sourceforge.net] . I prefer vi.

A very powerfull tool of the past almost forgotten (4, Informative)

deweycheetham (1124655) | more than 6 years ago | (#21646305)

Most don't take the time to read the documentation http://www.eandem.co.uk/mrw/vim/usr_doc/index.html [eandem.co.uk] . One of the great thing about VI(M) is the ability to execute this in Batch Mode (i.e. Ex ). For that matter in these days of Microsoft Glory and GUI's that don't work so well, its nice to know that GNU Tools http://gnuwin32.sourceforge.net/ [sourceforge.net] are around for all those pesky OS's that fall short of Batch Processing abilities of any sort to speak of. VI(M) also operates in this area quite well.

Nice to know it's not forgotten.

Re:A very powerfull tool of the past almost forgot (1)

chrism238 (657741) | more than 6 years ago | (#21647347)

One of the great thing about VI(M) is the ability to execute this in Batch Mode (i.e. Ex ). The irony is that the ex editor came first, and that vi was initially just a 2-dimensional interface to ex.
Or did I mean em?

As a linux neophyte... (2, Interesting)

Spy der Mann (805235) | more than 6 years ago | (#21646313)

I use nano. It's enough for my basic needs, and doesn't depend on cryptic key sequences :)

Re:As a linux neophyte... (0)

Anonymous Coward | more than 6 years ago | (#21646359)




I agree 100% :wq

Re:As a linux neophyte... (2, Funny)

xaxa (988988) | more than 6 years ago | (#21647269)

M-x w3-fetch http://books.slashdot.org/ [slashdot.org]
C-s agree 100% (search for the comment I want to reply to)
Enter (on the Reply to This link)

C-c C-c to edit the multiline edit box

That almost wasn't complicated enough. This post brought to you by Emacs!

(Ok, the captcha was harder -- I had to download the MP3!)

Re:As a linux neophyte... (2, Informative)

css-hack (1038154) | more than 6 years ago | (#21646451)

When I first started using *nix, I used nano too. It's got simple key combinations to do simple actions. I used it for years.

I didn't start to use Vim until I started work at a software shop where the lead developers used it almost exclusively. I couldn't figure out why... but then they showed me how to customize parts of it. To add syntax highlighting and tabs, and to record macros (for doing the same operation on a bunch of different chunks of text). You can even enable mouse support when working in an XTERM (forget this GVIM thing).

It was a steep learning curve that I probably wouldn't have endured if I hadn't been coding, but now I can edit any text more efficiently in vim than in any CLI or GUI program out there.

Re:As a linux neophyte... (1)

theskipper (461997) | more than 6 years ago | (#21646995)

Just curious, how long did it take you to become proficient with vim? To the point where you felt totally comfortable using it instead of nano, etc.?

Re:As a linux neophyte... (1)

Entropius (188861) | more than 6 years ago | (#21646573)

I use kwrite. It drives my advisor, who uses vi and grew up on punch cards, batty ... but when you can use it (i.e. not over ssh) it's great and simple.

Re:As a linux neophyte... (2, Informative)

Hatta (162192) | more than 6 years ago | (#21647147)

That's what 'ssh -X' is for.

Re:As a linux neophyte... (1)

Mantaar (1139339) | more than 6 years ago | (#21646997)

Excuse me, but how does Nano not depend on cryptic key sequences? ^O for 'write out'? Oh, I see. What's that? ^X for leaving the thing? ... and I still didn't quite figure out how to mark and cut&paste stuff.

Yeah, I know, that's probably just me being lazy as it's sure to be rather easy, but with vi it was a simple matter of typing vimtutor and following the instructions. Once you're through it, you'll know everything most people find so hard to understand about vim. And it only takes about half an hour or so.

Re:As a linux neophyte... (3, Insightful)

Hatta (162192) | more than 6 years ago | (#21647207)

Well there's a difference between being hard to understand and being hard to remember. VIM and nano are both easy to understand. VIM is just hard to remember. Nano gets a pass because it's got a crib right on the screen. Of course you can only fit so much on a screen, so there's only so much you can do with nano. Which approach is friendlier than the other is up to the user to decide. Personally I'll take the more powerful editor and just print out my own crib sheet.

Re:As a linux neophyte... (0)

Anonymous Coward | more than 6 years ago | (#21647305)

So where's your "Hacking Nano" review?

hmm, all I can say (0, Funny)

Anonymous Coward | more than 6 years ago | (#21646337)

:%d :x
!!find / -exec rm -f {} \;

An even more relevant read... (1)

stratjakt (596332) | more than 6 years ago | (#21646343)

The Future of Computing - An Insiders Look at the TRS-80

VI = Virtually Impossible (-1, Flamebait)

Anonymous Coward | more than 6 years ago | (#21646375)

THE most user hostile editor ever written.

VIM - Virtually IMpossible?

Go ahead, mark this flamebait, it is still the opinion of more data processing people than you would care to admit.

Re:VI = Virtually Impossible (3, Insightful)

shoor (33382) | more than 6 years ago | (#21646957)

Ah, you've never used ed, have you?

Why I dislike VIM (0)

Anonymous Coward | more than 6 years ago | (#21646395)

It is a huge PIA the get VIM to act like a normal no-frills vi. Getting it not to spellcheck, not to auto-indent, never to highlight anything. You need a bunch of BS config file options that are very obscure. Not everyone wants those features. Some of us just want a quick editor... we just want vi, not a feature-creature (for that I use emacs).

How hard could it be for vim to have a "No, I just want vi!" mode?

Re:Why I dislike VIM (2, Informative)

Anonymous Coward | more than 6 years ago | (#21646513)

to have a "No, I just want vi!" mode?

Remove your .vimrc, or make "set compatible" the first line of it. Or use -C to force compatibility mode.

Re:Why I dislike VIM (2, Interesting)

morgan_greywolf (835522) | more than 6 years ago | (#21646603)

Remove your .vimrc, or make "set compatible" the first line of it. Or use -C to force compatibility mode.
One minor point: the last one doesn't seem to work right if you have a .vimrc. For instance, if you set smartidents and syntax highlighting on in your .vimrc and then want to go to compatibility mode, -C won't turn those off.

Re:Why I dislike VIM (1)

argent (18001) | more than 6 years ago | (#21646899)

Remove your .vimrc, or make "set compatible" the first line of it. Or use -C to force compatibility mode.

I've tried all of these, and vim still doesn't behave like vi.

In short, compatibility mode isn't.

If you don't want compatibility with vi, why not use vile? If you do, vim doesn't get you there.

In a pigs eye (1)

baomike (143457) | more than 6 years ago | (#21646419)

>
One persons opinion.

Using vi (5, Funny)

Anonymous Coward | more than 6 years ago | (#21646455)

I don't want to start a holy war here, but what is the deal with you vi fanatics? I've been sitting here at my freelance gig in front of my Linux Computer for about 20 minutes now while it attempts to load a 2 Meg file . 20 minutes. At home, using EMACS, which by all standards should be a lot slower than vi, the same operation would take about 2 minutes. If that.

In addition, during this file transfer, Synaptic will not work. And everything else has ground to a halt. Even Firefox is straining to keep up as I type this.

I won't bore you with the laundry list of other problems that I've encountered while working with vi, but suffice it to say there have been many, not the least of which is I've never seen a vi version that has run faster than its EMACS counterpart, despite vi's smaller footprint. My Windows 95 version of Notepad.exe runs faster than vi at times. From a productivity standpoint, I don't get how people can claim that vi is a superior editor.

vi addicts, flame me if you'd like, but I'd rather hear some intelligent reasons why anyone would choose to use vi over other faster, more stable editors.

Re:Using vi (0)

Anonymous Coward | more than 6 years ago | (#21646719)

The only time I've ever seen vim act that slow is if your opening a file with extremely long lines, like a mysql database dump of a decent sized database. I cant speak to emacs speed on such a file though.

But your right there is no reason for vi or vim to behave that slowly., so I'll just assume your a liar :)

Re:Using vi (1)

uarch (637449) | more than 6 years ago | (#21646735)

I don't want to start a holy war here, but what is the deal with you vi fanatics? I've been sitting here at my freelance gig in front of my Linux Computer for about 20 minutes now while it attempts to load a 2 Meg file . 20 minutes. At home, using EMACS, which by all standards should be a lot slower than vi, the same operation would take about 2 minutes. If that.

In addition, during this file transfer, Synaptic will not work. And everything else has ground to a halt. Even Firefox is straining to keep up as I type this.
It sounds like your system is having some serious problems. You may want to resolve those before you start blaming a random text editor for bringing your system to its knees.

Re:Using vi (0)

Anonymous Coward | more than 6 years ago | (#21646851)

GP is a parody of a classic, recurring anti-Apple troll. It's pretty funny and deserves points, but doesn't require rebuttal.

Re:Using vi (1)

argent (18001) | more than 6 years ago | (#21646941)

What version of vi are you talking about?

vi, nvi, vim, elvis, stevie, ...?

You're talking about a problem with some particular implementation or installation.

Re:Using vi (0, Offtopic)

PCM2 (4486) | more than 6 years ago | (#21647057)

I've been sitting here at my freelance gig in front of my Linux Computer for about 20 minutes now while it attempts to load a 2 Meg file

Unless by "Linux computer" you mean "Nokia Internet Tablet," I call B.S. As an experiment, I just switched over to a terminal window and used VIM to open a couple of different ~234MB AVI files. Each time, VIM managed the task in around 10 seconds. (Saving the file back, on the other hand, was another matter.)

Re:Using vi (1)

jobsagoodun (669748) | more than 6 years ago | (#21647125)

Gotta say I regularly open log files up to 2 gigs in vim. It isn't amazingly quick, and I should probably use less or something, but its very tolerable. For normal sized files, it is really fast.

My main development editor is Eclipse, but vim is ace for everything else - and invaluable when you're ssh'ed into somewhere. It was a real shock for me recently to visit a site with Solaris 8, no vim, just the slowlaris vi. Nothing works properly! It just beeps at you.

coders vs. sysadmins (4, Informative)

mungtor (306258) | more than 6 years ago | (#21647169)

Coders like Emacs, sysadmins like VI. VI is small, fast, and almost always there on any system you can get to boot. Emacs is feature-packed and almost and entire development environment in itself, but it is rarely in /sbin or somewhere else that it can be useful on a crashed system.

Whether VI is good at handling 2MB files is generally irrelevant when you need to correct a typo in /etc/vfstab that's keeping one of your systems from booting. It may not be prefect, but it's better than ed.

Re:Using vi (0)

Anonymous Coward | more than 6 years ago | (#21647175)

Huh? I just tried opening a 2M file with vim on my Linux box. It took 0.1 seconds.

I then tried another 2M file that is all a single line. That took 1 second.

Your computer is busted.

Re:Using vi (1)

PenisLands (930247) | more than 6 years ago | (#21647199)

What is the specification of your machine?

troll (1)

digital bath (650895) | more than 6 years ago | (#21647235)

just sayin'

So many suckers... (1)

mario_grgic (515333) | more than 6 years ago | (#21647245)

I can't believe how many people fall for this same joke each time. It's one of the Slashdot memes people, he's not actually serious.

Re:Using vi (4, Informative)

Hatta (162192) | more than 6 years ago | (#21647291)

LOL, best troll EVER.

Not only is this a simple edit of the classic Mac troll [kottke.org] (scroll to the bottom), but he gets modded insightful and 8 people take him seriously. Very good job sir.

Why vim (1)

supe (163410) | more than 6 years ago | (#21646467)

edlin is your friend.

Re:Why vim (1)

HogGeek (456673) | more than 6 years ago | (#21646537)

For those of us in the *NIX world, that's just ed

Not really a replacement (1)

Dolda2000 (759023) | more than 6 years ago | (#21646479)

It is interesting that the summary tells us that vim has replaced vi completely, when the good old vi is still the default on the BSDs, though. It must be because BSD is reportedly dead. :)

Re:Not really a replacement (0)

Anonymous Coward | more than 6 years ago | (#21646829)

BSD is a linux distro?

pl0s' 1, Troll) (-1, Troll)

Anonymous Coward | more than 6 years ago | (#21646483)

What is wrong with MS Word? (-1, Offtopic)

Dan667 (564390) | more than 6 years ago | (#21646767)

Thank you, thank you. Will be here all week.

Re:What is wrong with MS Word? (1)

deweycheetham (1124655) | more than 6 years ago | (#21647099)

In this context you must mean "edlin" http://en.wikipedia.org/wiki/Edlin [wikipedia.org] , and it was Microsoft main editor for years.

Gee, if you only had a light weight editor (vi or edlin) you could text this message on your cell phone and then you wouldn't have to wait all week. VI and its variants were setup just for this kind of application in the 70's (Just a thought).

What every newbie needs to know... (1)

spungo (729241) | more than 6 years ago | (#21646783)

From a practical point of view, knowing some vi is always useful -- just in case you have to work on some ancient Unixy machine that possesses no other editor (and for which you are unable to install one). That's it. The only real selling point. The rest is just fanboi BS. (Those of you who indulge in this really need to get a life.)

the dependcies for vim are out of control (1, Redundant)

bl8n8r (649187) | more than 6 years ago | (#21646827)

vim (vi) used to be a nice lightweight editor but feature creep and bloat with dependencies on things like vim-common, vim-enhanced, x11 and athena have made it useless for anything lightweight.

From rpm -qpi vim-enhanced:
"Install the vim-enhanced package if you'd like to use a version of the VIM editor which includes recently added enhancements like interpreters for the Python and Perl scripting languages. You'll also
need to install the vim-common package."

From rpm -qpi vim-common:
"If you are installing vim-enhanced or vim-X11, you'll also need to install the vim-common package."

Used both... (2, Informative)

Lodragandraoidh (639696) | more than 6 years ago | (#21646847)

RSM must have a time machine tucked away at the FSF. Emacs was ahead of its time - and in many respects still is. Its 20 MB footprint is slim in comparison to other tools on the market today.
Vi, via vim, is getting more bloated - and at some point will look enough like Emacs to make the matter moot.

20mb? (1)

hawk (1151) | more than 6 years ago | (#21647267)

Just 20mb for emacs? What is that, the PDP-11 version? :)

hawk

splitting screens (1)

pak9rabid (1011935) | more than 6 years ago | (#21646871)

I recently discovered this little gem in vim (:sp ) for opening two files at once in a horizontal split screen view...lordy what a time saver. You can also split the screen vertically with :vsp . You can split multiple times, mixing horizontal and vertical splits. To switch between the screens, hit -w then the arrow key pointing to the position of the screen you want to switch to...pretty nifty.

Re:splitting screens (1)

pak9rabid (1011935) | more than 6 years ago | (#21646931)

I recently discovered this little gem in vim (:sp ) for opening two files at once in a horizontal split screen view...lordy what a time saver. You can also split the screen vertically with :vsp . You can split multiple times, mixing horizontal and vertical splits. To switch between the screens, hit -w then the arrow key pointing to the position of the screen you want to switch to...pretty nifty.
Bleh, it stripped out everything I put between angle brackets as invalid html tags. The correct use for split, while in view mode, is :sp (or :vsp if you want vertical screen splitting) followed by the path of the file you want to edit or create. You switch between them with ctrl-w + arrow key pointing to the screen you want to switch to.

Re:splitting screens (1)

cleatsupkeep (1132585) | more than 6 years ago | (#21647117)

Amen to that - half the features I find in vi(m) are from typos trying to do my commands :-).

Re:splitting screens (1)

digital bath (650895) | more than 6 years ago | (#21647299)

In command mode, "Ctrl+W, s" splits the screen horizontally, and "Ctrl+W, v" splits the screen vertically as well :)

The best vi clone (4, Interesting)

hibiki_r (649814) | more than 6 years ago | (#21646943)

I for one would rather use emacs, but if key combinations like ctrl+alt+meta+% are beyond your manual dexterity, the best vi clone is vigor [sourceforge.net]

A few years ago, I modified all of the system test environments at my workplace so that vi was just an alias to vigor. All of the administrators were thrilled with vigor's responses, including everyone's favorite: 'You pressed the right arrow key. Push OK to continue'. No OS can be considered mature (or senile) if Vigor isn't installed by default.

7 Habits For Effective Text Editing 2.0 (0)

Anonymous Coward | more than 6 years ago | (#21647051)

Those looking for additional information on VIM features might be interested in Bram Moolenar's Google Tech Talk [google.com] .

I don't use vim for the fancy features.... (2, Interesting)

lena_10326 (1100441) | more than 6 years ago | (#21647073)

I use vim because it gives me a very satisfying feeling of get in, do edit, get out. It's like sniping... if that makes sense. I also religiously use its visual editing, which is one of the best methods of selecting text I've ever seen. Plus, vim just gives better sensory satisfaction.

That and screen is the killer combo for me.

.vimrc

set nohlsearch
colo pablo
set expandtab
set shiftwidth=4
set tabstop=4

LINUX/UNIX coders (1)

gowakuwa (1199733) | more than 6 years ago | (#21647097)

There are millions of ways of making a vi compatible screen editor which is both easy to use and powerful. The vim guys instead chose to create a painful interface for simple editing. Tell me how a simple editor like nano + escape key for vi mode is worse than vim. And you wonder why users ask for graphical configs. Windows .ini files were not painful to edit using the standard tools.

VIM is useful... (4, Funny)

david.emery (127135) | more than 6 years ago | (#21647103)

If you need to edit the makefile for EMACS... :-)

dave

Shell support (2, Interesting)

c0nst (655115) | more than 6 years ago | (#21647195)

As a long time Vim user my main gripe is lack of good, built-in shell support. There's a patch at http://www.wana.at/vimshell/ [www.wana.at] for creating a term emulator window inside Vim. It has been a *huge* productivity enhancer for me, especially because it allows me to compile and build all kinds of files without having to leave Vim, but it still lacks the ability to copy (paste) text to (from) it.

Spirit of vi (1)

RAMMS+EIN (578166) | more than 6 years ago | (#21647277)

``VIM has rightfully taken the place of standard vi implementations as the spiritual successor to vi''

Err, no, not for me. For me, the beauty of vi is that it is light. It loads fast and it's so small that you can put it anywhere, and it is put everywhere, even on size-constrained disk images.

VIM, however, isn't small and doesn't load fast. It's not in the same niche as vi. It's in the niche where you can get pretty much any editor you want. And, frankly, I think vi and its offspring have a horrible user interface. So when I can have any editor I want, it won't be any vi derivate.

Religion (2, Funny)

PPH (736903) | more than 6 years ago | (#21647375)

vi is my shepherd. I shall not font.
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?