Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Book Reviews Books Media

Hacking VIM 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
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.
This discussion has been archived. No new comments can be posted.

Hacking VIM

Comments Filter:
  • vimdiff (Score:5, Interesting)

    by loudmax ( 243935 ) on Monday December 10, 2007 @03:43PM (#21646197) Homepage
    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.
  • by Spy der Mann ( 805235 ) <spydermann.slash ... m ['mai' in gap]> on Monday December 10, 2007 @03:52PM (#21646313) Homepage Journal
    I use nano. It's enough for my basic needs, and doesn't depend on cryptic key sequences :)
  • Re:Why I dislike VIM (Score:2, Interesting)

    by morgan_greywolf ( 835522 ) on Monday December 10, 2007 @04:12PM (#21646603) Homepage Journal

    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.

  • The best vi clone (Score:5, Interesting)

    by hibiki_r ( 649814 ) on Monday December 10, 2007 @04: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, 2007 @04: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
  • Shell support (Score:2, Interesting)

    by c0nst ( 655115 ) on Monday December 10, 2007 @04: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.
  • Re:Vim is painful. (Score:3, Interesting)

    by jinxidoru ( 743428 ) on Monday December 10, 2007 @05:27PM (#21647745) Homepage
    I am a vim zealot. I'll put that right out there. I am extremely fast at coding in vim. That said, I also want some of the more advanced features that exist in modern IDEs. As a result, what I generally do is have the same file open in two windows. One is my vim window, the other is my Xcode window. For the things that work best in vim (ie general development), I use vim. For the things that work best in an IDE (ie debugging), I use Xcode. I would love to merge these two. Are there any IDEs out there that have good embedded tools that allow you to run vim inside of an IDE editor window? That would be awesome. But, I have my doubts that such a thing might exist.
  • Re:vimdiff (Score:3, Interesting)

    by ScytheBlade1 ( 772156 ) <scytheblade1@NOsPam.averageurl.com> on Monday December 10, 2007 @11:27PM (#21651217) Homepage Journal
    Actually I was being 100% honest in my question(s). My extent of emacs usage is at my school during the "Intro to UNIX" class - which I completed in four hours (the entire class).

    Four hours of emacs is just enough to hate it, and not nearly enough to understand it.

    Again, honest questions.

An Ada exception is when a routine gets in trouble and says 'Beam me up, Scotty'.

Working...