|[ Back | warped.org ]|
Primer to use VI to edit text files, especially source code and email.
VI or VIM?vi is the generic term for both programs. Technically vi is original software, that can be found installed on any unix system derivitave. This is the text editor that system admins have been using since the beginning of time.
The version installed on a lot of os's is from before the beginning of time, enter vim. The M stands for iMproved. This is MORE than an understatement. For a lot of newer unix flavors (most notabley linux), vi has been dropped and vi and vim are one in the same. But for most sun releases and some bsd releases, vim is either absent or named vim and vi is the old school.
Get used to typing vim !
Graphical VersionGVIM is a great tool to get you started, it's just the X-windows version of the same program, with some handy menus and mouse usage, which can help lower that nasty vi learning curve. Once you have the setup below working, and you know you can get in and out of vim, try just running the command gvim and if that didn't work try vim -g , which does the same thing. If you've used emacs before, gvim is the parallel to xemacs.
Great! A screen full of ~'s ... Now What?Now you get to expierence what is known as a sharp learning curve. Think jedi knight, the payoff is almost as good.
:q! [return] will get you out of it. (that's 3 keys followed
by big enter key = 4 keystrokes)
Setup your envoirnmentFirst things first -- you have to get to the editor first, right?
Shell StuffFirst, find vim. then
Make sure your shell can find vim by editing these files found in your home directory : If you don't know which shell you have, the rule of thumb is if you see a % at your prompt it's probably csh based (standard on sun machines and at ucsc), and if you see a $ it's probably bash (standard on linux machines).
Vim stuffVim is controlled by a file called .vimrc found in your home directory. you can also call this file .exrc and .virc but then vim specific commands that you put into it will cause old versions to get mad at you, so name the file .vimrc
HERE is a copy of my vimrc, copy this to your home directory as .vimrc and use it as a good starting place.
Please note that the file contains escape sequences (control characters), so you MUST download it, and use a good editor (vi?) to swipe commands out of it.
See links below for more info.
Terminal StuffWell just like emacs, vim comes in two flavors -- graphical and console mode. The console is a window, kinda like a dos prompt. If you set this up right, your life is a lot happier, eg colors and working function keys etc. I prefer xterm when using linux and dtterm when using cde (windows found on sun machines). try running this from another console to invoke a new one that's BETTER :
xterm -bg black -fg white -geometry 100x45 &
[ Back to Index ]
Tell me if you read this. I dont write this for myself, damnit.
If this information helped you, consider exiting through your right. ©2000-2013 Max Baker
Sun Apr 27 22:32:34 2008 PST