Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×

A Visual Walkthrough of New Features in Vim 7.0 406

An anonymous reader writes "Anybody who has used Linux or any other OS would be aware of the very powerful and feature rich text editor Vi. This interesting article takes a visual look at some of the new features in the latest version of Vim 7.0 — a Vi clone created by Bram Moolenaar. From the article: 'Just for once, I wouldn't mind siding with the beast if that is what it takes to use Vi. The modern avatar of Vi is Vim — the free editor created by Bram Moolenaar. Riding from strength to strength, this editor in its 7th version is a powerhouse as far as an editor is concerned. When ever I use Vim (or GVim for that matter), it gives me the impression of the Beauty and the Beast.'"
This discussion has been archived. No new comments can be posted.

A Visual Walkthrough of New Features in Vim 7.0

Comments Filter:
  • by joss ( 1346 ) on Tuesday September 19, 2006 @04:48AM (#16136404) Homepage
    Real men just input the entire program at the command line using cat>myprog.c
    Of course, "real men" score higher on machismo than common sense.
    C'mon.. there is nothing that really needs saying on this topic, let the flame
    wars begin.
  • So from the article it seems Vim 7 is very powerful. I have tried to use vi several times but I just cant get used to the keys. I even have right here a "Vi editor Cheat Sheet" printed in small text as a card to have handy at my computer side.

    I know the best way to learn to use Vim is to use it every day. My main editing tasks everyday are Latex processing and Java development. Usually I use Kile and Eclipse to solve my problems. As you can see I something like an IDE wore (wow). But I really would like to
    • Re: (Score:2, Informative)

      by oggiejnr ( 999258 )
      LatexSuite at http://vim-latex.sourceforge.net/ [sourceforge.net] is brilliant for editing latex documents. It took me a couple of days to initially learn but the tutorial on their site makes starting easy.
    • by cortana ( 588495 )
      Try running 'vimtutor'

      Personally I took in more when I read read the reference manual [sourceforge.net] rather than the tutorial. http://vimdoc.sourceforge.net/ [sourceforge.net] has the manual in PDF form, as well as a Vim book, FAQ and other guides.

      As for your cursor keys question, I guess it's due to tradition. You can use the 'map' command to change what the jkl and ; do.

    • I was asked this the other day. Use an IDE, it is easier than using vim, why cause yourself pain?

      Learn vi if you want to do large scale file manipulation, searching etc. But really don't bother if all you want to do is Java and Latex.

      Now if you used troff... then you should do it in vi, troff demands that you have nothing to help you and create completely incomprehensible documents to all concerned. Also if you are doing Unix admin then learn vi.

      Vi and Emacs are superb, in the same way as the Mustang fro
    • Re: (Score:3, Insightful)

      by donaldm ( 919619 )
      Basically vi was designed for 24x80 CRT screens of which the ADM3 and the VT100 became the most popular although this depends who you talk to. On an ADM3 the HJKL key actually had the Left, Down, Up and Right arrow keys printed on them hence the convention. I do actually surprise my colleagues by using the basic keyboard (ie. no function or cursor keys) but I have a background of using so many different keyboards (including teletypes) that it is much faster for me to do this.

      By using "cursors" it was possib
    • by njdj ( 458173 ) on Tuesday September 19, 2006 @07:33AM (#16136786)

      I know the best way to learn to use Vim is to use it every day.

      That's the only way. Getting to like vi (or vim) requires that you damage your brain, and a tool to do that is already to hand - vi. After using it every day for a while, it will seem quite natural to you that the letter "l" is the command to move the cursor to the right.

      • Re: (Score:3, Informative)

        by oohshiny ( 998054 )
        Well, it was natural on the terminals where it was originally developed, because those keys were marked with arrows.

        As people were using it on other terminals, they discovered that it didn't matter what the key actually said and that it was just a good key binding.
    • by nickos ( 91443 ) on Tuesday September 19, 2006 @09:47AM (#16137345)
      Like probably many people, I have the "inverse T" cursor key layout deeply etched in muscle memory, and I much prefer this to having left, down, up, right in a row like hjkl is (although I'm sure others prefer having all the keys on the home row). As a result I use ijkl to move the cursor and h to insert (this also means that touch typists get to keep their fingers on the touchtyping home keys and just move their second finger to i when they move the cursor up). This is what the relevant part of my .vimrc file looks like:
      " remap h to insert and use ijkl for inverse T cursor movement
      map h <insert>
      map i <up>
      map j <left>
      map k <down>
  • Emacs (Score:5, Interesting)

    by arun_s ( 877518 ) on Tuesday September 19, 2006 @05:00AM (#16136436) Homepage Journal
    I used to use Vim extensively, but have now switched to Emacs for the sheer joy of learning something new and interesting. Not trying to flame here, but this is one of the strongest quotes I've read on Emacs (Stepehenson, of course):
    I use emacs, which might be thought of as a thermonuclear word processor. It was created by Richard Stallman; enough said. It is written in Lisp, which is the only computer language that is beautiful. It is colossal, and yet it only edits straight ASCII text files, which is to say, no fonts, no boldface, no underlining. In other words, the engineer-hours that, in the case of Microsoft Word, were devoted to features like mail merge, and the ability to embed feature-length motion pictures in corporate memoranda, were, in the case of emacs, focused with maniacal intensity on the deceptively simple-seeming problem of editing text. If you are a professional writer--i.e., if someone else is getting paid to worry about how your words are formatted and printed--emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish.

    But vim is pretty cool too (I have windows ports for both the editors so I can use both in office). Arguing over which is better is a waste of time IMO, both do their job fantastically well.
    • The issue which really puzzles me about vim and emacs is not people preferring one or the other it's experienced programmers who use neither. That's like trying to program without caffeine!
      • I agree.

        Although it looks like the IDEs are getting features that the great text editors won't get any time soon; I was particularly impressed when I saw the Java refactoring things in Eclipse. Just select a few lines with a loop or so, right-click 'Extract method', name it and the rest is automatic. Emacs and vi won't get that sort of language integration ever, I think.

        But since that won't work well for more dynamic languages anyway, and the current job is Perl... yay for Emacs :-)

        • Emacs and vi won't get that sort of language integration ever, I think.

          Can't speak for vim, but there is at least one Java refactoring tool [xref-tech.com] for emacs.

          Not too surprising if you think about it. The whole point of emacs is that it's extensible. If there's something you want - write it!
        • Re: (Score:2, Informative)

          by Saval ( 39101 )
          I was particularly impressed when I saw the Java refactoring things in Eclipse. Just select a few lines with a loop or so, right-click 'Extract method', name it and the rest is automatic. Emacs and vi won't get that sort of language integration ever, I think.


          Might not get, but Eclipse has got ViPlugin. So you actually can use familiar vi-editing inside eclipse with all the bells and whistles of eclipse!

    • Re:Emacs (Score:4, Interesting)

      by cortana ( 588495 ) <sam@robots[ ]g.uk ['.or' in gap]> on Tuesday September 19, 2006 @05:24AM (#16136506) Homepage
      On the other hand, arguing is fun and a good way to learn about the editor you don't use because you're not familiar with it. :)
    • I did some coding work for a year. Forced myself to use emacs for all of it, and came to appreciate the power and customisability of it. However, most of that power is only evident if you're doing something like programming or maybe writing a book.

      vi has always been a fairly lightweight editor. It functions on a minimal system, and is ubiquitous. Also, it's not written by RMS. These are all good features. :-)

      Two editors have two different niches. As you say, they both do their respective jobs fantastically
    • Re:Emacs (Score:4, Funny)

      by Jah-Wren Ryel ( 80510 ) on Tuesday September 19, 2006 @09:20AM (#16137207)
      I use emacs, which might be thought of as a thermonuclear word processor. It was created by Richard Stallman; enough said....

      Enough said, yet the author goes on to write an entire paragraph?

      Perhaps Neal Stephenson does not quite grasp the meaning of "enough?" Judging by the length of his books, I guess that's probably true.
  • Bill Joy (Score:5, Informative)

    by Brainix ( 748988 ) <brainix@gmail.com> on Tuesday September 19, 2006 @05:06AM (#16136450) Homepage
    For the younger ones in the audience, Vim is a superset of vi [wikipedia.org], which was originally written by Bill Joy [wikipedia.org].

    Yes, the same Bill Joy who heavily contributed to BSD [wikipedia.org], TCP/IP [wikipedia.org], NFS [wikipedia.org], and csh [wikipedia.org].

    Yet I still count vi as one of his top contributions. :-)
  • Looks good (Score:5, Funny)

    by 1310nm ( 687270 ) on Tuesday September 19, 2006 @05:09AM (#16136463)
    I can see myself using the tab and undo features, but the spillchucker adn autocomplete seme useliss 2 me.
  • by dp_wiz ( 954921 ) on Tuesday September 19, 2006 @05:13AM (#16136473)
    How do i enable that clippy?
  • by martinmarv ( 920771 ) on Tuesday September 19, 2006 @05:14AM (#16136476) Homepage
    From the Article:
    I realise that I have made a mistake. I can easily take the document to a point 10 minutes back by using the command :
    :earlier 10m

    Or for that matter, move to a point 5 seconds ahead by using the command:
    :later 5s


    ... So I don't need to actually do the work any more? I can just start a new file "Project Plan", enter the command ":later 7200s" then print it out?
    • Re: (Score:2, Funny)

      by Anonymous Coward
      Thats actually pretty cool. Funny thing happened though.

      I cranked up my emacs to see if it had that-

      M-x earlier 10y

      And I got vi.

      After searching the internet on how to do fucking anything in vi (I forgot the :) (thats not a smiley, its a colon), I did a :later 10y

      And I'm back again. Whew. So yah, later works too.
  • by chub_mackerel ( 911522 ) on Tuesday September 19, 2006 @05:14AM (#16136480)

    FTFA:

    I can easily take the document to a point 10 minutes back by using the command :
    :earlier 10m
    Or for that matter, move to a point 5 seconds ahead by using the command:
    :later 5s

    AWESOME! Need to finish writing a paper? Normally take about 2 hours? Just type in

    :later 2h

    No muss, no fuss.

  • While it may be free (Score:5, Informative)

    by also-rr ( 980579 ) on Tuesday September 19, 2006 @05:21AM (#16136499) Homepage
    It is also charity ware. The website asks for donations to a charity that helps children in Uganda [iccf-holland.org].
  • by MickDownUnder ( 627418 ) on Tuesday September 19, 2006 @05:26AM (#16136510)
    Windows Users DON'T get excited about text editors !
  • by swordgeek ( 112599 ) on Tuesday September 19, 2006 @05:42AM (#16136549) Journal
    While I have no doubt that vim is a powerful and useful editor, it's increasingly large laundry-list of features is dragging it increasingly farther away from both the functionality and the philosophy behind vi. Keep in mind that vi is a visual superset of ex. As such, it was designed as a visual text editor that works on any cursor-addressable terminal. All functions are accessible from the home-row of keys, with the exception of the esc key. Editing features use regular expressions. In short, it's the ideal editor for the touch-typing administrator who can count on it working under fairly rough circumstances.

    As a sysadmin, I have to ask how features like pop-up spellcheck and "omini" completion will help me edit config files on a vt102 terminal, (OK, my hard terminal is actually a vt520). vim is basically becoming a graphically-dependent editor that happens to use a similar editing structure to vi. Yes, I know about vi compatability mode, but that just throws out most of the last 'n' years of development.

    My point? Not that development should be stopped, or that these goll-durned newfangled features ain't right, but that I wish it wasn't always trumpeted as "vi--but better." Most of the 'better' part of is are things that point away from vi.
    • As a sysadmin, I have to ask how features like pop-up spellcheck and "omini" completion will help me edit config files on a vt102 terminal, (OK, my hard terminal is actually a vt520). vim is basically becoming a graphically-dependent editor that happens to use a similar editing structure to vi. Yes, I know about vi compatability mode, but that just throws out most of the last 'n' years of development.

      Those features are aimed at people using vim as a programming editor (although I use it for emails via m

  • One thing that could sell some of my co-workers on vim would be if it had better XML features. Nothing too fancy but at least prettyprinting and a wellformedness check. Add a few GUI things to make life easier for people using search+replace and it could well become the preferred editor (people are now making do with editpad, notepad2, xmlspy home edition, etc.)

    Fancy stuff I would like; smartly(!) adding closing tags (i.e. only if needed to make the document wellformed, skip adding a closing tag if there's
    • Re: (Score:3, Interesting)

      by cortana ( 588495 )

      One thing that could sell some of my co-workers on vim would be if it had better XML features. Nothing too fancy but at least prettyprinting and a wellformedness check.

      :%!xmllint --format
      :%!xmlwf

      Add a few GUI things to make life easier for people using search+replace and it could well become the preferred editor (people are now making do with editpad, notepad2, xmlspy home edition, etc.)

      Point those people at gvim (or, if they don't want a modal editor, evim).

      The rest of your suggestions are more

  • Man do I get sick of trying to close documents in other applications with :wq

    I even tried to close firefox with that a few weeks back.

    For me though, programming without vim would be horrific. I've used Vim for so many years that I probably couldn't use another editor.

    I tried Kedit, because some of my students were using it and I thought I should have a go, but I found it too krufty.

    Since 90% of my programming is console based (the other 10% being shitty text only websites created in Vim, and slightly more f
    • by teslar ( 706653 )
      I tried Kedit, because some of my students were using it and I thought I should have a go, but I found it too krufty.
      Try Kate instead, if you want to. Although there'd be little point to change editors in your case anyway - never change a winning team...
  • Vim is good (Score:4, Interesting)

    by jandersen ( 462034 ) on Tuesday September 19, 2006 @06:29AM (#16136648)
    But it is also becoming what vi was never really intended to be IMO. What makes vi such a great editor is a number of factors, such as:

    - it is small
    - it does a lot of things that are useful for editing source files
    - it is very economical with bandwidth etc
    - all commands map to keys that are found on all terminal keyboards

    If I should say anything against vim it would be that it can do too many things that are only eye candy or 'cool features'. Fortunately you can turn them off, which I always do. If you develop on several different UNIXes (and other OSes with UNIX like environments) getting used to all the extra features in vim can be a real pain, when you have to work with the classic form of vi.
  • by kahei ( 466208 ) on Tuesday September 19, 2006 @06:34AM (#16136657) Homepage

    Recently, Richard Stallman gave a speech in which he illustrated an academic point about programming history by quoting a guy who described vi as 'an editor spread at sword-point and which is really hard to use'.

    I think I speak for all moderate vi(m) users when I say -- DEATH and DAMNATION (in that order) to this Cardinal of the CTRL key! Needless to say my own local vim user group has dispatched assassins to kill Mr. Stallman, but this is hardly the end of the story. The fact is that a man has referred to another man who in turn expressed some often-voiced reservations about OUR EDITOR! On behalf of all editors of text everywhere, I implore EMACS users to return to the true path, lest you be burned at the stake and then go to hell, the Buffer From Which There Is No Unloading. We'll see how productive you are then, with your ctrl-meta-alt and your ELISP and your 'ring buffer', whatever THAT is.

    Peace and love to all.
    ^C
    ^X
    quit
    q
    QUIT
    exit :exit
    zz
    ZZ

  • Isn't that way of interacting with a computer just a tiny bit anachronistic? I have been working with editors for editing code since 1980 and had been using lots of editors ... from ISPF and vi over (x)emacs to IDEs like VisualC++, Netbeans or Eclipse.
    I wish that some of the more modern IDE plugins would suck less when it comes to syntax highlighting and automatic code formatting, but I do not see much place for dinosaurs like vi(m) in my daily routine any more.
    I wonder why those who still use vi not also u
  • The elegance of vi (Score:5, Interesting)

    by PhotoGuy ( 189467 ) on Tuesday September 19, 2006 @06:59AM (#16136717) Homepage
    Not to start an editor war, but one thing a lot of people don't "get" about vi, is how much more natural it is for touch typists. The typewriter keyboard was designed with two shift keys within easy reach. Ctrl and Alt were grafted on later for computers, and are less natural to reach (and in the early days, there were only ones for the left fingers, making things like Ctrl-T fairly hard on the hands).

    vi lets you access all of its powerful functionality using only these natural keys for typing (well, plus ESC, which is another computer addition, but its only used to flip out of insert mode, when you're done a bunch of typing, typically). Being able to move to the top of the screen by typing capital-H is a lot faster than control-whatever/control-whatever, or taking your hand off the keyboard, reaching for your mouse, aiming, and clicking. (It still amazes me that this latter approach is the one that leads the way in modern word processors, due to its obvious, but inefficient, nature.)

    This is why vi fans often joke as emacs standing for escape-meta-alt-control-shift; to a seasoned vi user, all the escapes in emacs are far more confusing than the biggest complaint about vi, it's two modes. (Reminds one of the joke about the newbie asking the TA for help; the TA says, "you do know vi has two modes, right?" The newbie replies, "yes, the one where it beeps, and the one where it doesn't.") But at the end of the day, the concept of two modes isn't rocket science to learn, and as far as all the key commands one has to learn, it's no different than emacs, where I found the key sequences far more confusing.

    • all the escapes in emacs are far more confusing than the biggest complaint about vi, it's two modes.

      Well, the command mode itself has two modes thanks to caps lock.

      My problem with vi and emacs is that they have failed to evolve in an environment where ui design really has advanced.

      vi is ok for doing quick edits in an xterm. But I still think of it as a tacked on editing mode for more.

    • In the earlier releases of emacs, there was no GUI, it was all command line and simple commands were done by pairs of cntrl-? Meta-? and so on. At first, it was confusing to just figure out how to shut the program down.

      Don't get me wrong, it was immensely powerful, even back then....it just wasn't even remotely user-friendly until you gained some serious experience with it.

      On the other hand, vi was also a bit cryptic but did not have as many features. However, the learning curve was a lot shorter in my op
    • by anandsr ( 148302 ) on Tuesday September 19, 2006 @10:03AM (#16137454) Homepage
      There are two types of people.
      1) Those who can think very clearly and can write whatever they need to in one go, without ever having to revise it.
      2) Those who cannot write even a single line without needing to use the delete feature 10 times.

      For the type 2) people vi is not a useable editor. At least not for anything that requires writing more than a couple of lines. I unfortunately am a type 2) person and have to live with emacs. IOW vi is for perfect people, and I am actually a blathering idiot when it comes to typing in my thoughts or code.

      I still use vi quite a lot, for quick editing. But if I have to write more than a couple of lines then I start searching for emacs.

      I am quite used to the two editors. Since when you are within emacs you can do almost anything, there is very little motivation to learn another editor. This is why I hate having to use any other program that tries to make me learn its editor, and does not provide emacs key bindings.

      It is good that some of the emacs key bindings are used in many editors like the firefox input box.
  • <thoughtbubble>Cool! Vim 7.0 -- I'm still using 6.4 ...</thoughtbubble>

    By navigating to Tools -> Spelling -> "Spell check on", you can make Vim display all the mis-spelled words in your document.
    Aiiieeeeeeee -- in what level of hell does vim have menus! Linuxers, we hates them we does!
  • by cabazorro ( 601004 ) on Tuesday September 19, 2006 @08:26AM (#16136956) Journal
    Real men of genius
    Today we salute you Mr. vi editor coder guy.
    Mr. vi editor coder guy!
    You type at lightning speed while while the rest of us squint our eyes in wonder.
    What the hell you just did to my file!?
    You scour through code like a red-hot knife on butter
    now my file looks funny in Notepad!!
    Thanks to you Mr. vi editor coder guy, you remind us, it's all about the code!
    Mr vi editor coder guy!
  • Returning to VI(M) (Score:5, Informative)

    by qazwart ( 261667 ) on Tuesday September 19, 2006 @09:18AM (#16137193) Homepage
    I've been programming since the 1970s when we really didn't have screen editors. We used line editors, and had to keep retyping the "list" command to see how our program was shaping.

    VI was actually not the first screen editor I used. The first I used was the old Textedit on the Mac. I thought it was wonderful. I could actually move the cursor around and see what I wrote. My introduction to VI was when I first started working with C on Unix. I hated it.

    VI was primative. Where my Mac editor was single mode, I had to switch back and forth between command mode and insert mode with VI. Where my Mac editor would wrap text, VI wouldn't. Where I could easily find a command with the menus, with VI, I had to remember archaic key strokes. Who in the hell wrote this junk!

    However, once I started getting use to it, VI grew on me. The commands I quickly learned could be combined. For example, "d" deletes. "e" moves to the end of a word. "de" deletes to the end of a word and "3de" deletes the next three words. "xp" transposes two characters. There was an order to them: "d" for delete", "f" for find, "r" for replace. It started making sense. Then I started learning the ins and outs of RegEx, and I never looked back.

    Not only that, but I quickly learned that for program editing, VI simply worked better than Textedit or Notepad. Unlike word oriented text editors, VI was line oriented just like a computer program. I've been using VI ever since. Over the years, I've tried GUI editors (Jedit, Nedit, KDEdit, TextPad, etc.) but I keep returning back to VI.

    Most of these young whipper JDs (Java Developers) with their "Object Orientation" and "Virtual Machines" think of my preference for this non-graphical editor as quaint. Sort of like the way you'd look at Grandpa playing around with his model trains. That is until they realize that I can write code a lot faster than they can.

    Last year, one developer told me it was going to take a few hours to clean up a particular program. I loaded the files in VI and transformed them in a matter of minutes. He was shocked. How can this "obsolete" little text editor do the job much more efficiently and faster than his feature ladened GUI? Why doesn't his editor support regular expressions? Why can VI load the files in less than a second while it takes VisualStudio three or four minutes? How can I write a program and never have to touch the mouse?

    My sons have just started taken up programming. My 15 year old kid likes working with PHP, and first refused to even look at VI -- to old fashion and out of date -- just like his dad. He had a *better* IDE that was made specifically for HTML/PHP web development.

    I recently caught him using VI. He had to admit that once you get over the basics, VI is faster and easier to use for his needs. My oldest is in college and I saw using VI for writing his term papers and essays. He said he found working with VI better because it kept him concentrating on content than formatting. Plus, it makes writing a lot faster. Takes a lot of time switch to the mouse each time really slows you down. He showed me how he programmed a macro spell checker using an ASCII dictionary and ispell. He also showed me the "linebreak" feature in VIM (something I didn't know about).

    After all these years, I still haven't found anything that is as efficient as VI for editing. From what I see in Linux world, a lot of younger programmers who grew up with nothing but graphical interfaces agree with me.

What is research but a blind date with knowledge? -- Will Harvey

Working...