Notes/VimPow3r

edit
revisions

what's new
search
help

kiwi


Vim power

Vim is a really nice and powerful editor, to which I always go back after trying other stuff (lately, I was using JEdit, but was disappointed by its size and overall slowness plus a few glitches on OSX.

This pages describes the plugins I use in my Vim configuration, which looks like this:

Attach:vim-screenshot.jpg Δ

Plugins

Python plugin displays a menu for python files. Installation is really easy:

 cp python.vim ~/.vim/plugin/python.vim
 echo ':au FileType? python source ~/.vim/plugin/python.vim' >> ~/.vimrc

Mini buffer explorer is a simple plugin that adds a tab-like buffer at top which lists and allows to select current buffers. To install, simply drop the minibufexpl.vim file into the ~/.vim/plugins directory.

This plugin also provides some useful bindings, which are accessible by the following commands (to add to your ~/.vimrc file):

  • let g:miniBufExplMapWindowNavVim = 1, lets you navigate the buffers with Ctrl+{j,k,l,m}.
  • let g:miniBufExplMapWindowNavArrows = 1, lets you navigate the buffers with Ctrl+{left,up,down,right}.
  • let g:miniBufExplMapCTabSwitchBuffs = 1, lets you use Ctrl+Tab or Shift+Control+Tab to switch to the next buffer.

Sessions plugin that allows to store sessions. It is useful when you want to store a set of files for a specific project. To install, simply drop the sessions.vim file into your ~/.vim/plugin directory and create a ~/.vim/sessions directory.

You now have the following commands:

  • :SN to create a new session (a name must be given)
  • :SS to save the current session (name is optional)
  • :SL to load a previously saved session (a name must be given)
  • :SM merges the given session with the current one

XML and HTML plugin offers tag mathcing and completion for HTML and XML files. Installation is simple, as you have to grab the tarball and uncompress it in your ~/.vim directory.

You must then ensure that the filetype plugin on line is in your ~/.vimrc file, to enable automatic filetype plugins to load (the XML/HTML plugin is a filetype plugin).

This plugin is activated for XML and HTML modes, and automatically closes a tag when the > is typed in insert mode. When > is pressed twice, a new line is inserted between the opening and ending tags, which is useful for block-level elements.

Tags manager is a plugin that integrates ctags with vim. It can be installe by dropping the tagmanager.vim script into the ~/.vim/plugin directory, and executing the following command to update your ~/.vimrc:

 echo "let TE_Ctags_Path  = '`which ctags`'" >> ~/.vimrc

By typing :TagExplorer?, you can browse files and view their tags by typing o (and c to close the list of tags). You may also want to hide some files, which can be set with the following variable:

 let TE_Exclude_File_Pattern ='.*\.o$\|.*\.obj$\|.*\.bak$' .
                              '\|.*\.swp$\|core\|tags'.
                              '\|.*\.pyc$\'

 let TE_Exclude_Dir_Pattern = '\.svn' 

The files

Here are the files, for your downloading pleasure:

Links

Here are some cool link to vim-related sites:

last modified on September 27, 2005, at 03:35 PM

© type-z.org and its contributing authors, 2001-2004.
Content is licensed under a Creative Commons License.