Configuration: vim

Setup

I'm using Vim mostly in text mode inside some X terminal (xterm or urxvt), so these settings are for vim (not gvim) and something may not work in real text mode virtual console or in ssh/screen. And many things won't work in Windows, of course.

I prefer to work in full screen and dislike Vim's split window feature. In older Vim versions I've used setup which show just one window, and work with multiple open files by using Tab and Shift+Tab in normal mode to switch between them. In modern Vim I use tabs to open multiple files, and each tab have only one window - very similar to previous setup except now I see all open files (in tab names) and switch between them using Ctrl+PgUp and Ctrl+PgDown.

Features

NOTE: Information on this page is a little outdated, my current config has more features.

List of my Vim configuration main features:

Configuration files

~/.vim/vimrc - it's well commented, but most comments are in Russian.

~/.vim/ - contain all needed plugins, syntax files, etc.

One of plugins (Command-T) include files which should be compiled and require your Vim to be built with ruby support. So, after unpacking my files you should compile it: cd ~/.vim/bundle/command-t/ruby/command-t make clean ruby extconf.rb make

Plugins

Ack

This plugin is a front for the Perl module App::Ack. Ack can be used as a replacement for 99% of the uses of grep. This plugin will allow you to run ack from vim, and shows the results in a split window.

autosess

Start Vim without file arguments to automatically load previous session for current directory. This make easier work with complex projects - just chdir to project directory and start vim.

Command-T

The Command-T plug-in for VIM provides an extremely fast, intuitive mechanism for opening files with a minimal number of keystrokes.

foldutil

Utility for creating folds (using specified match criteria). This plugin make creating custom fold much ease.

It require genutils library plugin.

HTML5

HTML5 + inline SVG omnicomplete function, indent and syntax for Vim.

LargeFile

Editing large files can be a time consuming process as Vim is working on a number of things behind the scenes, such as maintaining an undo database, searching for a syntax highlighting synchronization point, etc. LargeFile.vim is a very small "plugin"; mostly, its just an autocmd that disables certain features of vim in the interests of speed.

less

Vim support for LESS CSS (syntax highlight, indent, compile the file.less to file.css).

linediff

The linediff plugin provides a simple command, :Linediff, which is used to diff two separate blocks of text.

matchit

The matchit.vim script allows you to configure % to match more than just single characters. You can match words and even regular expressions.

mojo

Syntax file for Mojolicious epl templates.

ruscmd

This plugin will let you enter command mode (NORMAL) commands using Russian keyboard layout. Also it will let you enter few most used commands in command line mode in safe way (only full commands translated). This is usually enough to avoid switching between Russian and English layouts just to control Vim.

Smart-Tabs

This script allows you to use your normal tab settings for the beginning of the line, and have tabs expanded as spaces anywhere else. This effectively distinguishes 'indent' from 'alignment'.

snipMate

snipMate.vim aims to be an unobtrusive, concise vim script that implements some of TextMate's snippets features in Vim.

Sparkup

You can write HTML in a CSS-like syntax, and have Sparkup handle the expansion to full HTML code. It is meant to help you write long HTML blocks in your text editor by letting you type less characters than needed.

Supertab

Supertab is a vim plugin which allows you to use for all your insert completion needs.

Syntastic

Syntastic is a syntax checking plugin that runs files through external syntax checkers and displays any resulting errors to the user.

It's my fork of original Syntastic with some fixes.

tcomment

tcomment provides easy to use, file-type sensible comments for Vim.

viewdoc

Flexible viewer for any documentation source (help/man/perldoc/etc.) for any file type inside Vim in easy to use, consistent, smart and configurable way.

vim-gnupg

This script implements transparent editing of gpg encrypted files.

pathogen

Manage your 'runtimepath' with ease. In practical terms, pathogen.vim makes it super easy to install plugins and runtime files in their own private directories.

Syntax highlight

Limbo

My syntax highlight for Limbo.

To detect file type save into ~/.vim/ftdetect/limbo.vim these lines: let g:filetype_m="limbo" autocmd BufNewFile,BufRead *.[bm] setf limbo

Inferno shell

My syntax highlight for /dis/sh (OS Inferno sh(1)).

To detect file type save into ~/.vim/ftdetect/infsh.vim these lines: autocmd BufNewFile,BufRead profile,wmsetup setf infsh autocmd BufNewFile,BufRead * if getline(1) =~ '^#!/dis/sh' || getlinee(1) =~ '^load ' || getline(2) =~ '^load ' | setlocal ft=infsh | endif

mkfile

My syntax highlight for mkfile (OS Inferno/Plan9 mk(1)).

To detect file type save into ~/.vim/ftdetect/mkfile.vim this line: autocmd BufNewFile,BufRead mk* if expand("<afile>") !~ '\.' | setf mkfile | endif

Tips and Tricks

Replace standard man command

To replace console command man with Vim's viewer (which is much better) you can create wrapper script in ~/bin/man with these lines: #!/bin/bash if [ ${1:0:1} == "-" ]; then exec env LANG=en_EN /usr/bin/man $* else exec vi --cmd 'let g:loaded_autosess=1' -c "ViewDocMan $*" -c tabonly fi