Change default editor to VI
Here is a debian specific solution
Check to see which editors you are using
update-alternatives --list editor
Should display something like this
/bin/ed /bin/nano /usr/bin/vim.tiny /usr/bin/vim.basic
Change default editor to vim run the following command
update-alternatives --set editor /usr/bin/vim.basic
Choose the version of vi you wan to use in the above command I choose vim.basic
Reference: [Debian Administration Site]
 Split Screen
vim can edit multiple files in a multi-split-screen environment. Type :help usr_08.txt for details.
To split the screen display between different files, type at the vi command prompt:
:split another-file :vsplit another-file
Or at a shell prompt:
$ vi -o file1.txt file2.txt # Horizontal split $ vi -O file1.txt file2.txt # Vertical split
will provide multiwindow vi.
$ vimdiff file.txt~ file.txt # check recent changes of file.txt $ vimdiff file.en.sgml file.fr.sgml # check changes of translation $ gvimdiff file.txt~ file.txt # in X
will provide a nice view of differences between an original and a backup file. In SGML it matches tags, so comparing translations in this mode works very well.
Special cursor movements with Ctrl-W commands:
Ctrl-W + increase the size of a window Ctrl-W - decrease the size of a window Ctrl-W h move to the window left Ctrl-W j move to the window below Ctrl-W k move to the window above Ctrl-W l move to the window right ...
Use the following to control screen scrolling:
:set scrollbind :set noscrollbind
 Search and Replace
Change to normal mode with <ESC>.
 Search (Wraped around at end of file):
Search STRING forward : / STRING. Search STRING backward: ? STRING. Repeat search: n Repeat search in opposite direction: N (SHIFT-n)
 Replace: Same as with sed, Replace OLD with NEW:
First occurrence on current line:
Globally (all) on current line:
Between two lines #,#:
Every occurrence in file:
 Encrypt VI
If you use the vi editor, you can use the -x option to encrypt a file. For example, to encrypt yourfile, type:
vim -x yourfile
Your will be prompted for a key, which you must remember to be able to successful edit the file in the future. To decrypt the file, you should again invoke
vim -x option
 Some Default Settings
Some useful set options for your ~/.exrc file:
:set all Display all Set options :set autoindent Automagically indent following lines to the indentation of previous :set ignorecase Ignore case during pattern matching. :set list Show special characters in the file. :set number Display line numbers. :set shiftwidth=n Width for shifting operators << and >> :set showmode Display mode when in Insert, Append, or Replace mode. :set wrapmargin=n Set right margin 80-n for autowrapping lines(inserting newlines). 0 turns it off.
Reference: [Debian Manual] Reference: http://www.felixgers.de/teaching/emacs/vi_search_replace.html