" vi: set tw=0 " " Mike Gerwitz's personal vim configuration " " Copyright (C) 2013 Mike Gerwitz " " This program is free software: you can redistribute it and/or modify " it under the terms of the GNU General Public License as published by " the Free Software Foundation, either version 3 of the License, or " (at your option) any later version. " " This program is distributed in the hope that it will be useful, " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " GNU General Public License for more details. " " You should have received a copy of the GNU General Public License " along with this program. If not, see . " " Refactoring needed. " " " pathogen call pathogen#incubate() " general configuration options set ai set autochdir set backspace=indent,eol,start set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp set bufhidden=hide set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp set et set exrc set fdm=marker set history=9000 set hlsearch set incsearch set modeline set number set ruler set sessionoptions=curdir,folds,globals,help,localoptions,options,resize,tabpages,winpos,winsize set scrolloff=4 set spelllang=en_us set spellfile=~/.vim/spellfile/common.add,~/.vim/spellfile/dev.add set sw=4 set t_Co=256 set title set ts=4 set tw=76 set undolevels=3000 set updatecount=50 set visualbell syn on color slatemg " BASH-like tab completion set wildmenu set winminheight=0 set wildmode=longest,list,full " enable filetype plugins filetype on filetype plugin on filetype plugin indent on " show whitespace characters set list listchars=tab:>-,trail:•,precedes:• " printing set printfont=:h8 set printoptions=paper:letter,number:y,syntax:y,left:15pc nmap ps :set printoptions+=duplex:short nmap pS :set printoptions-=duplex:short " abbreviations iab __NAME Mike Gerwitz iab __UN mikegerwitz iab __EMAIL mike@mikegerwitz.com " save a generic session in case of an oopsie au BufWrite * silent :call WriteSessAuto() au BufWrite * silent :call WriteSessAuto() function! WriteSessAuto() " one capital letter for the Sessname global so that we can store it in the " session file let filename = '~/.vimsess-' . \ ( !exists( 'g:Sessname' ) || ( empty( g:Sessname ) ) \ ? 'autosave' : (g:Sessname) \ ) exec 'mksession! ' . filename endfunction " custom statusline set statusline=%<%f\ %h%m%r%=[%n]\ \%-14.([%b:%B]\ \ %l,%c%V%)\ %P " make the C-e and C-y mappings less painful nnoremap 3 nnoremap 3 " " redraw nmap R :redraw! " nohlsearch shortcut nmap h :silent :nohlsearch " for MultipleSearch let g:MultipleSearchMaxColors = 10 " toggle cursorline/cursorcolumn nmap c :set cursorline! cursorcolumn! nmap C :set cursorcolumn! " omnicomplete set ofu=syntaxcomplete#Complete autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType xml,xsd,xslt set omnifunc=xmlcomplete#CompleteTags autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType c set omnifunc=ccomplete#Complete " maps """""" " easy window switching map j_ map k_ " easy common alignments map = :Align = :set et map > :Align => :set et map A :Align AS :set et " focus fold " map zO zMzo " easy maximize window map _k4+j map " toggle above fold map zK zkza`` " toggle below field map zJ zjza`` " comment out selected lines map c :s/^/\/\// " remove comments map x :s/^\/\/// " CommandT let g:CommandTMaxFiles=100000 map t :CommandT ~/gitrepos map T :CommandTFlush:CommandT ~/gitrepos map Hr :SearchReset:nohlsearch map HR :SearchBuffersReset:nohlsearch map vs :source ~/.vimrc map gs :source ~/.vimrc:source ~/.gvimrc map ss :setlocal spell spelllang=en_us map S :setlocal nospell map p :set paste map P :set nopaste " obnoxious mail ending chars (e.g. mutt) map M :%s/=\n//g " git blame history made easy map gb :%!git blame -- % map g< ^"byt :exe '%!git blame '.@b.'^ -- %' map g. ^"byt :exe '%!git log -p '.@b.'^..'.@b " snippets function! ReloadSnippets( snippets_dir, ft ) if strlen( a:ft ) == 0 let filetype = "_" else let filetype = a:ft endif call ResetAllSnippets() call GetSnippets( a:snippets_dir, filetype ) endfunction " reload snippets nmap rs :call ReloadSnippets(snippets_dir, &filetype) " move single line of nested XML onto multiple lines and indent map xj ^f>a>>$F<xJ ^f/ldF AO " xmllint map xl :%!xmllint --format - " system-specific configuration source ~/.vimrc-local