Some useful tools for development using vim can be found in the following tar ball: vimTools.tar.gz.
The modifications are brought to you courtesy of Professor Mike Godfrey, but if you have any problems or questions please direct them to the course tutor.
If you are setting up the customizations on the student undergrad environment and you do not wish to retain any settings already present in your .vimrc file. Simply log into the undergrad environment and execute the following command:
~cs246/pub/bin/vim_setup
This will copy the required files to your account, and overwrite the existing .vimrc file.
Step 1: Copy the files to your account
To extract the files first copy the tar ball to your home account:
cp ~cs246/pub/current/tutorials/vimTools.tar.gz ~/
or
wget http://www.student.cs.uwaterloo.ca/~cs246/current/tutorials/vimTools.tar.gz
Then issue the extraction commmands (assuming you are in your home directory):
gunzip vimTools.tar.gz tar -xvf vimTools.tar
After you have done this the following files will be extracted into your account in your home directory:
Step 3:Replace your .vimrc file
The file vimrc contains the configuration information that you will need to make use of the other tools. In order to make use of this new configuration file you will have to rename it to .vimrc. Some of you may have already configured some aspects of vim by changing your .vimrc file. If this is the case, you can copy your special settings into vimrc then issue the command:
mv vimrc .vimrc
Warning: Do not attempt to copy the bit at the bottom of the vimrc file as it contains control characters for setting up colour syntax highlighting (assuming you have a colour x-term). These characters tend to not copy and paste very well.
Step 4: Configuring ctags (non-undergrad machine)
The taglist plugin only works with the "exuberant ctags" utility. We have provided a version of this in the ~cs246/pub/bin directory. The vimrc file that we have provided sets the path for ctags in the line:
let Tlist_Ctags_Cmd='~cs246/pub/bin/ctags'
If you are using the plugin on your home (Linux) machine, or elsewhere, you will want to change the variable to point to an appropriate ctags version. You can remove the line altogether if ctags is in a directory that is in your PATH environment variable. taglist is NOT compatible with the GNU version of ctags.
F4 - Toggle taglist pane (same as :Tlist) F7 - Comment current line F8 - Uncomment next found commented line (if of format incurred by <F7>)
Macros (for Java and C++ files)
Type :map to view a list of the macros configured for the file you have open, or read the appropriate file (cppMacros.vim or javaMacros.vim) in your .vim directory.To activate a macro just type the associate key sequence listed for the macro while you are in command mode. For example, typing ",main" (without the quotes) when in command mode, will insert the associated code.
You should customize your macros to match your coding style.
The taglist plugin allows you to browse the structure or your source code (among other things). Type :help taglist when in command mode, to open up the help page for the plugin. To get started it's probably easiest to open a course file in gvim. When you press F4 the taglist pane opens up, try double clicking method signatures in the window and you will see that in the editor pane you will jump to that method. Using it with regular vim is a little trickier, but definately worth figuring out--particularly if you are editing large files.
You can load additional "tags" into the taglist pane than those for the file you are currently editing use the help command specified above for more details.