Not many of you’d be using Vi, I even try to use it in Win32 System. Without doubt its one of my favourite editors even though if I know only 1% about it.
The vim config file is generally placed in your home directory “~” or “/home/username”
In Win32 system its placed in your “c:\Vim\_vimrc”
Here are the common configurations in my file
” Sets the tab stop to 4 spaces
” Sets the soft tab stop,
“generally used when indenting in Insert mode
” Shift width, no of spaces for auto indentation
” Set automatic C type indentation
” My favourite colorschem in GUI mode
” Prevents automatic write backup
” before overwriting file
” Prevents keeping of backup
” after overwriting the file
” Displays or matches the cursor
” after completing a bracket
” Last accessed directory is default working directory
” Sets numbered lines ON
” Highlighting of all java.lang.* identifiers
” If you want spaces instead of tabs
The ” is the begining of the comment in the vi configuration file
Vi is capable of handling a lot many file types, It normally picks up the filetype from the extension of the file or the heading content of the file.
You can otherwise force vi to consider a particular file type to be of a particular extension
Above are some of the types I commonly use.
You can also place all the commands above in a text file, all you need to do is place vim: (commands) : in the text of your document. So if you want a my-server.conf file to be considered as an Apaceh configuration file with 4 spaces for a tab, you can place the following piece of code in the Apache comment
# vim: ts=4 sts=4 sw=4 ft=apache :
You can see the screenshot of my Vim (Win32) editing a XML file.