" " General Setup " " $Id$ set nocompatible " Use Vim defaults (much better!) set backspace=indent,eol,start " allow backspacing over everything set textwidth=0 set backup set viminfo='20,\"50,f10 set history=50 set nohlsearch set nostartofline "set paste set ruler set cmdheight=1 set laststatus=2 " Following are good for python set tabstop=4 set shiftwidth=4 set smarttab set expandtab set softtabstop=4 set autoindent set smartindent " End Python settings set nofoldenable set background=dark set title set browsedir=buffer set cpoptions=aAcF$ set modeline set modelines=1 set encoding=utf-8 set listchars=tab:->,trail:.,eol:$ set smartcase set errorbells "set visualbell set showcmd " Show (partial) command in status line. set showmatch " Show matching brackets. set ignorecase " Do case insensitive matching set incsearch " Incremental search set autowrite " Automatically save before commands like :next and :make "set statusline=%<%f\ %H%m%r%=%-14.(%l,%c%)\ %P\ Buf.%n set backupcopy=yes set fileformats=unix,mac,dos set fileformat=unix set mouse=a colorscheme inkpot " """"""""" " User Info " """"""""" let g:shortname = 'andre' let g:fullname = 'Andrea Mistrali' let g:email = 'am@am.cx' " """"""""""""""""""""""""" " COMPLETION & INDENTATION " """"""""""""""""""""""""" " Function that returns tab if called on an "empty" line " C-N elsewhere function! CleverTab() if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$' return "\" else return "\" endfunction " map the function to Tab " inoremap =CleverTab() set completeopt=longest " Emacs like indenting. Pressing Tab indents line " Not in python, there it is managed by GetPythonIndent set indentkeys=0{,0},0),:,0#,!^F,o,O,e,!,!^F set cinkeys=0{,0},0),:,0#,!^F,o,O,e,!,!^F " Suffixes that get lower priority when doing tab completion for filenames. " These are files we are not likely to want to edit or read. set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc " """"""""""""""" " TagLIST support " """"""""""""""" "let Tlist_Ctags_Cmd="/opt/local/bin/ctags" let Tlist_Exit_OnlyWindow = 1 let Tlist_File_Fold_Auto_Close = 1 "let Tlist_Use_SingleClick = 0 "Do not use yet let Tlist_Use_Right_Window = 1 let Tlist_Display_Prototype = 0 let Tlist_Compact_Format = 1 " """""""" " NERDTree " """""""" let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc'] let NERDTreeShowBookmarks=1 " """"""""""" " BufExplorer " """"""""""" let g:bufExplorerSplitBelow=1 let g:bufExplorerResize=1 " """""""""""""" " NERD Commenter " """""""""""""" let NERDSpaceDelims=1 let NERDCreateDefaultMappings=1 " """"""""""" " Keymappings " """"""""""" let mapleader = "\\" "let mapleader = "," nnoremap l :set list! nnoremap f :set fullscreen! nnoremap n :NERDTreeToggle nnoremap t :Tlist nnoremap N :set number! nnoremap b :HSBufExplorer map c NERDCommenterToggle inoremap inoremap " Visual mode selection nnoremap V nnoremap V vnoremap j vnoremap k " Vim5 comes with syntaxhighlighting. If you want to enable syntaxhightlighting " by default uncomment the next three lines. if has("syntax") syntax on " Default to no syntax highlightning endif " has("syntax") if has("autocmd") filetype indent on filetype plugin on " When editing a file, always jump to the last cursor position autocmd BufReadPost * \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal g'\"" | \ endif " Mako au BufNewFile,BufRead *.mako setf mako endif "recalculate the trailing whitespace warning when idle, and after saving autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning "return '[\s]' if trailing white space is detected "return '' otherwise function! StatuslineTrailingSpaceWarning() if !exists("b:statusline_trailing_space_warning") if search('\s\+$', 'nw') != 0 let b:statusline_trailing_space_warning = '[\s]' else let b:statusline_trailing_space_warning = '' endif endif return b:statusline_trailing_space_warning endfunction " """""""""""" " Status Line " """""""""""" " Some useful functions "return the syntax highlight group under the cursor '' function! StatuslineCurrentHighlight() let name = synIDattr(synID(line('.'),col('.'),1),'name') if name == '' return '' else return '[' . name . ']' endif endfunction "recalculate the tab warning flag when idle and after writing autocmd cursorhold,bufwritepost * unlet! b:statusline_tab_warning "return '[&et]' if &et is set wrong "return '[mixed-indenting]' if spaces and tabs are used to indent "return an empty string if everything is fine function! StatuslineTabWarning() if !exists("b:statusline_tab_warning") let tabs = search('^\t', 'nw') != 0 let spaces = search('^ ', 'nw') != 0 if tabs && spaces let b:statusline_tab_warning = '[mixed-indenting]' elseif (spaces && !&et) || (tabs && &et) let b:statusline_tab_warning = '[&et]' else let b:statusline_tab_warning = '' endif endif return b:statusline_tab_warning endfunction " Real Status line definition set statusline=%t\ "tail of the filename "display a warning if fileformat isnt unix set statusline+=%#warningmsg# set statusline+=%{&ff!='unix'?'['.&ff.']':''} set statusline+=%* "display a warning if file encoding isnt utf-8 set statusline+=%#warningmsg# set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''} set statusline+=%* set statusline+=%h "help file flag set statusline+=%y "filetype set statusline+=%r "read only flag set statusline+=%m "modified flag "display a warning if &et is wrong, or we have mixed-indenting set statusline+=%#error# set statusline+=%{StatuslineTabWarning()} set statusline+=%* set statusline+=%{StatuslineTrailingSpaceWarning()} "display a warning if &paste is set set statusline+=%#error# set statusline+=%{&paste?'[paste]':'[nopaste]'} set statusline+=%* set statusline+=%= "left/right separator set statusline+=%{StatuslineCurrentHighlight()}\ \ "current highlight set statusline+=%02c, "cursor column set statusline+=%03l/%03L "cursor line/total lines set statusline+=\ hex:\ 0x%02B set statusline+=\ %P "percent through file " User customizations are held in file ~/.vim/vimrc.local if filereadable($HOME."/.vim/vimrc.local") source $HOME/.vim/vimrc.local endif