Welcome to my Vim Page. Herein you'll find a number of scripts, some source
code (needs compiling, but I do have pre-compiled executables for you PC
types), and Vim syntax files. If you'd like to know more about Vim, check out
Vim Online.
The syntax files below are often snapshots of my working copies, so sometimes they
may be works-in-progress. Usually such files will say ASTRO-ONLY
somewhere in the top four lines of the file. In any case, the scripts here
will be more up-to-date than the versions, if any, that I put on vim.sf.net.
Nearly all scripts herein will be using the vimball archive format (*.vba
files) which first became available with vim 7.0 -- it provides for better
installation and automatic helptag generation. If there's a "vba" suffix,
you'll need vim 7.0 or later! Vim 7.0 users, however, do need to get a new
version of (vimball);
vim 7.1 users already have a sufficiently up-to-date version of vimball.
Layout:
This admittedly long page is organized into the following format: Contents,
Subpages, and Links. Subpages, which cover specific topics, are separated by
horizontal lines and have links to the Contents and Links at their bottom
right. A few subpages also provide links to more complete webpages (ex. "Color Scheme").
Typically subpages will also provide a link to "Links" in or near
their first sentence; this Link goes near where the associated script, code,
etc is in the Links section.
Normally with abbreviations one has to type a space to kick off the
abbreviation. I wanted to put in stub-like bits of code for common C
constructs such as if, for, etc. Well, instead of an abbreviation, I rather
like the following solution: use an inoremap on
"`"
and have it examine the previous word to decide
what to do. If you'd like to try it out, click on Dr Chip's C Abbreviations
(also listed as Stubs).
Shorthand
Longhand
Map
Map
i`
if`
e`
else`
ei`
elif`
f`
for`
w`
while`
s`
switch`
c`
case`
d`
default`
do`
There are also maps for E`, R`, and D` which generate DrChip's debugger calls.
This approach allows your cinoptions to be effective, so you get the
indentation style you prefer (abbreviations prevent this). So,
if you use my stubs file, you probably should set the cino option. That way
the stub will be indented in your style. I've included a copy of my cinoptions below;
feel free to incorporate them (my style is the best, of course!) and change them as
you will (aw, shucks).
set cino=>s,e0,n0,f0,{0,}4,^-1s,:0,=s,g0,h1s,p2,t0,+2,(2,)20,*30
>s
add 1 shiftwidth on normal indent
e0
add 0 to prevailing-indent if '{' not at start-of-line
n0
add 0 to prevailing-indent for statements after if/while/etc, if statements not inside {}
f0
first opening { of a function/block is placed in column 0
{0
opening braces are placed 0 characters from prevailing indent
}4
closing braces are placed 4 characters from the matching opening {'s indent
^-1s
add -1 space to prevailing-indent if opening brace is in column 0
:0
case labels are placed 0 characters from switch()'s indent
=s
statements after a case label are placed 1 shiftwidth from indent of label
g0
c++ scope (public, private, etc) placed 0 chars from indent of block they're in
h1s
c++ statements after public/private/etc 1shiftwidth in
p2
k&r function-argument parameter declarations placed 2chars in from margin
t0
types for function declaration indented flush with margin
+2
continuation lines (split lines) are indented an additional 2 spaces
(2
when in unclosed parentheses, indent two spaces
)20
unclosed parentheses will be searched for at most 20 lines away
*30
unclosed comments will be searched for 30 lines away
The <ccb> program
(get ccb source here)
beautifies C and C++ code.
Be careful -- this program does change indentation and can move curly braces
around, but if it still has a bad bug, it could damage your source if you use
the -r flag (replace). That's why
this program is labelled Use At Your Own Risk!.
The -s flag is much safer; it saves
the beautified versions in *.cb files. Make sure that the beautified source is
ok before doing anything irretrievable with your original source code. That
said, it does work for me, and normally produces output close to my own
preferred style. The "standard" cb style can be obtained with -cdfi. Now that I've released it to the World, I
expect some bug reports to crop up (hopefully no really awful ones).
ccb has been on my website since May 25, 2000 with no runtime bugs reported!
Intro: Flist
is a program which does a number of things with C/C++ source files' functions: use it to generate
listings of functions, prototypes, calling trees, tags, and more (
get flist source here)! You may find the maps in
flistmaps a help in using flist with the
current file in Vim.
Hints: Flist's -h option makes <hints> files.
After you've used flist to generate your hints file, just source it into
your editing session or put the following code into your
<.vimrc> for automatic sourcing of hints:
if filereadable(expand("hints"))
au BufNewFile,BufReadPost *.c,*.C,*.cpp,*.CPP,*.cxx so hints<CR>
endif
The result? Every time you type a function name, a prototype for it will
appear on the information line. In order to see it, you should set your
cmdheight to 2 or more (:set ch=2) and possibly have showmode off (:set nosmd).
Maps: Along with flist itself I've
provided a small set of maps which use flist. The maps take the form
\[px][pxgs]: prototype or extern, and prototype, extern, global, and static.
The map invokes flist against the current file and inserts a list of
(global/static/both) prototypes or extern-style function declarations. The \pc
map inserts a list of prototypes suitable for inclusion in a comment.
Source Trees: Flist's -Tg option builds a tree-like graph of function use.
Coupled with the Flist-based Tree plugin for vim 6.0 or later,
one can browse the calling tree on the left hand side of the screen,
select a function to edit by putting the cursor on its line, and hitting
return. Put <FlistTree.vim> into your plugin directory; you may then use the
command :Flist [filename(s)] to begin graph-tree editing. See the
usage notes in <FlistTree.vim> for more commands! Click for a
screenshot if you'd
like to see it first.
Dummy Functions: Flist includes a -D option, which generates "dummy" function
definitions. In order to make trees, flist makes a pass over all the source
files to determine what functions are present, and then a second pass to
determine what functions are called by what functions. Thus common functions
(such as printf) are ignored, and the structure of your program is usually
better revealed. However, if you want to know where such functions are called,
or functions that were defined in your own personal library, you may wish
to set up a <dummy.c> file containing a list of such functions with no
body (or even arguments). That way flist will process the dummy file
quickly. The -D option allows one to generate such a dummy file easily
from real ones.
I've included Vim-script which implements my choice for syntax
highlighting. Please check out my page on DrChip's colorscheme
for the colorscheme I use. I like keeping the same colorscheme for both
gui (gvim) and console (vim); the latter restricts the number of colors available, so such dual-use
colorschemes must needs be designed for the limitations of the console.
Ever wished to convert a list of words into a multi-column list (such as
ls produces)? Mcol will do that
for you (see below), and check out some of my mcol-using scripts.
+---------+------------------------------------------------------+
|Original | Using ma on "one", moving to "six", and typing \mn3|
|List | map \mn3 0!'amcol -n3<CR> |
+---------+------------------------------------------------------+
|one | |
|two | |
|three | one three five |
|four | two four six |
|five | |
|six | |
+---------+------------------------------------------------------+
I've included some pre-compiled executables for the PC for which I used a Borland
C/C++ compiler (under Miscellaneous in the Links).
As a bonus, I've thrown in my calculator program, too. You should
still get the source code distributions; if you have ansi escape sequences enabled
for your MS-DOS windows, and have <rdcolor.dat>, prompts and help will come
up in color. The copyright notices associated with the source distributions also
still apply to the executables.
If you've gotten here, I'm sure you realize that Vim has a large
number of commands -- that is, commands that one can do while
in normal mode. That's not counting the command mode commands!
Check out the Real Short Vim Normal-Mode List of Commands.
The English spelling checker
(under Scripts in the Links)
uses Vim's native syntax highlighting ability to make
misspelled (English) words show up as an "Error" (usually white on a red
background). Vim 7.0 introduced a built-in spelling checker with many
features based on those engspchk provided; however, engspchk is still
good for those of you still using earlier versions of vim.
The Vim-based English spell checker also supports entering words
that the cursor is on into a temporary or permanent dictionary and allows one
to skip to the previous or subsequent spelling error (if any). It co-exists
quite well with TeX, LaTeX, Html, and other such specialized text, and can
be used to check the spelling inside comments in various programming languages.
Getting Started:
The English spelling checker now comes as a "tarball":
gunzip the file <engspchk.tar.gz> and
tar -oxvf engspchk.tar in the .vim or _vimfiles
directory.
The English spelling checker is a plugin; it
does a quick load and makes a map for \ec (actually the \
is <Leader> which can be changed; see :he mapleader).
The dictionary isn't loaded until one types \ec.
It also creates a menu item to load the spelling checker for gvim
(the gui).
The custom user dictionary and optional Webster's 1913 dictionary
is stored using the path specified by the vim variable g:cvimsyn,
settable in the <.vimrc>.
If that variable isn't set, then the CVIMSYN environment
variable, if it exists, is used.
If you want to use the environment variable approach:
sh
CVIMSYN="path";export CVIMSYN
csh
setenv CVIMSYN "path"
ksh
export CVIMSYN="path"
Windows 95,98
in <autoexec.bat>:
set CVIMSYN=..path..
Windows 2000,NT,etc
Right click on <My Computer>
Choose <Properties>
Click <System Properties>
Click <Advanced> tab
Moving:
For Vim versions 5.04 and later, the <engspchk.vim>
file additionally provides two maps (\en and \ep) to move to the next and preceding
spelling error, if any. I suggest you upgrade if you haven't already, because
Vim's functions are powerful!
Custom Dictionary:
Engspchk allows the user to temporarily save (\et) or to
permanently save (\es) words the user uses but somehow isn't in
Engspchk's dictionary. A temporary save only affects the current
vim editing session; a permanent save writes the word to a custom user dictionary
which is automatically loaded in the future.
Alternatives:
For Vim version 6.0 and later, <engspchk.vim>
provides the (\ea) map which brings up a one-line alternatives window for the
word under the cursor. Move left and right with the full power of Vim, and
when the cursor lies on the desired substitute word, a simple carriage return
will cause replacement. You'll also need to have the
agrep
program to do this (there's a pre-compiled for Windows version available using
this link). The first use of (\ea)
takes longer than subsequent use because the script that gets invoked constructs
a plain list of words from the engspchk file.
No Flashing:
With Vim version 6.0y and later and starting with version 2.04 of
engspchk no longer will Error highlighting flash on and off while you're
typing. Thanks go to Chase Tingley (with emendations by Bram Moolenaar) who
wrote the changes to Vim to make this possible.
More Words: Previously the
<wb1913_engspchk.vim> file was provided separately, but it is
now provided in the <engsphck.tar.gz> tarball. still optional if you'd
rather not load it. Webster has provided an electronic copy of the words from
its 1913 edition; those words that appear in that dictionary that don't appear
in <engspchk.vim>'s dictionary itself are provided in the
<wb1913_engsphck.vim> file. If the file appears in the directory
specified by the g:cvimsyn variable (or by the CVIMSYN environment variable)
then it is loaded automatically.
Languages other than English: There are now variants of
<engspchk.vim> for Dutch, German, Hungarian, Polish, and Yiddish. Engspchk
has been improved so that mostly all that's needed are the dictionaries themselves.
I'd appreciate it if you could let me know where on the Web to find it so I can make a link on
this page to it!
Since vim 7.0 and later now includes embedded spell checking, I've removed
most of the spelling dictionaries. If someone is still interested, please
send me an email (NdrOchip@ScampbellPfamily.AbizM - NOSPAM) and I'll send
you a copy. Unfortunately, I'm limited on my webspace, and I needed the
space! I have dictionaries for Dutch, French, German, Hungarian, Italian,
Polish, Russian, and Spanish.
I have written my own tag generating program (get source for hdrtag here);
although Exuberant Ctags is good, I know how to modify hdrtag
to suit me. It contains tagging generation for C/C++, C/C++ header files,
lex, yacc, TeX (cites and labels), vim scripts (functions and syntax), and Maple V.
Exuberant Ctags will no longer be distributed with vim as of v6.0i. I've provided
a link to its home site here.
The alignment scripts (<Align.vim> and <AlignMaps.vim>) now supplant
the older external filter approach. The new scripts, which include help and
plentiful examples, provide:
cyclic left, right, and centering justification of fields
cyclic or equivalent regular-expression separators
cyclic left, right, and centering of multi-length separators
improved initial white space control: retain, eliminate, re-use first
specifiable separator padding
visual range specified alignment, including via visual-block
multiple maps in <AlignMaps.vim> which tackle complex
alignment problems, such as aligning C/C++ declarations,
function argument lists, etc.
See my DrChip's Alignment Tool for Vim page for links and examples.
An alternative aligner is available from
Gergely Kontra
(Johannes Zellner used to have one available, but apparently his site has disappeared).
Determining the highlight group that the word under the cursor belongs to nmap<silent><F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
VIM 7.0 USERS: BE SURE TO GET THE LATEST VIMBALL PLUGIN BEFORE ATTEMPTING TO USE SCRIPTS UPLOADED ON OR AFTER AUG 1, 2006
Various functions, plug-ins, and quick-insertion stubs follow alphabetically. There are several
plugins that I post both here and at vim.sf.net.
Scripts here are my most up-to-date ones and may be considered as alpha/beta releases;
I tend to put the ones I'm updating/fixing here. After a bit of feedback, and a variable length
of time (ie. whenever I get around to it), I will also post the scripts on
vim.sf.net.
Most plugins here are provided in the vimball format; simply use vim name_of_plugin.vba.gz
and follow the directions. Windows users may not have a gunzip utility; if you're a Windows user,
you'll need to get one if you don't have one already.
Then type :so %; this runs the vimball utility and distributes the components of the plugins where they belong. It also enables help via vim's help facility for the plugin (ex. :help netrw).
I use three release states with my plugins:
NOT RELEASED -- my latest version (labelled v[0-9]*[a-z], ex. v3b).
These versions may be handed out to individuals while I'm
attempting to debug some problem they're having. The version
number will remain fixed while the plugin is in this state.
These versions of my plugins shouldn't get generally
released, but accidents happen.
ASTRO-ONLY -- a somewhat experimental version of a plugin, like
"NOT RELEASED" versions, also labelled with a trailing
letter such as v[0-9]*[a-z] (ex. v3b). These versions
do have their trailing letter changed as they get
updated. These versions appear on this website.
(nothing) -- the plugin has been released on vim.sf.net
and concurrently on this website. These versions also drop the trailing
letter, having the format v[0-9]* (ex. v3). Those plugins which Bram has
picked up for distribution with Vim have also been forwarded to Bram.
Thus v1a is ASTRO-ONLY or possibly NOT RELEASED; v3 is RELEASED.
In other words, I use the ASTRO-ONLY stage as an alpha/beta release, and NOT
RELEASED as an alpha. This process is supposed to help get the bugs out before
the plugin is potentially released to thousands.
If you have some feedback (problems or kudos!), please send an email to NdrOchip@ScampbellPfamily.AbizM
(remove the embedded NOSPAM therein first, of course).
(this plugin is superceded by vim 7.x, which looks into after/syntax subdirectories on its own)
Several directories, such as .vim/after/syntax, allows multiple files
therein but vim does not look into sudirectories therein. By copying this
file to such a directory, and renaming it using the subdirectory name + ".vim",
the subdirectory name will be scanned for any and all *.vim files and such
files will be loaded.
Also available at vim.sf.net where you may rank it.
IF YOU DON'T CARE ABOUT VIM AND GVIM USING THE SAME COLORS, THIS COLORSCHEME IS NOT FOR YOU!!! (guess I'm tired of those who complain about the use of only 8 colors...)
This colorscheme is a dark-background style colorscheme with the
advantage that it works with console/terminal vim in the same way that
it works with GUI vim. Thus it is restricted to using just the basic
eight colors that many xterms are limited to. The <astronaut.vim>
file gives you the dark background colorscheme I prefer and use. If
you'd like to see a preview, check this out, and see check out DrChip's colorscheme.
Aligns text based on patterns (see this page for more!). The vimball for this plugin contains both Align and AlignMaps;
the latter is for most users' convenience. If you're one who wishes not to have AlignMaps, the :AlignMapsClean command will remove the
AlignMaps plugin from your installation.
NOTICE: The latest version of Align and AlignMaps given here need vim 7.0aa.
Also available at vim.sf.net where you may rank it.
This plugin follows Ansi-escape sequences to colorize subsequent text using vim's syntax highlighting engine.
The AnsiEsc plugin provides a single command: :AnsiEsc ,
which will toggle Ansi-escape sequence processing.
When enabled, AnsiEsc will handle <esc>[FGm,
<esc>[ATTR;FGm, and <esc>[FG;BGm sequences;
subsequent text will then be colored appropriately.
With vim 7.2 and earlier, the escape sequence itself will take space but will be suppressed using "Ignore" highlighting.
Vim 7.3 comes with Vince Negri's conceal/ownsyntax capabilities built-in. With it, Ansi-escape sequences
will have their colorizing effects but will themselves be concealed (again, when AnsiEsc is enabled and
one has used set conceallevel=[2 or 3]).
Also available at vim.sf.net
where you may rank it.
Supports automatic sourcing (loading) of functions as needed. AsNeeded.vim is a plugin
that sources other scripts in the .vim/AsNeeded directory when a function is called
that is needed. One may use :AsNeeded command or :AN command. AsNeeded actually
supports as-needed sourcing for functions, maps, and commands.
Blockhl controls the highlighting of leading tabs based on the nesting level of {}s
for the C and C++ languages by providing a sequence of graylevels.
The file should be put into the .../after/syntax/c directory.
Used by visincr.vim (which is described
below), <calutil.vim> provides three calendar-related functions:
DayOfWeek(y,m,d), Cal2Jul(y,m,d), and Jul2Cal(julday). DayOfWeek() converts a date
to a day of week name, and the other two convert between dates and the Julian day.
Visual-block select a region of text containing a matrix of numbers, and type :MatSet MatrixName (ex. :MatSet A)
:Mat matrix-expression (for example, :Mat D=(A+B)/C, or :Mat 1/E)
:MatWrite matrix-expression (ex. :MatWrite D which will write the D matrix after the current line in the text)
Uses the Align and cecutil plugins; Align isn't strictly necessary, although cecmatrix will produce
nicer output with it; cecutil is provided along with cecmatrix.
(vim v7.0 only) Cscope interface to find functions which call functions,
are called by functions, etc. Put in your .vim/plugin directory, and
try :CSh for help. There's optional local quickfix windows, vertical
or horizontal window with cscope output, menus, etc.
The compiling.vim plugin
provides error format files for several C compilers, plus
a :Chk command to show one window with source with lines with errors and warnings
given Error highlighting and a quickfix window showing the associated messages.
An explorer for tags files generated by exuberant ctags; much like
Lakshmanan's taglist explorer. However,
CtagExpl cooperates with gdbmgr, providing it with a tags-based explorer.
When one does "cvs update", one may get files marked with "C" for
conflict. Cvs was unable to automatically merge one's local
version with the repository, and merging requires human intervention.
The :CVSconflict command takes the current conflict file,
splits it into two separate files, and enables vimdiff-style
editing and viewing.
The Decho.vim plugin provides debugging messages in a separate window.
One puts
Decho "some message here"
-or-
call Decho("another message")
and Decho will split the screen with a five line debugging window on the
bottom of the display where the messages will appear. Allows one to
inspect multiple error messages with the usual vim editing commands!
Decho can optionally redirect its messages to a separate dedicated tab,
to Vim's messages list, or to a "remote" vim.
More help and commands are available - see their descriptions Decho's manual.
Facilitates setting up aligned columns with user-specified fill-characters. Often used with contents
pages. Example of usage: :[range]DotFill . (to fill with dots)
A plugin for drawing vertical, horizontal, and slanted lines using text.
With DrawIt, one may use the number pad to leave a trail of dashes,
bars, etc behind. Furthermore, it also supports using visual-block specified regions
to draw boxes, ellipses, arrowheads, lines, and to specify floods.
New: DrawIt has two new commands, :DIsngl and :DIdbl, that tell DrawIt to draw boxes using
utf-8 box characters (single-bar, double-bar). Your current file needs to be using the
utf-8 encoding for this to work.
Also available at vim.sf.net
where you may rank it. The version here requires vim 7.0!!!
Supports quick entry of language constructs for C, sh/ksh/bash, LaTeX, and vim.
Ie. while in insert mode and using C, a if` will result in
a if(){} construct entered into your code with the
cursor appropriately positioned for further insertion. When done with entering
the test expression, hitting <esc> will place your cursor (in insert mode)
after the "{". (also see Abbreviations for C)
The foldcol plugin, when used with vim 7.3, makes it possible to fold columns of text from view (using the conceal feature).
Also available at vim.sf.net where you may rank it.
Permits searches to be taken only within a function, as
defined by [[ (for start of function) and ][ (for end of function). These normal
commands may, of course, be defined as maps in the ftplugin directory to customize
them for specific languages.
Requirements: linux and a "huge" vim
Gdbmgr has two main components: a plugin portion, which provides an interface for the user, and the second component, written in C, which provides communications between vim and gdb.
Gdbmgr works with core dumps, utilizes hovering-cursor balloons to reveal variables' values, and provides a runtime interface to your program via gdb and vim.
It doesn't touch vim's source code (no patches!) or need external interpreters, unlike several other ways to get vim and gdb to work together.
GdbMgr provides an interface between vim and gdb: no patches!
No external interpreters are used (ie. no perl, no python, no ruby, ...)
Uses gcc to compile the component written in "C"
GdbMgr requires a "huge" vim (configure --with-features=huge) with one or more of the following choices:
configure: --enable-perlinterp
configure: --enable-pythoninterp
have in Makefile: EXTRA_LIBS=-lutil
Integrated multi-window displays available include: Assembly, Breakpoints, Expressions, Function Stack, Messages, Source, Threads, and Watchpoints; it also supports
in an integrated fashion "foreign apps": Netrw, CtagExpl, HdrTag,
and bufexplorer (thanks go to Jeff Lanzarotta for the last!).
Customizable display (one may pick any subset of the integrated windows available and specify how they're to be displayed and/or stacked).
Snapshot 1
This snapshot shows GdbMgr with a breakpoint and a temporary breakpoint in prog7's Func2() function.
Snapshot 2
This snapshot shows GdbMgr with the Command window having had a dialog with the user (ie. "Enter something:", user entered "OK<cr>", etc.
The program has run to completion.
Its distributed as a gzipped tarball instead of the vimball format usually used here as it contains some binaries (the two xpm files for the breakpoint signs)
Currently tested only under Linux; it definitely does need a Unix-like environment. I need a mac person to tell me how to get a shared library working on the
Mac. I've included a first cut at it with Makefile.mac (under .vim/gdbmgr/src)
Integration with vim and gdb is provided by the plugin itself via vim's libcall() function and a small shared library written in C (code provided)
At the current time, gdbmgr has moved from alpha to beta (ie. majoring in bug removal, minoring in new features; its been working well lately).
Please let me know if you experience problems (my email address is at the top of gdbmgr.vim).
This plugin's :GetLatestVimScripts command (or :GLVS for short)
will automate grabbing the latest version of the plugins and scripts that you
express an interest in by putting a line into the GetScript/GetScript.dat
file. With cooperating plugins, GetScript can build the data file itself, too.
Unfortunately, there was a bug that makes the getscript.vim version that was distributed with vim v7.0
cause difficulties with a vimball-installation of a new getscript.vim. So, you'll need to remove
the older version of getscript.vim:
Change directory to the directory holding the vim 7.0 distribution's plugin/ and autoload/ directories.
Gvim colors -- displays a list of named colors that gvim has available
with X; each color shows up in its own color! One can toggle between dark and bright backgrounds
by using a rightmouse click. A leftmouse click on a color brings it to the
top line of the display. The colors at the top of the display have their
red-green-blue values, in decimal, on the bottom of the screen.
Explore tags in a left-hand window with the :Hdrtag command.
Intended to support the hdrtag program by providing
a taglist-like interface for it.
A screenshot: Hdrtag Snapshot.
In this screenshot, the cursor was first put on the "fdputs" label showing
under "funcname"; a <CR> was then pressed. The cursor ended up in
the source window where "fdputs" was defined.
Highlights marks by using the signs feature (your vim needs to be compiled for big/huge).
Required: Kruize and Gedde's ShowMarks.vim plugin, which does most of the work. Its at
vim.sf.net .
Shows a balloon containing a prototype when hovering over a function name.
Assumes that one has tagged prototypes as it uses vim's taglist() function and that your vim was compiled with the +balloon_eval feature.
A plugin which traces the highlighting linkages; ie. just what highlighting
groups associated with the word under the cursor? Plus, when :HLT! is used
to invoke hilight.vim, one gets syntax highlighting updates as one moves
the cursor.
A Vim 6.0 plugin that highlights a matching bracket when the cursor moves on it: (){}[] (actually the |'matchpairs'| option is used).
The matching bracket is highlighted when the cursor is moved on top of the bracket.
It does so by making a fair number of maps that intercept the requested motion, perform the requested motion,
then also call the HiMatchBracket() function which does the work to highlight any matching bracket.
Basically it does a "%" to find the matching bracket (if any) and then constructs and executes an appropriate ":match" command.
Version 12 supports overloading of 0, too (if you have vim6.2 and patch 405 or later).
Because vim is rich with commands that can move the cursor, the script also uses the CursorHold event
(see help for cursorhold and updatetime) to highlight matching brackets after the cursor is left still for awhile.
Uses vim's signs support to signify indentation level, akin to Notepad++.
Really easy to use: :IndGuide to enable, and :IndGuide! to disable.
However, your vim does need to support the signs feature (:version should show +signs); try compiling vim for the "huge" feature.
Allows one to retain a window layout by "killing" a window rather than by deleting it.
Uses enew to generate a new but empty buffer in the stead of whatever the window had
been showing. Kwbd will delete the buffer (if its only showing in the window being
handled).
Sets up a "DrChip.TexSymbols" menu full of various symbols that LaTeX supports; it works in insert mode,
and when selected, inserts the appropriate LaTeX code to produce the selected symbol.
Allows much quicker editing of large files (default: 100MB+ are "large"), at the price of turning
off events, undo, syntax highlighting, etc.
Also available at vim.sf.net
where you may rank it.
Latex Package Support
Syntax/tex.vim should not support packages' macros, environments, etc.; the following give support for some packages that I myself use or has been contributed for distribution.
Typically these support packages' syntax by putting special syntax handling file in $HOME/.vim/after/syntax/tex/ .
This plugin uses the "nm" utility to present an overview of the contents of archive and object files.
Its based on autocmds, and so to use it all one needs do is to open an archive (*.a), an object (*.o) file,
or a shared library (*.so) by attempting to edit it. (formerly known as the archive/object visualizer)
Use ":echo Maintainer" to find
out who the maintainer is of the syntax file you're
currently using; ":echo Maintainer("language")"
to determine the Maintainer of a specific language (ie. c, vim, tex, jsp, etc).
A plugin which facilitates the viewing of man pages under Unix systems;
supports :Man topic, :Man topic booknumber, :Man booknumber topic, and
:Man topic(booknumber). While in a man page the K key will invoke manpaging
on the word under the cursor.
Also available at vim.sf.net
where you may rank it. Supports perl (*.pl, *.upl) and info (*.i), too.
This tarball contains multiple files to support MapleSoft's Maple programming
language for symbolic algebra. Included: indent, auto-align, and matchit support.
Contains a keymap supporting math under utf-8. Install in the regular vimball way; to use it, ":set kmp=math" when in vim.
Use visual mode to select one or more digits: pressing "_" will make the digit(s) into a subscript(s), and pressing "^" will make them into
a superscript(s). Use visual mode to select alphameric character(s) and pressing "&", for example, will make them into corresponding Greek
character(s); similarly, can do use "_" to make characters into subscripts and "^" to make glyphs into superscripts.
See this screenshot for an example (a portion of a comment in a C program is shown
using font Luxi Mono, Regular, size 10pts).
The mcol.vim plugin
converts a list of words into a multi-column listing, much as "ls" does with a list of files.
It uses the mcol program; see mcol to get a copy of the source.
The mpage.vim plugin supports using multiple windows as separate pages to view a buffer (ie. file), with each
window under mpage control sequentially showing lines of text.
Supports network-oriented editing with urls. One may read and write files
using one of several supported protocols (ex: ftp, scp) and browse
directories, both remotely and locally. This version requires vim 7.0.
Be sure to remove any older versions of netrw before attempting to install this version.
In version v142b of netrw, g:netrw_winsize's meaning has been changed. Previously, it was the number of
rows or lines to be used for new windows spawned off of netrw (ex. when using v or o). The new
method uses g:netrw_winsize as a percentage of the netrw's window size in the appropriate direction
(ie. winheight or winwidth). The percentage is an integer (by default, it is 50).
Beginning with v108b of netrw: sourcing remote files is supported.
Here's a list of some netrw options that I myself use:
let g:netrw_altv = 1
let g:netrw_fastbrowse = 2
let g:netrw_keepdir = 0
let g:netrw_liststyle = 2
let g:netrw_retmap = 1
let g:netrw_silent = 1
let g:netrw_special_syntax= 1
The netrwclean.vim plugin will attempt to remove the netrw plugin: with :NetrwClean, only the personal directory copy
will be cleaned. With :NetrwClean!, this plugin will attempt to remove netrw from both your personal directory
and the system directory. You need permission to remove such files, of course. This plugin may be helpful
for those who've previously gotten an up-to-date version of netrw but then update their vim later via ftp, cvs, etc
with an even more recent version of netrw (in that case, use :NetrwClean).
The pchk.vim plugin provides a testing framework for plugins; it requires +clientserver to work.
The idea: edit a test file, then use :PChkTry on it. Commands in the test file are sent to the remote
gvim to execute; occasionally, when :PChkSnapshot is encountered, a hash of the remote gvim's windows, tabs, etc
is made and sent back to the originating (client) gvim. Subsequently, instead of using :PChkTry, a :PChk wil
do the same, but compare stored snapshot hashes with the current hashes (results are stored in Expected/testfilename.out).
C and C++: this plugin provides a rainbow of colors for matching brackets ( [] () {} ) depending
on their nesting level. One may choose any subset of these brackets for highlighting. Lisp: The syntax file distributed with Vim for Lisp already supports rainbow highlighting of ()s; bring up vim and
type ":help ft-lisp-syntax". Matlab: this plugin provides rainbow highlighting for if for switch while,
again, depending on their nesting level. One may choose any subset of these regions for highlighting, too. LaTeX: this plugin provides rainbow highlighting depending on brace depth "{}()[]", begin-end depth, and dollar depth.
This mode is somewhat ugly, but I've found it very useful for finding problems in LaTeX scripts.
Uses the BufNewFile event, stub files located in a common directory,
and an environment variable $STUB to point to that directory. Editing
a new file with vim will cause ReadStub to attempt to initialize the
file with the associated stub text (based on suffix). Some common
substitutes are also made, such as STUBDATE changed to the current date.
Shows relative numbering signs (ie. relative to the cursor's current position).
Really easy to use: :RltvNmbr to enable, and :RltvNmbr! to disable.
However, your vim does need to support the signs feature (:version should show +signs); try compiling vim for the "huge" feature.
:[range]RunView[!] filtercmd
{visual line selection}\rh
{visual line selection}\rv
RunView passes user-selected lines through a filter (default filter specified by
g:runview_filtcmd); output from the filter is placed into a separate window.
Multiple runs of the filter are clearly separated in the filter output window.
Great for debugging scripts!
This package of a plugin and ftplugins manipulates the status line to show the name of the current function that
the cursor is in. Currently supported: C, C++, DrChip's debugger output, Maple V, Matlab, Perl, Shell (Korn, Bash), Tex, and Vim.
The synchk.vim plugin helps syntax highlighting plugin writers to
maintain their syntax highlighting plugin(s). Typical use involves
manually inspecting a test file to insure that its being highlighted
correctly; once that is so, run |:MakeSynChk| on it. This operation
will save information on the current syntax highlighting;
subsequently, after changes have been made to the syntax file,
one may run |:SynChk| to verify that the highlighting
has not changed.
Michael Toren wrote a nice plugin to handle tar files.
I've written a related one that also handles writing changed files back into the tarball.
Unfortunately, there was a bug that makes the zip.vim version that was distributed with vim v7.0
cause difficulties with a vimball-installation of a new zip.vim. So, you'll need to remove
the older version of zip.vim:
Change directory to the directory holding the vim 7.0 distribution's plugin/ and autoload/ directories.
When vim gives an error message while running a plugin, it gives a function name and a line number
which is relative to the function's beginning. This plugin provides ":VEF funcname rel_line_num",
which preferentially jumps to the function in the current buffer (but will use tags to find the
function's source file otherwise).
Archive and de-archive vim plugins. To install:
well, I've decided that the vimball plugin itself should not expect that vimball is available to extract itself.
Hence, it is now being distributed as vimball.tar.gz. To unravel and install it:
Change directory to the directory holding the plugin/ and autoload/ directories where you want to install vimball.
It is probably best to install the new vimball in the distribution directory. If you choose not to overwrite the
version that came with the plugin, but to put the new vimball in your personal directories, you must remove or otherwise
deactivate the original version that came with vim 7.0.
If you'd like to use a C program (you'll need a C compiler) that will create vimballs: mkvimball.
For beginners, may I suggest:
You should have a .vim/ or vimfiles\ in your home directory. Bring up vim, then type :echo &rtp. The first directory on that
comma separated list is where vim expects to find your .vim/ (or vimfiles\) directory.
You should have, as a minimum, the following two lines in your <.vimrc> to enable plugins:
Performs an Ex command on a ctrl-v highlighted block.
I often use it to target substitutes onto just a visual-block selection.
The original <vis.vim> was by Stefan Roemer, but this one
has been radically modified to support embedded tabs. It appears to operate
considerably faster, and has no side effects on register usage, etc.
It requires DrC's Utilities as it
also retains the original cursor/window positioning using functions from
that package.
Transforms a ctrl-v selected visual-block of numbers into an incremented
list of numbers. The first line's number initializes the incrementation. The
updated <visincr.vim> now uses virtual column information to allow leading
tabs, handles ragged right visual blocks, will insert spaces as needed if
the count's string-length exceeds the visual-block's constraints, and also
accepts an optional incrementation argument (I [incr]) (which can be negative).
By default incr is 1. If the initial number is zero-padded on the left (ie. 001),
then the column of numbers will also be zero-padded as needed. For the maps
which handle dates, you'll also need to have
calutil.vba.gz.
I [incr] - create an ascending or descending column of numbers, right padded
II [incr [zfill]] - create an ascending or descending column of numbers, left padded
IA [incr] - create an ascending or descending alphabetic column
ID [incr] - create an ascending or descending column of daynames
IYMD [incr] - create an ascending or descending column of year/month/day dates
IMDY [incr] - create an ascending or descending column of month/day/year dates
IDMY [incr] - create an ascending or descending column of day/month/year dates
The :R... versions (:RI :RII :RIYMD etc) restrict the renumbering/relabelling to
those lines which have an appropriate pattern (numbers for :RI and :RII, daynames
for :RID, etc).
Also available at vim.sf.net
where you may rank it.
Select first region using a visual mode (V, v, or ctrl-v), then press <ctrl-y> ("yank").
Select second region using a visual mode (V, v, or ctrl-v), then press <ctrl-x> ("exchange").
HelpExtractor technology is used to automatically install help for vswap.
There's also a tip about more swapping at Tip#329
In addition, one may replace columns of text with a selection:
Select source region using visual-block (ctrl-v) selection plus motion.
Hit <escape>
Move cursor to where the upper left corner of the column replacement should be; hit \vr
(the backslash is actually <Leader>)
:[range]Vissort - sort lines based on the visual block (ctrl-v) portion. The idea is that one
visual-block selects a column and applies :Vissort to sort the lines based on that column.
:range]BS nextblock endblock findtag tagpat tagsub - (Block Sort) sort blocks of text based on
tags contained within the blocks
To sort a column of text (just the column, not the associated line), use
the :B command provided in vis.vim
Ever wonder where a function, script, or command was defined, or where a setting
was last set? WhereFrom helps answer the question. :WhereFrom[!] {function|map|setting|command}
(or :WF[!] {function|map|setting|command} for a shorter command) will search the runtimepath
to determine where the item was defined. The optional "!" will make WhereFrom
continue looking for more than one instance -- the last one found is likely to be
the one you have currently loaded.
Zip Handler handles zip files; it resembles Tar Handler in look and feel.
It handles browsing, reading, and writing files.
Unfortunately, there was a bug that makes the zip.vim version that was distributed with vim v7.0
cause difficulties with a vimball-installation of a new zip.vim. So, you'll need to remove
the older version of zip.vim:
Change directory to the directory holding the vim 7.0 distribution's plugin/ and autoload/ directories.
Provides the ability to zoom into/out-of a window
(by Ron Aaron and C Campbell), similar to what the editor Brief provided. Version 14 was both
about 2/3 the size and faster, and the latest handles quickfix windows, too.
Also available at vim.sf.net
where you may rank it.