Customizing GVIM

Introduction

You can customize the look and behavior of your gvim window. These customizations include the default size and position of your GUI window, colorization specific to the type of file that gvim opens, search highlighting, case-insensitive or case-sensitive searches, tab stop locations, and many, many more options. For several examples of what you can do, Google "vimrc". You can find much more information and documentation about Vim at www.vim.org.

Colorizing Code

Lack of colorization compounds the difficulty of reading and learning various types of code (e.g., HTML, Python, LaTeX, Fortran, JavaScript, etc.). Comments, text strings, special statements, and functions become lost in a sea of black and white. Follow the directions below to change your gvim window into a helpful display of pretty colors.

example
Figure 1: Colorized gvim example showing a Fortran subroutine.

NOTE: It is very likely that you already have custom colorization available for your gvim windows. Check to see if you have .gvimrc and .vimrc files in your home directory using ls -la. If you would like to add your own customized syntax highlighting, follow the steps below.


Using wget, copy my .gvimrc and .vimrc files into your home directory on Blizzard. Note that you will need to use ls -la to see any files that begin with a period. Then put filetype.vim, freeform.vim, moretex.vim, and syntax.vim into a suitable directory on Blizzard. The really important files here are .vimrc and .gvimrc. The remaining files customize the syntax highlighting for Fortran and LaTeX programs. I suggest using all of these files, especially since you might use LaTeX in a future task for credit. You can put these four *.vim files wherever you want. Once you have all of these files on Blizzard, edit .gvimrc and syntax.vim to use your own path to your new files (please don't point to my directory). To determine your current working directory, type pwd at the Linux command line.

Now open an existing file using gvim. You should already have an HTML file available, or maybe even a Python program: gvim example.html Notice that comments, headers, HTML tags, and numbers are all different colors and the code is now very easy to read.

You will notice that many of the commands in .gvimrc are useful on the fly within a gvim session. Press Esc to enter command mode and use, for example, :set nowrap to prevent the text from wrapping in wide data files. If you need help with vim or gvim, you can try :help in command mode. If you get really stuck, I recommend this: :help! If you still need help, please schedule a virtual meeting or send me an email. Have fun customizing your favorite text editor!

North Carolina's Public Liberal Arts University