Flaming VIM Logo

Mark's VIM Page

Flaming VIM Logo


Contents: | Huh? What's VIM? | VIM Web Resources | My VIM Files | My Resources | VIM Tips |

I want to provide my own suggestions or help for VIM at this site as well as provide a method to download syntax files that I maintain.

I copied the format and some source for this page from Adrian Nagle's VIM page because he did a good job and I don't do much HTML.


Huh? What's VIM?

VIM is a free text editor that is based on the popular vi editor and is available on just about every platform. I have it working on my Linux machine at home as well as my NT4.0 machine at work. VIM, which stood for Vi IMitation, is more than based on vi, setting the compatible option in VIM will make VIM emulate everything in vi including some of the bugs! Through much hard work from many folks on the Internet, VIM has been improved greatly adding many new features and improving existing functions from the original vi. It makes sense that VIM now stands for Vi IMproved.

Some of the features of VIM version 5.6 are listed below:

This is just a taste of some of the features of VIM. To learn more about VIM or to find other syntax files, I suggest you check out the VIM page! This site contains up to date information on VIM with links to the latest distributions for any system of your choice.


VIM Resources on the Web


My VIM files

The following are VIM files I have created to speed up software development. They are primarily for C++ though there is a little lisp and a little java mixed in. I also included my .vimrc for help or as a starting point. I created my .vimrc with inspiration from Sven's .vimrc found at the official VIM page.


My Resources

I developed templates for several C++ development files above. They provide the basics that any C++ file would require, including class skeleton, copyright, cvs tags, and change log. The templates are easily modified for the needs at hand.

Resources:

Templates

These templates automatically create a basic C++ source or header file for your project. They dynamically fill in the copyright year, date and userID of first modification, and project name where necessary. The project name is based on the name of the file created. With the lines below added to your .vimrc, these will run when you tell VIM to open a file with the appropriate extension and that file does not exist. To add these templates to your configuration:

  1. First, copy the template files to your desired location. I store mine in my $VIM/templates directory which I created. The templates files are:
    C.vim C++ source file auto-template.
    h.vim C++ header file auto-template.
  2. Next, add the following to your .vimrc.
    augroup templates
      " Remove all template autocommands
      au!
    
      autocmd BufNewFile *.C		source $VIM/templates/C.vim
      autocmd BufNewFile *.h		source $VIM/templates/h.vim
    augroup END
    


VIM Tips

I am slowly learning key mapping and autocommands in VIM. The following are some of my attempts to make life easier using VIM. I've included where to look in the on-line help where appropriate. You can simply type :help abbreviations, for example.

Tips:

General Tips

Converting the case of a word
To convert a word under the cursor to upper case, type viwU.
For lower case, type viwu, or to flip the case, type viw~.
Searching for the word under the cursor
To search for the word currently under the cursor, type *.
To search backward for the word under the cursor, simply type #.
To repeat or reverse the search, just use n or N as you normally would.
Splitting the VIM screen
You can view multiple files or sections of files simultaneously in a single instance of VIM.
To split the current file into two panes, type :sp.
Switching panes is done by typing ^W^W (ctrl-w ctrl-w).
To split the screen into two panes with a different file in the new pane, just add the filename after the split command (e.g. :sp myFile).
VIM will normally split the screen equally, but you can specify the size of the new pane with a number before the command (e.g. :10sp for a ten line pane).
The normal split command splits the screen horizontally. VIM 6 adds a new vertical split command (:vsp) with the same functionality.

VIM Macros

Macros are key bindings you can place in your .vimrc file to add functionality.
Searching for a highlighted string
To search for a highlighted string just as you would search for the word under the cursor, use the following macros:
vnoremap * y/<C-R>=substitute(escape(@@,"/\\"),"\n","\\\\n","ge")<CR><CR> 
vnoremap # y?<C-R>=substitute(escape(@@,"?\\"),"\n","\\\\n","ge")<CR><CR>
You may now select text in visual mode (e.g. by typing v or using the mouse) and use * and # as described in the General Tips above.

Happy Vimming!


This page is VIM powered!  Click here for the VIM home page. Return to Mark's homepage

( [ Click here to reveal. ] [ Click here to reveal. ] )
Last modified: 2003-09-10 22:52:07 Central Daylight Time