" Isam (biodegradablegeek.com) VIM SETTINGS - Last Updated 12/07/2008 " GENERAL filetype plugin indent on " Automatically detect file types. set guifont=Anonymous\ 16 set nocompatible " We don't want vi compatibility. set cf " Enable error files & error jumping. set clipboard+=unnamed " Yanks go on clipboard instead. set history=256 " Number of things to remember in history. set autowrite " Writes on make/shell commands set ruler " Ruler on set nu " Line numbers on set timeoutlen=220 " Time to wait after hitting ESC (default causes annoying delay) set nowrap " Disable line wrap. Will set on per-file basis " AESTHETICS set t_Co=256 " 256bit color set ch=2 " command line 2 lines high set background=dark "colors desertEx " colorscheme may be overriden in inherit files syntax enable highlight clear Search highlight Search term=reverse cterm=bold ctermbg=1 guifg=white guibg=hotpink1 " BACKUPS & TMP FILES (dirs must exist, else produces errors on startup) "set backup " Enable creation of backup file. "set backupdir=~/.vim/backups " Where backups will go. "set directory=~/.vim/tmp " Where temporary files will go. " FORMATTING set expandtab set tabstop=2 " Tabs are 2 spaces set bs=2 " BS over everything in insert mode set shiftwidth=2 " Tabs under smart indent set autoindent set smarttab " VISUAL set showmatch " Show matching brackets. set mat=5 " Bracket blinking. set list set novisualbell set noerrorbells " No noise. set laststatus=2 " Always show status line. " Show $ at end-of-line, ~ for trailing spaces, and > or < when line is offscreen "set lcs=tab:\ \ ,eol:$,trail:~,extends:>,precedes:< set lcs=tab:\ \ ,eol:$,extends:>,precedes:< " GVIM-SPECIFIC set mousehide " Hide mouse after chars typed set mouse=a " Mouse in all modes behave mswin " Enable right click menu " KEY MAPPINGS " Reread vim config map :source $HOME/.vimrc nnoremap :w " Not sure where I found this, but to whoever wrote it: It's brilliant! nnoremap :buffers:buffer " Tab contols, open, new, close and jump keys map to :browse tabnew map tn :tabnew map tc :tabclose map :tabfirst map :tabp map :tabn map :tablast " F5 Toggle spell check map :setlocal spell spelllang=en_us map :setlocal nospell " F6 opens buffer explorer side panel nnoremap :TlistToggle let Tlist_Exit_OnlyWindow = 1 " exit if taglist is last window open let Tlist_Show_One_File = 1 " Only show tags for current buffer let Tlist_Enable_Fold_Column = 0 " no fold column (only showing one file) " Affiliate Marketing / PPC map :s:^\(.*\)$:[\1] map :s:^\(.*\)$:"\1" " Map key to run RSpec tests map tr :Rscript spec --drb %:p " TODO "map :execute Dump_extra_whitespace(rows) " Surround line with /* */ " map #2 :s:^\(.\+\)$:/* \1 */: " Prefix line with // " map #3 :s:^\(.\+\)$:// \1: " Remove prefixed '// ' " map #4 :s:^[\t ]*//[ ]:: " PLUGIN SETTINGS " Change which file opens after executing :Rails command let g:rails_default_file='config/database.yml' " Add recently accessed rails projects to menu (project plugin) set viminfo^=! " Minibuffer Explorer Settings let g:miniBufExplMapWindowNavVim = 1 let g:miniBufExplMapWindowNavArrows = 1 let g:miniBufExplMapCTabSwitchBufs = 1 let g:miniBufExplModSelTarget = 1 let g:miniBufExplUseSingleClick = 0 " alt+n or alt+p to navigate between entries in QuickFix map :cp map :cn noremap :nohl " CODING, AUTO COMMANDS & LANGUAGE SPECIFIC INHERITENCE (ctags TODO) set tags=~/joint/.app_data/vim/tags/ " These files will inherit general programming settings autocmd BufRead *.as,*.conf,*.ini,*.c,*.cs,*.asm,*.sql,*.cpp,*.rb,*.js,*.rhtml,*.phtml,*.erb,*.htm,*.html,*.xml,*.css source /joint/.app_data/vim/inherit/hacking " ActionScript autocmd BufNewFile *.as set filetype=javascript autocmd BufRead *.as, set filetype=javascript " C autocmd BufNewFile *.c 0r /joint/.app_data/vim/skeletons/c " C++ autocmd BufNewFile *.C,*.cc,*.cpp 0r /joint/.app_data/vim/skeletons/cpp " perl let perl_extended_vars=1 " Highlight advanced vars inside strings autocmd BufNewFile *.pl 0r /joint/.app_data/vim/skeletons/perl " PHP autocmd BufNewFile *.php 0r /joint/.app_data/vim/skeletons/php " Python autocmd BufNewFile *.py 0r /joint/.app_data/vim/skeletons/python " sh autocmd BufNewFile *.sh 0r /joint/.app_data/vim/skeletons/shell " Ruby/RoR autocmd BufNewFile *.rb 0r /joint/.app_data/vim/skeletons/ruby " HTML/phtml/rhtml/ autocmd BufNewFile *.htm,*.html 0r /joint/.app_data/vim/skeletons/html " Switch to working directory of open file autocmd BufEnter * lcd %:p:h inoremap { {} inoremap { {}O inoremap {{ { inoremap {} {} inoremap } } \:let tmp0=&clipboard \let &clipboard='' \let tmp1=@" \let tmp2=@0 \y2l \:if '}}'=="=escape(@0,'"\')" \ exec 'normal "_x' \endif \let @"=tmp1 \let @0=tmp2 \let &clipboard=tmp0 \unlet tmp0 \unlet tmp1 \unlet tmp2 \a inoremap ( () inoremap ( ()O inoremap (( ( inoremap () () inoremap ) ) \:let tmp0=&clipboard \let &clipboard='' \let tmp1=@" \let tmp2=@0 \y2l \:if '))'=="=escape(@0,'"\')" \ exec 'normal "_x' \endif \let @"=tmp1 \let @0=tmp2 \let &clipboard=tmp0 \unlet tmp0 \unlet tmp1 \unlet tmp2 \a inoremap [ [] inoremap [ []O inoremap [[ [ inoremap [] [] inoremap } } \:let tmp0=&clipboard \let &clipboard='' \let tmp1=@" \let tmp2=@0 \y2l \:if ']]'=="=escape(@0,'"\')" \ exec 'normal "_x' \endif \let @"=tmp1 \let @0=tmp2 \let &clipboard=tmp0 \unlet tmp0 \unlet tmp1 \unlet tmp2 \a inoremap ' '' inoremap '' ' inoremap " "" inoremap "" " "autocmd BufNewFile *.c source /joint/.app_data/vim/inherit/hacking "autocmd BufRead *.C,*.cc,*.cpp source /joint/.app_data/vim/inherit/hacking "autocmd BufNewFile *.C,*.cc,*.cpp source /joint/.app_data/vim/inherit/hacking "autocmd BufRead *.pl source /joint/.app_data/vim/inherit/hacking "autocmd BufNewFile *.pl source /joint/.app_data/vim/inherit/hacking "autocmd BufRead *.php source /joint/.app_data/vim/inherit/hacking "autocmd BufRead *.py source /joint/.app_data/vim/inherit/hacking "autocmd BufNewFile *.py source /joint/.app_data/vim/inherit/hacking "autocmd BufRead *.sh source /joint/.app_data/vim/inherit/hacking "autocmd BufNewFile *.sh source /joint/.app_data/vim/inherit/hacking "autocmd BufRead *.rb source /joint/.app_data/vim/inherit/hacking "autocmd BufRead *.rhtml,*.htm,*.phtml source /joint/.app_data/vim/inherit/hacking "autocmd BufNewFile *.htm,*.html,*.rhtml,*.phtml source /joint/.app_data/vim/inherit/hackingautocmd BufNewFile *.php source /joint/.app_data/vim/inherit/hacking