Vim 7 Released
houseofmore writes "After many years of development, Bram Moolenaar, creator of Vim, today announced version 7 of the widely used editor. New features included spell checking in up to 50 languages, intelligent completion, tab pages, extended undo branches and much more. Downloads available here for Unix, Windows, Mac and more."
A spellchecker? Now, to be fair, I'll probably find that useful. Still I can't help but feel vim is one step closer to proving jwz's law.
For years I tried to indoctrinate myself with vi, too.
Then i found SubEthaEdit for mac os x.
I've really found no need for anything else since. I highly recommend anybody on an apple try it out. I feel like it follows the philosophy of vi (lightweight, responsive, simple, functional), but integrates well with the rest of the OS (uses apple's spell check, plays well with os x services and keyboard shortcuts). and, though i know this isn't for everyone, it follows apple's emacs-style ctrl-f, ctrl-b, etc navigation.
Everyone has their editor of choice, but really vi is not that difficult. These days, you can even use the arrow keys to navigate to make it even easier (although I still prefer the letters). If you can't learn how to use vi well enough to perform basic text editing functions within about 20 minutes, maybe system administration is not for you.
Vi is simple, elegant, and light-weight. It takes only a few minutes to learn, but years to truly master. Vim is a misguided attempt to add the bloat of emacs to vi.
Other editors like joe may have their uses, but vi has two major advantages:
1.) It has a deceptively simple command set that hides a tremendous amount of power. This is the Unix way.
2.) It's included in virtually all Unix and Unix-like systems, which makes it a vital skill for any sysadmin.
Vim is unnecessary and its "most useful" feature, syntax highlighting, is the first thing I disable whenever I use it, and I use it for development work (on systems where vi has been replaced by vim).
http://www.vim.org/htmldoc/uganda.html ... while RMS could finish Hurd from his emacs fundraising
Have you tried (v)isual mode?
The link from the main MacVIM page is broken, but here is 7.0 for OSX:
http://macvim.org/OSX/index.php
Try Esc V + use arrow keys to copy.
Paste is usual Shift + Insert.
Also you can use -
Esc v -> visual mode - character wise
Esc Cntrl+V -> Visual mode - coloumns
Whatever is in the visual mode also copies. So very easy
rajmohan_h@yahoo.com
Once you've learned vim, it becomes probably the fastest editor to use. Never having to use the mouse. Being able to quickly move around a document. Complex (regex) searching/replacing. It has a steep learning curve, but it a very powerful and arguably intuitive editor. I first started using it in the mid-90s when I first got onto the big unix boxes at the university I attended. Since then, I continually find myself trying to use vim syntax in different editors. Its not uncommon to see ZZ or :wq at the end of some of my emails or other documents.
It's popular because it's like vi with some extensions to make it more modern.
It's especially handy for editing source code. Where you have commands to reformat comments, move between functions, jump to definitions and things like that. I'd rather hit [[ to go to the top of the previous function than have to enter a search for it. This is especially useful when you're going through all your callback routines and adding a little bit of code to them.
The ability to have multiple cut/paste buffers is also nice. The modal behavior makes people think Vi is a throwback, but honestly only a handful of editors are able to provide even 90% of Vi's editing features. And none (not even emacs) can do it with so few keystrokes (that does make the learning curve on Vi rather steep).
The disadvantage to such an effecient input system is when the cat jumps on your keyboard, you can have hours of work erased in Vi.
ps- I have vi-like bindings in my Cocoa windows. you can actually change how the input works and plug in something else. Or you can just tweak it to use Ctrl-vi key without even using a plugin by editing DefaultKeyBinding.dict. The emacs bindings that are there by default are pretty weak anyways.
“Common sense is not so common.” — Voltaire
Typing in vim is okay, but I found waaaay to tedious and distracting, nevermind it being incredibly frustrating and annoying, switching in and out of modes to move about and edit stuff here and there. My editor of choice now is Scite. You can't beat the simplicity of c-x, c-c, or c-v for editing and the cursor keys for moving about. I don't care if vim has 10,000 other features, I use only those ones I mentioned for perhaps 99.9% of everything I do.
Now, if I were to start fresh, would I still choose vim? I think the answer is a resounding "probably." Here are some reasons why:
vi[m]'s ubiquity I think is its strongest argument. Other editors exist to satisfy the other requirements, and some of them might even do it in less obscure ways. But if you're the type who needs to bounce around on different systems running different unixes, vi is always just there. And once you become proficient enough, you're really not strongly inclined to use anything else.
The thing that most people don't realize about VI(M), is that it works very well when using things like telnet to edit your files. There are many characters like ctrl, alt, home, and such that don't travel well over telnet. Having a program like VI(M) is great when you're accessing from a remote system, and can only use the keyboard.
Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
I'll admit the initial learning curve is a pain, but once you've mastered the basic cursor movement/find/save set of commands, vi has an easy learning curve. You can use the basic command set for years and add one or two new commands as you need ("There has to be an easier way to do this..." [reaches for vi reference]).
Efficiency is the main reason, but there are many others. Black backgrounds are easier on my eyeballs; syntax highlighting keeps me from making stupid mistakes; it's on every UNIX box by default; and I've been using it for 17 years -- muscle memory is a good thing.
Anonymous Kev
Proudly posting as AC since 1997
(Finally got a dang account in 2004)
There is a more user-friendly version of Vim for Windows types, at least: 'gVim Easy' is installed in Vim's 'Start' menu entry when you use the Vim all-in-one installer for Windows. It's Vim with a GUI and no command mode. No ESCing; no arcane shortcuts; everything accessible from a graphical menu.
Has anyone who complains about how "difficult" Vim is actually tried it more recently than 1991?
It's part of the vim 7.0 package, i.e., you get vim 7, you get gvim 7! Cool!
-yagu
Except for capital letters I've never had to press two buttons at once, ever
^X^F in insert mode to complete files. Gotta have it. Better than trusting my fingers, and takes less typing.
For vi-compatible mode tryor on the command lineIf it still insists on syntax highlighting type
1. position cursor on the first line you want to cut/copy
2. mx (create mark "x")
3. position cursor on the last line you want to cut/copy
4. y'x (yank from mark "x" to current)
or
4. d'x (delete from mark "x" to current)
x can be any letter from a to z
Try this: :set paste
:set nopaste
That should fix that problem, but it has some other weirdnesses. So, once you're done pasting set it back to nopaste:
You could probably map that to a shortcut if you wanted to make it quicker. I don't need it that often, so I haven't bothered.
For a permanent fix, comment out the line with 'set autoindent' in /etc/vim/vimrc
I'm a long-time-VIM-hater-turned-lover. I've been working with Linux systems for years, but always refused to learn my way around VIM, choosing to stick with nano instead. Why for the love of god not at least make Ctrl-C or Ctrl-Q or 'quit' or SOMETHING work???
After sitting through a presentation of a heuristic analysis of VIM in one of my HCI classes, where VIM was ridiculed for being the most un-intuitive, un-user friendly pieces of software since MS-DOS, I never thought I'd find myself using this tool... and actually LOVING it.
Well... fast forward a few months... I got fed up with nano's lack of a search-and-replace feature, and didn't feel like learning awk or sed. I finally decided to give vim a serious try. The key was finding this cheat sheet.
Now I love it... I'm cw'ing, y'anking, dd'ing away. Mind you I still prefer Eclipse for full-fledged development, but there's nothign like super quick and efficient scripting with vim.
Learn it. It's worth it.
This feature (ctrl-n auto-complete) was available in vim 6. The change in 7 is that the possibilities for completion now appear in vertical group; before, I had to press ctrl-n multiple times to cycle through the possibilities.
From what I'm reading in the vim7 docs, what *is* new is "omni completion". You press ctrl-x ctrl-o to invoke it. But when I tried that on a Python file with vim 7 installed from their Windows binary, I got "Error. Required vim compiled with +python."
There's always pico, nano, Diakonos, gedit, ... But frankly I love using vi[m] :)
you had me at #!
>And none (not even emacs) can do it with so few keystrokes (that does make the learning curve on Vi rather steep).
Not so! That's why there's Viper.
I was firmly on the vi side of the argument until I realized that emacs includes everything you could possibly want to edit code, including vi.
If moderation could change anything, it would be illegal.
You do know that Emacs is at version 1.21.4. They stopped using the major version number because it hasn't changed in the last couple of decades...
God made the natural numbers; all else is the work of man - Kronecker
for VIM, I found that it comes default with autoindent and smartindent switched ON. :se noai nosi
Just set it OFF.
And try the same.
rajmohan_h@yahoo.com
:h v
I realise that this isn't going to make you jump ship, but if you find yourself on a machine with only vim, try :behave mswin. It enables windows-like shortcuts such as C-z for undo, C-s for save, C-x for cut, C-c for copy and C-v for paste. Probably more but those are the only ones I use often enough to remember.
This thread isn't complete without mention of Bill Joy, the creator of vi. He's the one that should be thanked for most of the things that everyone has mentioned that they love about vim.
_ greatest_gift/
http://www.theregister.co.uk/2003/09/11/bill_joys
You can have hours of work erased just by forgetting that vim has multi-level "undo", and that instead of being able to undo the undo you just accidentally undid, you'll be undoing something else, maybe even an entire paragraph somewhere else in the file.
Plus, if you count on being able to know where you will start editing a file, vim can be a real surprise when it drops you somewhere into the middle of a file instead of row 1 column 1. If you've not edited that file for months, it is ridiculous for vim to assume that you want to go back to the last place you were. (You can remove this "feature" by making an unwritable .vimrc, I've found. It can't remember where you were in a file, so you start at the beginning.)
And colorized editing!?! What a treat for text to show up as dark blue on black when you've set your xterm colors to white on black.
Yes, I appreciate the work put into vim. I'd appreciate a "strict vi mode" command to tell vim not to do all the extra stuff that gets in the way of fingers that learned vi a long time ago.
I'll bite. A little enlightenment on vim can't hurt.
instead of being able to undo the undo you just accidentally undid
Well, almost every text editor and word processor in the world has this. The command for 'redo' (undo the undone) is :red or CTRL+R.
vim can be a real surprise when it drops you somewhere into the middle of a file
set viminfo='0 in .vimrc.
And colorized editing!?!
I'd appreciate a "strict vi mode" command
vim -v
Roses are #FF0000, violets are #0000FF, all my base are belong to you
Ctrl-R to undo undos
Plus, if you count on being able to know where you will start editing a file, vim can be a real surprise when it drops you somewhere into the middle of a file instead of row 1 column 1. If you've not edited that file for months, it is ridiculous for vim to assume that you want to go back to the last place you were.
Put "autocmd BufRead normal gg" in your .vimrc
And colorized editing!?! What a treat for text to show up as dark blue on black when you've set your xterm colors to white on black.
I'd appreciate a "strict vi mode" command to tell vim not to do all the extra stuff that gets in the way of fingers that learned vi a long time ago.
You're welcome :).
vimtutor
I've had enough abrasive sigs. Kittens are cute and fuzzy.
in a word, yes.
more specifically, Vim can do everything Emacs can do, and has a lot of features i find every other editor lacking in. there's even an IRC client.
there are lots of ways to do it. there is also a good deal of built-in support that works with most of what you'd do out-of-the-box. (note: i don't use folding much, but i instead rely on '%' to jump around and '#' or '*' to find definitions.)
in the standard distribution of Vim in Gentoo, that's on by default. as you type, opposing brackets are highlighted and missing pairs are marked with color. elsewise, you can use '%' to find matching parens, brackets, braces, whatever very quickly.
personally, i find sed to be more than adequate for the job. if you want integration in your editor, these commands might work:
:argdo %s/foo/bar/
:bufdo %s/foo/bar/
:windo %s/foo/bar/
:!. of course, being somewhat of a fairly new user to Vim (only been using it for a couple years now), i'm always learning new features.
...although if you want to modify files not already open in the editor, again, sed works just as well and can be run from within vim with
grey wolf
LET FORTRAN DIE!
Right slash to search
Period to repeat a command
I to insert at the beginning of the line, i to insert at the cursor
yy to copy a line, 5yy to copy 5 lines
dd to delete a line
cw to change a word
ma and y'a or ma and d'a to delete or copy a block
p to paste
u for undo
x to delete a character
% to find a closing bracket or parenthesis
That's really all I've ever learned or needed. It's a pretty small subset (and getting smaller with each release), but I get by on it!
It's not wasting time, I'm educating myself.
In addition to the above (all excellent, and probably recommended, resources), here's an absolute beginner's crash course to getting around in vim. (RTFM for much, much more.)
:w - save file :q - quit :wq - save file and quit :q! - quit without saving :help - self-explanitory
Once you launch vim, you're in command mode. You do stuff in command mode.
When you need to type something, you need to switch to insert mode. Type i in command mode for that.
Type all of these in command mode to use them. To move from insert mode to command mode, press ESC.
j - move down
k - move up
h - move left
l - move right
i - insert mode
If this was all vim was, nobody would use it. The power comes in the ability to do complicated text manipulations with just a few keypresses. For example, you can do many commands more than once by prefixing them with a number. Typing 25l is equivalent to pressing the right arrow key 25 times in a typical text editor. You just saved 22 button presses.
I would personally recommend vimtutor, as another poster suggested. Just type that at a shell and vim will start with a text file that explains how it works. That's how I learned the basics. It took about 10 hours over the span of five days to go from absolutely no knowledge to being comfortable using vim regularly.
Good luck.
I saw this Quick Reference linked elsewhere on slashdot. It is less comprehensive but prettier and easier to tape to the wall because it is printer-friendly. Normally I'm not printer friendly, but who wants to start a browser just to look up Vim features?
Simon's Rock College
$ vimtutor
This is an effective little program for learning basic vi/vim.
The standard Cognitive Psychology term "learning curve" refers to a graph of the amount learned as a function of time. See the "learning curve" question in this quiz. So a graph of your skill with vim as a function of time would be rather shallow. But "steep" sounds harder, like climbing a steep hill. I know, I know, resistance is futile, and usage trumps the original offical definition. OK, I think I can go a couple of years now without saying this.
For exactly the reason you mentioned, cursor placement. Insert inserts and append appends. They're fundamentally different approaches and, as such, they have different behaviors. They also extend to such places wherein you can also use "shift-i" to insert at the beginning of the line or "shift-a" to append to the end of a line.
:wq [save and quit]
Append becomes very useful if you're writing a quick macro to tack or change something onto/in a filename and you don't want to bother with a shell script.
Suppose, for example, that you have a few files in a directory:
pic1.gif pic2.gif pic3.gif pic4.gif
And you want to convert them all to PNG. You can do this a few ways, but, these are what I use most commonly:
method 1, with bash)
for i in `ls *.gif`; do convert $i ${i%gif}png; done
method 2, with vim)
bash> ls *.gif > dothis; vim dothis
[now, in vim]
q1 [macro in register 1]
yy [yank this line]
p [paste it below]
k [move back up a line]
J [join the two lines together]
A ["append"]
bksp-bksp-bksp [erase the gif extension]
i ["insert"]
png
esc
0 [go back to the beginning of the line]
j [move down a line]
q [quit the macro]
10@1 [do that ten times]
1G [go back to the first line]
q1iconvert j0q10@1 [insert a bunch of converts]
bash> sh dothis
It looks more complicated than it is. Each step is simple and easy. It's only when you write it all down that it looks hard. The whole point of vi(m) is to stay the hell out of the way and let you move things around as easily as possible.
As my father lik@(munch munch)...
Vim is one of the fastest editors I've used. I haven't used them all, but I have used Vim, Emacs, ed, notepad and its ilk, and Sam. Its first big strength is that instead of hitting your down arrow twenty times then doing the same with the right arrow, for example, you can navigate to the same spot with five keypresses or so. "20j5w" would take you down 20 lines and forward five words. Compare that to the hold a key and wait that's commonplace in other editors, or the alternative, which is to fumble for the mouse and attempt to line up your cursor with a tiny row of text then attempt to click between the correct pair of letters. Vim takes away the wait between thinking and acting. It takes a single keypress to start appending a line. It takes two to delete or copy a line, and adding a number before that will extend it to take as many lines as you please. The thing that limits your speed most is deciding what to do.
Vim is my first choice for any quick edits. When coding, I like to have the comforting weight of Emacs behind me, but there's no way it's as fast as vim. Maybe it could be almost as fast if you got really quick with c-u.
If you like Vi try Cream:
Cream
I would concur with the latter; indeed, Data General (back in the days of AOS/VS) used to bundle a version of Teco under the name of SPEED. Its only drawback was that the memory usage was quite heavy - but only at the user's end when trying to remember all those commands. ;-)
But, of course, most people these days tend to forget that Emacs started out as a set of macros for TECO (Tape Editor and COrrector).
Have you tried the vi mode on bash (set -o vi)?
r ol\Keyboard Layout]0 ,3a,00,00,00,00,00
Now I can live without it.
Oh, and remap your caps-lock key to behave as escape too, it's much more comfortable.
In X:
xmodmap -e 'remove Lock = Caps_Lock' -e 'keysym Caps_Lock = Escape'
On the console:
echo 'keycode 58 = Escape' | loadkeys -
On Windows:
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Cont
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,01,0
factor 966971: 966971