Vim

From Debuntu

Jump to: navigation, search

Some of my favorite Vim tips This assume that you have a fully fledge installation of Vim. Under Debian, it takes:

# apt-get install vim

Default Setting

" Syntax on
syntax on
" Dark background
set background=dark
" Check start/end of file for vim metadata (modeline)
set modeline
" Set tabs to be 2 columns of width
set tabstop=2
set shiftwidth=2
set softtabstop=2

set incsearch
set ruler

Modeline

Modelines allow one to have different settings loaded on start up depending on the file you are editing. Modeline will search for the first and last modelines (as shown by set modelines or set mls) for comments stating custom vi commands. Such comments might look like:

# vim: tabstop=2 softtabstop=2 shiftwidth=2 expandtab:
// vim: ts=2:sw=2:sts=2:expandtab
or
/* vim: ts=2:sw=2:sts=2:expandtab
*/
or
/* vim: set ts=2:sw=2:sts=2:expandtab: */
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Google AdSense