Now, I can ear the screams of Emacs users and the cries of all of you who only learned the :q! shortcut to exit Vi as soon as possible, but here's my view on things:
Emacs users: I tried using Emacs. I really did. And I actually used it for a long time while I was in college. But after using Vi for a while I had a really hard time both remembering the shortcuts and configuring Emacs to behave like I wanted to. So I just stuck with Vi.
:q! users: Vi is not that hard. Really! It does need a bit getting used to, but the freedom of not using the mouse and all those small shortcuts that you think you'll never use but turn out to be extremely useful make up for the learning curve.
To speed up your learning curve, here are the two secrets to loving Vi:
- A proper .vimrc file
- Knowing the right commands
NOTE: The last 2 lines are wrong! Instead of [ you should have <. And instead of ] you should have >. But Blogger does a really bad job with these 2 characters....
" Turn on syntax highlight
syntax on
" Set tabs to 4 in size and make sure autoindent is on
set tabstop=4
set autoindent
" Make backspace work as in most editors
set backspace=indent,eol,start
" Black background and white foreground
highlight Normal guibg=black
highlight Normal guifg=white
" Make the default window size 50x80
set lines=50
set columns=80
" Store temp and swap files in this directory
set directory=/tmp/
" Show the status line
set ls=2
" Set the status line to:
" Filename [Modifed & Readonly Status] line number/total lines column (#buffer)
" More info at:
" http://www.winterdom.com/weblog/CommentView,guid,3372fa1e-966e-4389-b2ba-bb2ce527f52a.aspx
let &stl="%f %([%R%M]%)%=%l/%L %c (#%n)"
" Map Ctrl-Ins and Shift-Ins to clipboard copy paste (FIX THIS!!!)
map [C-Insert] "+y
map [S-Insert] "+gP
1 comment:
I use Vim too, best editor ever. For the beginners we should mention that there is a fine and simple tutorial. If you use Linux, just type "vimtutor" in the terminal and follow the instructions.
Post a Comment