Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Hacking VIM

Posted by samzenpus on Monday December 10, @02:32PM
from the read-all-about-it dept.
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
author Kim Schultz
pages 210
publisher Packt Publishing
rating 7/10
reviewer Craig Maloney
ISBN 978-1-847190-93-2
summary A good way to wring more productivity out of an already excellent editor
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.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • vimdiff (Score:5, Interesting)

    by loudmax (243935) on Monday December 10, @02:43PM (#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 by ggvaidya (Score:1) Monday December 10, @03:08PM
    • Re:vimdiff by ajs (Score:2) Monday December 10, @03:23PM
    • Re:vimdiff by ion.simon.c (Score:1) Monday December 10, @07:17PM
    • Re:vimdiff (Score:5, Insightful)

      I was simply going to mod you offtopic (two points left) - but instead I decided to reply. Mostly because I'm curious.

      Your comment is the typical argument: "emacs is better."

      However, you do not go into why it's better. You don't even mention a slight reason as to why it's better. You state that "the rest of us" "use more decent tools" and "snicker [at those who don't]."

      Would you mind qualifying your statements?
      1) What is a "more decent tool"?
      2) Why is this other tool better to use?
      3) Who is "the rest of us"?
      4) Why make this statement with nothing to back it up? If your statement is 100% qualified and "correct" - why not just give a few reasons as to why?

      I really want to know why your "more decent tools" are so plainly superior that you don't even bother to qualify your statements as to why.
      • Re:vimdiff by mOdQuArK! (Score:2) Monday December 10, @06:14PM
        • Re:vimdiff by bckrispi (Score:1) Monday December 10, @07:59PM
          • Re:vimdiff by ConceptJunkie (Score:2) Monday December 10, @11:05PM
        • Re:vimdiff by ScytheBlade1 (Score:3) Monday December 10, @10:27PM
      • Re:vimdiff by sqldr (Score:2) Tuesday December 11, @06:06AM
        • Re:vimdiff by PeterBrett (Score:2) Tuesday December 11, @06:29AM
        • Re:vimdiff by Dan Ost (Score:2) Tuesday December 11, @10:59AM
    • Re:vimdiff (Score:5, Informative)

      > the rest of us, who use more decent tools, can just snicker.

      I take it you are a code monkey developing mainstream apps, most of the more evolved ones are emacs folks. But admins and embedded folks are often working in diverse environments, many of which don't have emacs but any *NIX type environment will have vi. Busybox implements a vi clone. I seriously doubt you will find emacs on very many routers, access points, settop boxes, cell phones, etc.

      Since I use so many different machines it just makes sense to default to vi/vim and stick to assuming only the default behaviour. Emacs only makes sense if you mostly use a single home directory where you can have emacs customized.
      • Re:vimdiff by Just Some Guy (Score:2) Tuesday December 11, @11:57AM
      • 1 reply beneath your current threshold.
    • 4 replies beneath your current threshold.
  • vim is clearly the emacs of vi clones.
  • vim syntaxt is quite arcane (Score:4, Insightful)

    by pongo000 (97357) on Monday December 10, @02:45PM (#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! (Score:5, Funny)

    by Seumas (6865) on Monday December 10, @02:45PM (#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! by Seumas (Score:1) Monday December 10, @02:49PM
    • Re:VI SUCKS! by General Lee's Peking (Score:1) Monday December 10, @03:53PM
    • Re:VI SUCKS! by ei4anb (Score:1) Monday December 10, @04:16PM
    • Re:VI SUCKS! by meuhlavache (Score:1) Monday December 10, @04:36PM
    • Re:VI SUCKS! by Provocateur (Score:1) Monday December 10, @07:02PM
    • Re:VI SUCKS! by thogard (Score:1) Monday December 10, @11:30PM
    • 3 replies beneath your current threshold.
  • by deweycheetham (1124655) on Monday December 10, @02:51PM (#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.
  • As a linux neophyte... (Score:3, Interesting)

    I use nano. It's enough for my basic needs, and doesn't depend on cryptic key sequences :)
  • In a pigs eye (Score:1)

    by baomike (143457) on Monday December 10, @02:58PM (#21646419)
    >
    One persons opinion.
  • Using vi (Score:5, Funny)

    by Anonymous Coward on Monday December 10, @03:00PM (#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 by uarch (Score:2) Monday December 10, @03:21PM
      • Re:Using vi by just_another_sean (Score:3) Monday December 10, @04:19PM
      • 1 reply beneath your current threshold.
    • Re:Using vi by argent (Score:2) Monday December 10, @03:32PM
    • Re:Using vi by PCM2 (Score:1) Monday December 10, @03:39PM
    • Re:Using vi by jobsagoodun (Score:2) Monday December 10, @03:44PM
      • Re:Using vi by manifoldronin (Score:2) Monday December 10, @04:52PM
    • coders vs. sysadmins (Score:5, Informative)

      by mungtor (306258) on Monday December 10, @03:47PM (#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.
    • troll by digital bath (Score:1) Monday December 10, @03:51PM
    • So many suckers... by mario_grgic (Score:1) Monday December 10, @03:52PM
    • Re:Using vi (Score:5, Informative)

      by Hatta (162192) on Monday December 10, @03:56PM (#21647291) Journal
      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.
      • Re:Using vi by Tuffnutz (Score:1) Tuesday December 11, @12:44PM
      • 1 reply beneath your current threshold.
    • Re:Using vi by turing_m (Score:2) Monday December 10, @09:46PM
    • Re:Using vi by Tyr_7BE (Score:1) Monday December 10, @10:19PM
    • Re:Using vi by jollyreaper (Score:2) Monday December 10, @10:51PM
    • Re:Using vi by XO (Score:2) Monday December 10, @11:55PM
    • Re:Using vi by jc42 (Score:2) Tuesday December 11, @02:24PM
    • Re:Using vi by richardtoohey (Score:1) Monday December 10, @04:39PM
    • Re:Using vi by GrassIsRed (Score:1) Monday December 10, @07:11PM
    • 5 replies beneath your current threshold.
  • Why vim (Score:1)

    by supe (163410) * on Monday December 10, @03:01PM (#21646467) Journal
    edlin is your friend.
    • Re:Why vim by HogGeek (Score:2) Monday December 10, @03:07PM
  • 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. :)
  • by spungo (729241) on Monday December 10, @03:23PM (#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.)
  • by bl8n8r (649187) on Monday December 10, @03:26PM (#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... (Score:3, Informative)

    by Lodragandraoidh (639696) on Monday December 10, @03:27PM (#21646847) Journal
    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? by hawk (Score:2) Monday December 10, @03:54PM
      • Re:20mb? by Lodragandraoidh (Score:2) Tuesday December 11, @09:57AM
      • acronym by SeanAhern (Score:1) Thursday December 20, @03:22PM
    • Re:Used both... by Abcd1234 (Score:2) Monday December 10, @04:28PM
    • Re:Used both... by dbIII (Score:2) Monday December 10, @07:06PM
  • splitting screens (Score:1)

    by pak9rabid (1011935) on Monday December 10, @03:28PM (#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.
  • The best vi clone (Score:5, Interesting)

    by hibiki_r (649814) on Monday December 10, @03:32PM (#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.

  • by lena_10326 (1100441) on Monday December 10, @03:41PM (#21647073) Homepage
    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 (Score:1)

    by gowakuwa (1199733) on Monday December 10, @03:43PM (#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... (Score:5, Funny)

    by david.emery (127135) on Monday December 10, @03:43PM (#21647103)
    If you need to edit the makefile for EMACS... :-)

    dave
  • Shell support (Score:2, Interesting)

    by c0nst (655115) on Monday December 10, @03:48PM (#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 (Score:2)

    by RAMMS+EIN (578166) on Monday December 10, @03:55PM (#21647277) Homepage Journal
    ``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 (Score:3, Funny)

    by PPH (736903) on Monday December 10, @04:02PM (#21647375)
    vi is my shepherd. I shall not font.
  • by jank1887 (815982) on Monday December 10, @04:22PM (#21647677)
    I personally prefer NI labview, but that's just me. no open source equivalent 'there' yet. :)
  • !Hacking (Score:2)

    by ShakaUVM (157947) on Monday December 10, @05:23PM (#21648525) Journal
    So the book isn't really about hacking vim. It's about using vim, which is a difference.

    My favorite VIM hack was when I added a command that would tie in with search, and fold down all the areas that aren't within 3 lines of the searched term. So if you're going to change the name of a variable, you just search for the name of the variable ("/variable_name") and then all the sections of code that don't contain it magically fold away, and you can flip through it real fast making the name changes. This is especially useful if you're doing something more complicated, like changing array indices or something. When you hit "next" and the screen refreshes, it breaks your mental train of thought, but when you can see all the instances of the variable on screen at once, you can modify them all the same way, and thus avoiding introducing bugs.

    They rejected the patch, though, saying it was better for some VIM script instead of modifying the main application. /shrug
    • Re:!Hacking by cymen (Score:2) Monday December 10, @07:17PM
      • Re:!Hacking by ShakaUVM (Score:2) Monday December 10, @07:51PM
  • Tips (Score:1)

    by John Girouard (716057) on Monday December 10, @06:07PM (#21649057) Homepage
    I've always wished that there were some sort of 'tip of the day' feature that I could turn on. Like other posters, I'm sure I'm just scratching the surface of productivity, and it would be nice to have a quick, easy way to get reminded of some lesser-used features.
  • by gelsey (1009457) on Monday December 10, @07:47PM (#21650131)
    I played around with vimenu, which is a vi interface on top of Microsoft Word. I loved the concept, unfortunately Word is an unwieldy beast and this vi interface causes it to be both slow and easy to crash, so I had to give it up.

    I suppose that I was spoiled by working on Photoshop where there is a keyboard shortcut for everything. Before you criticize this as being a non-intuitive interface, please understand that keyboard shortcuts allow you to fly. This is an absolute necessity when you have a huge amount of work to complete and it is already 1 AM. This also made me regard the mouse as evil.

    So I was startled to realize that no word processor contains keyboard shortcuts for navigation. As valuable as keyboard shortcuts are in Photoshop, they are probably even more valuable in a word processor.

    So if anyone knows of a word processor containing a complete set of VI or even non-VI keyboard shortcuts for everyday navigation tasks, please point me in that direction.

    Thanks

  • Ed man ! man ed (Score:2)

    by Frank T. Lofaro Jr. (142215) on Monday December 10, @07:52PM (#21650177) Homepage
    Skip this junk to bypass the lameness filter:

    Ten years ago a crack commando unit was sent to prison by a military court for a crime they didn't commit. These men promptly escaped from a maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune. If you have a problem and no one else can help, and if you can find them, maybe you can hire the A-team. Hey there where ya goin', not exactly knowin', who says you have to call just one place home. He's goin' everywhere, B.J. McKay and his best friend Bear. He just keeps on movin', ladies keep improvin', every day is better than the last. New dreams and better scenes, and best of all I don't pay property tax. Rollin' down to Dallas, who's providin' my palace, off to New Orleans or who knows where. Places new and ladies, too, I'm B.J. McKay and this is my best friend Bear. One for all and all for one, Muskehounds are always ready. One for all and all for one, helping everybody. One for all and all for one, it's a pretty story. Sharing everything with fun, that's the way to be. One for all and all for one, Muskehounds are always ready. One for all and all for one, helping everybody. One for all and all for one, can sound pretty corny. If you've got a problem chum, think how it could be. Mutley, you snickering, floppy eared hound. When courage is needed, you're never around. Those medals you wear on your moth-eaten chest should be there for bungling at which you are best. So, stop that pigeon, stop that pigeon, stop that pigeon, stop that pigeon, stop that pigeon, stop that pigeon, stop that pigeon. Howwww! Nab him, jab him, tab him, grab him, stop that pigeon now.Just the good ol' boys, never meanin' no harm. Beats all you've ever saw, been in trouble with the law since the day they was born. Straight'nin' the curve, flat'nin' the hills. Someday the mountain might get 'em, but the law never will. Makin' their way, the only way they know how, that's just a little bit more than the law will allow. Just good ol' boys, wouldn't change if they could, fightin' the system like a true modern day Robin Hood. Hey there where ya goin', not exactly knowin', who says you have to call just one place home. He's goin' everywhere, B.J. McKay and his best friend Bear. He just keeps on movin', ladies keep improvin', every day is better than the last. New dreams and better scenes, and best of all I don't pay property tax. Rollin' down to Dallas, who's providin' my palace, off to New Orleans or who knows where. Places new and ladies, too, I'm B.J. McKay and this is my best friend Bear. Ulysses, Ulysses - Soaring through all the galaxies. In search of Earth, flying in to the night. Ulysses, Ulysses - Fighting evil and tyranny, with all his power, and with all of his might. Ulysses - no-one else can do the things you do. Ulysses - like a bolt of thunder from the blue. Ulysses - always fighting all the evil forces bringing peace and justice to all. Knight Rider, a shadowy flight into the dangerous world of a man who does not exist. Michael Knight, a young loner on a crusade to champion the cause of the innocent, the helpless in a world of criminals who operate above the law. Children of the sun, see your time has just begun, searching for your ways, through adventures every day. Every day and night, with the condor in flight, with all your friends in tow, you search for the Cities of Gold. Ah-ah-ah-ah-ah... wishing for The Cities of Gold. Ah-ah-ah-ah-ah... some day we will find The Cities of Gold. Do-do-do-do ah-ah-ah, do-do-do-do, Cities of Gold. Do-do-do-do, Cities of Gold. Ah-ah-ah-ah-ah... some day we will find The Cities of Gold.

    From: patl@athena.mit.edu (Patrick J. LoPresti)
    Subject: The True Path (long)
    Date: 11 Jul 91 03:17:31 GMT
    Newsgroups: alt.religion.emacs,alt.slack

    When I log into my Xenix system with my 110 baud teletype, both vi *and* Emacs are just too damn slow. They print useless messages like, 'C-h for help' and '"foo" File is read only'. So I use the editor that doesn't waste m
  • I found and changed all the settings for color I could find to make everything black and white but to no avail, I still get colored line numbers which I see as just a blur. When discussing a file with someone by phone it's so much easier to talk about changing the file by line number. Mostly I use plain old vi when I have the choice. I can see everything it does.
  • by mattack2 (1165421) on Monday December 10, @10:09PM (#21651111)
    You can get this as an eBook in PDF form for $20.39 from http://www.packtpub.com./ [www.packtpub.com]
    Thanks to Clifford M. Bryant Jr. who added that comment to the first review on Amazon. (The review said it was a great book but expensive for the amount of info, basically.)
  • by DJ_Perl (648258) on Monday December 10, @11:06PM (#21651435) Homepage
    I haven't been able to find a "full screen" version of either Emacs or vi. Something you can run within KDE / GNOME. An OpenGL emulation of console mode. Now that would be useful!
  • My worry (Score:2)

    by jandersen (462034) on Tuesday December 11, @02:07AM (#21652489)
    The thing I like about vi is the simple and very economic interface - this is a style of editor that was made for slow serial lines (I still keep a terminal that can run as slow as 128 baud!). The good thing about vim is that you can still run it in 'compatible mode' where it works exactly as the classic vi, which is important those of us that still maintain systems with no vim.

    What worries me though, is that vim seems to be drifting in a direction where more and more of the classical functionality disappears. Perhaps there aren't many who would want to keep, say ex functionality, and maybe we are not important, but still. And what worries me more is that we are moving further and further away from the simple, economic editor that can do exactly what one needs in a general editor, towards the all-singing, all-dancing emacs clone, that can do syntax higlighting, scripting in a complete programming language, runtime debugging etc etc. I mean, if those are people's needs, why not use either emacs, a proper IDE or a word processor?

    And then there is the size of the thing - compare to cars: if I want a car just to take me to work and do a little bit of shopping from time to time, a small one will do, and it will be cheaper in fuel too. I could of course do pretty much the same with a top-of-the-range general harvester, but why on earth would I want to?
  • by seebs (15766) on Tuesday December 11, @03:22AM (#21652815) Homepage
    Vim's not a very good vi. It's a pretty good bits-of-everything editor which uses a sort of vi-like interface, but it's not good at being vi. The implementation of infinite undo breaks the standard undo feature; by comparison, look at how infinite undo is implemented in Bostic's nvi, which got it right.

    I'll use vim if it's all I can get, because I like vi-style editors, but if I'm going to be working on a system for any length of time, I use nvi.

    Yeah, yeah, syntax coloring. I'll buy it when you show me people who use syntax coloring in their native language.
  • What about Joe...? (Score:2, Funny)

    by uweg (638726) on Tuesday December 11, @08:19AM (#21654421)
    ...because WordStar key bindings became hardwired inside my spinal cord during childhood....

    ...ahh those CP/M days....
  • Here's my favorite Vim trick that I somehow went years before discovering, even though I read through the entire Vim documentation. You can use Ctrl-C instead of ESC to get out of insert mode! Much nicer for keeping your hands close to home row.
  • Re:Vim is painful. (Score:2, Funny)

    by Anonymous Coward on Monday December 10, @02:47PM (#21646247)

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

  • Re:Dired mode? (Score:2)

    by ByOhTek (1181381) on Monday December 10, @02:47PM (#21646253) Journal
    dired? What is that?
  • Re:Kprinter? (Score:1)

    by Cyrano de Maniac (60961) on Monday December 10, @02:49PM (#21646265) Homepage
    <ESC>:1,$ !lpr
    • 1 reply beneath your current threshold.
  • Re:Vim is painful. (Score:4, Insightful)

    by Yold (473518) on Monday December 10, @02:51PM (#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.

  • Re:I prefer EMACS! (Score:2)

    by ByOhTek (1181381) on Monday December 10, @02:52PM (#21646317) Journal
    You can run emacs in vi mode!
    • Re:I prefer EMACS! by ByOhTek (Score:2) Monday December 10, @03:03PM
      • Re:I prefer EMACS! (Score:4, Insightful)

        by Frymaster (171343) on Monday December 10, @03:24PM (#21646793) Homepage Journal
        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! (Score:5, Insightful)

          by Anonymous Coward on Monday December 10, @03:39PM (#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.
        • Re:I prefer EMACS! by T.E.D. (Score:2) Tuesday December 11, @11:39AM
      • Re:I prefer EMACS! by howdoesth (Score:1) Monday December 10, @03:43PM
      • Re:I prefer EMACS! by DirtyHerring (Score:1) Monday December 10, @04:21PM
      • Re:I prefer EMACS! by A nonymous Coward (Score:2) Monday December 10, @04:23PM
  • Re:Dired mode? (Score:1)

    by calebt3 (1098475) on Monday December 10, @03:03PM (#21646497) Homepage
    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:Why I dislike VIM (Score:2, Informative)

    by Anonymous Coward on Monday December 10, @03:06PM (#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:Vim is painful. (Score:2)

    by AntEater (16627) on Monday December 10, @03:16PM (#21646653) Homepage
    Impressive.

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

  • Re:VI = Virtually Impossible (Score:3, Insightful)

    by shoor (33382) on Monday December 10, @03:33PM (#21646957)
    Ah, you've never used ed, have you?
  • Vim can't even paste right still. (Score:1, Informative)

    by Anonymous Coward on Monday December 10, @03:39PM (#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. (Score:1)

    by foxharp (1048608) on Monday December 10, @03:57PM (#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.)

    • 1 reply beneath your current threshold.
  • by bcjanes (469676) on Monday December 10, @04:10PM (#21647501)
    I run into that too, and here's what I do. I install both elvis and vim, and in my .bashrc alias elivis to vi. That way I get the best of both worlds, by calling either vi or vim depending on my needs.
  • Re:Dired mode? (Score:1)

    by eggled (1135799) on Monday December 10, @04:16PM (#21647607)
    vim . will give you a directory listing, you can nav around in using vi commands :)
  • Re:I prefer EMACS! (Score:5, Funny)

    by spun (1352) <loverevolutionary@ya h o o . com> on Monday December 10, @04:43PM (#21647995) Journal
    What good is an unnecessary war between EMACS and vi without a comment touting the merits of ed? [gnu.org]

    Ed is the standard text editor!
  • Re:Kprinter? (Score:2)

    by Misch (158807) on Monday December 10, @05:49PM (#21648869) Homepage
    :hardcopy

    I think that's the command you're looking for?
  • BM's Google Talk (Score:1)

    by ion.simon.c (1183967) on Monday December 10, @07:25PM (#21649963)
    Jesus. No.
    That's one of the most *boring* talks I've ever seen.

    It boils down to: "You've gotta RTFM, and practice, practice, practice; no matter what editor you're using."
    There. I saved you an hour of your time.
  • Re:Why I dislike VIM (Score:1, Informative)

    by Anonymous Coward on Monday December 10, @09:30PM (#21650833)
    The traditional vi is available here:
    http://ex-vi.sourceforge.net/ [sourceforge.net]
  • Re:Vim is painful. (Score:1)

    by Aehgts (972561) on Tuesday December 11, @12:17AM (#21651877) Journal
    Didn't think it'd take long for someone to mention emacs in this debate...

    Whenever someone brings up this argument I remember something I heard some time ago and chuckle
    "emacs would make a great operating system if it had a decent text editor"
  • by harrypelles (872287) on Tuesday December 11, @02:36AM (#21652605)
    Try:

    unalias vi

    ...from your shell

    Don't know what you're running, but some distros symlink or alias vi to vim. Either that or look from symlinks for vi to vim in the directories in your $PATH.
  • Re:Dired mode? (Score:2)

    by PastaLover (704500) on Thursday December 13, @11:57AM (#21685167) Journal
    :edit .
  • 21 replies beneath your current threshold.