Linux Today: Linux News On Internet Time.

Linux.ie: VI Tutorial III

Jul 08, 2000, 15:42 (0 Talkback[s])
(Other stories by Ken Guest)

[ Thanks to Ken Guest for this link. ]

"Some of the features that I am going to describe in this tutorial are only available in version 5 of ViM - and even then only if those features were enabled at compile time. To find out what version you are using, and what the active feature set is, use the :version command. By using this command, vim will display its version number and list the set of features that are available with it. Features named with a '+' in front were enabled at compile time, those with a '-' were not."

"The vimrc file is a plain text file which is looked at when you start ViM. It is hidden under Linux, in that it is called '.vimrc', and kept in your home directory. The file is used to store commands that you would otherwise have to type in each time that you start up the editor. You can only have one command per line, and these commands can be commented out with a double quote ('"'). For example, most vimrc files will have 'set wrapmargin=1' in them somewhere so that wordwrap is turned on automatically. With the abbreviation command that I covered in the last tutorial you can also use the vimrc file so that ViM will correct your more typical spelling mistakes."

"Over time, your vimrc file could grow to be quite big. It could also get a bit complicated to keep it all in synch - especially if you use vim on more than one machine and a portion of one vimrc is machine specific and you don't want to use an exact copy on the other machine. There is a nice solution to this scenario, break down the vimrc file into smaller files and use the 'source' command in your vimrc file. The source command takes the form of 'source '. What it does is read that file and execute the commands that are in it."

Complete Story

Related Stories: