1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  2 " Stuff I have decided I don't like
  3 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
  4 "set list " turns out, I don't like listchars -- show chars on end of line, whitespace, etc
  5 "set listchars=tab:>-,trail:-,eol:$ " what to show when I hit :set list
  6 "autocmd GUIEnter * :simalt ~x -- having it auto maximize the screen is annoying
  7 "set lines=80 " 80 lines tall
  8 "set columns=160 " 160 cols wide
  9 "set ai " autoindent (filetype indenting instead)
 10 "set si " smartindent (filetype indenting instead)
 11 "set foldmethod=indent " Make folding indent sensitive
 12 "set smarttab " use tabs at the start of a line, spaces elsewhere
 13
 14 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 15 " General
 16 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 17 set nocompatible " get out of horrible vi-compatible mode
 18 filetype plugin indent on " load filetype plugins and indent settings
 19 set history=1000 " How many lines of history to remember
 20 set cf " enable error files and error jumping
 21 set clipboard+=unnamed " turns out I do like is sharing windows clipboard
 22 set ffs=unix,dos,mac " support all three, in this order
 23 set viminfo+=! " make sure it can save viminfo
 24 set isk+=_,$,@,%," none of these should be word dividers, so make them not be
 25 set nosol " leave my cursor where it was
 26
 27 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 28 " Theme/Colors
 29 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 30 set background=dark " we are using a dark background
 31 syntax on " syntax highlighting on
 32
 33 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 34 " Files/Backups
 35 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 36 set backup " make backup file
 37 set backupdir=c:\progra~1\vim\vimfiles\backup,~/.vim/backup " where to put backup file
 38 set directory=c:\progra~1\vim\vimfiles\temp,~/.vim/temp " directory is the directory for temp file
 39 set makeef=error.err " When using make, where should it dump the file
 40 set sessionoptions+=globals " What should be saved during sessions being saved
 41 set sessionoptions+=localoptions " What should be saved during sessions being saved
 42 set sessionoptions+=resize " What should be saved during sessions being saved
 43 set sessionoptions+=winpos " What should be saved during sessions being saved
 44
 45 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 46 " Vim UI
 47 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 48 set lsp=0 " space it out a little more (easier to read)
 49 set wildmenu " turn on wild menu
 50 set wildmode=list:longest " turn on wild menu in special format (long format)
 51 set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc,*.swp,*.jpg,*.gif,*.png " ignore some formats
 52 set ruler " Always show current positions along the bottom
 53 set cmdheight=1 " the command bar is 1 high
 54 set number " turn on line numbers
 55 set lz " do not redraw while running macros (much faster) (LazyRedraw)
 56 set hid " you can change buffer without saving
 57 set backspace=2 " make backspace work normal
 58 set whichwrap+=<,>,h,l  " backspace and cursor keys wrap to
 59 set mouse=a " use mouse everywhere
 60 set shortmess=atI " shortens messages to avoid 'press a key' prompt
 61 set report=0 " tell us when anything is changed via :...
 62 set noerrorbells " don't make noise
 63
 64 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 65 " Visual Cues
 66 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 67 set showmatch " show matching brackets
 68 set mat=5 " how many tenths of a second to blink matching brackets for
 69 set nohlsearch " do not highlight searched for phrases
 70 set incsearch " BUT do highlight as you type you search phrase
 71 set so=5 " Keep 5 lines (top/bottom) for scope
 72 set novisualbell " don't blink
 73 set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
 74 set laststatus=2 " always show the status line
 75
 76 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 77 " Text Formatting/Layout
 78 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 79 set fo=tcrq " See Help (complex)
 80 set cindent " do c-style indenting
 81 set softtabstop=4 " unify
 82 set shiftwidth=4 " unify
 83 set tabstop=8 " real tabs should still be 8 -- helps me tell when they end up in a file
 84 set shiftround " when at 3 spaces, and I hit > ... go to 4, not 5
 85 set expandtab " no real tabs please!
 86 set nowrap " do not wrap lines  
 87 set preserveindent " but above all -- follow the conventions laid before us
 88 set copyindent " but above all -- follow the conventions laid before us
 89 set ignorecase " case insensitive by default
 90 set smartcase " if there are caps, go case-sensitive
 91
 92 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 93 " Folding
 94 "    Enable folding, but by default make it act like folding is off, because folding is annoying in anything but a few rare cases
 95 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 96 set foldenable " Turn on folding
 97 set foldmarker={," Fold C style code
 98 set foldmethod=marker " Fold on the marker
 99 set foldlevel=100 " Don't autofold anything (but I can still fold manually)
100 set foldopen-=search " don't open folds when you search into them
101 set foldopen-=undo " don't open folds when you undo stuff
102
103 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
104 " File Explorer
105 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
106 let g:explVertical=1 " should I split verticially
107 let g:explWinSize=35 " width of 25 pixels
108
109 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
110 " CTags
111 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
112 let Tlist_Ctags_Cmd = 'ctags.exe' " Location of ctags
113 let Tlist_Sort_Type = "name" " order by
114 let Tlist_Use_Right_Window = 1 " split to the right side of the screen
115 let Tlist_Compact_Format = 1 " show small meny
116 let Tlist_Exist_OnlyWindow = 1 " if you are the last, kill yourself
117 let Tlist_File_Fold_Auto_Close = 1 " Do close tags for other files
118 let Tlist_Enable_Fold_Column = 1 " Do not show folding tree
119 let Tlist_php_settings        = 'php;c:class;d:constant;f:function' " don't show variables in freaking php
120 let Tlist_aspvbs_settings     = 'asp;f:function;s:sub' " just functions and subs please
121 let Tlist_aspjscript_settings = 'asp;f:function;c:class' " just functions and classes please
122
123 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
124 " Matchit
125 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
126 let b:match_ignorecase = 1
127
128 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
129 " Perl
130 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
131 let perl_extended_vars=1 " highlight advanced perl vars inside strings
132
133 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
134 " Custom Functions
135 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
136 " Select range, then hit :SuperRetab($width) - by p0g and FallingCow
137 function! SuperRetab(width) range
138     silent! exe a:firstline . ',' . a:lastline . 's/\v%(^ *)@<= {'. a:width .'}/\t/g'
139 endfunction
140
141 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
142 " Mappings
143 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
144 map <up> <ESC>:bp<RETURN> " left arrow (normal mode) switches buffers
145 map <down> <ESC>:bn<RETURN> " right arrow (normal mode) switches buffers
146 map <right> <ESC>:Tlist<RETURN> " show taglist
147 map <left> <ESC>:BufExplorer<RETURN>  " moves left fa split
148 map <F2> <ESC>ggVG:call SuperRetab()<left>
149 map <F12> ggVGg? " apply rot13 for people snopping over shoulder, good fun
150
151 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
152 " Useful abbrevs
153 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
154 iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr> 
155
156 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
157 " Outliner
158 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
159 runtime! ftdetect/*.vim
160
161 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
162 " Autocommands
163 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
164 au BufRead,BufNewFile *.zcml set filetype=xml
165 au BufRead,BufNewFile *.rb,*.rhtml set tabstop=2
166 au BufRead,BufNewFile *.rb,*.rhtml set shiftwidth=2
167 au BufRead,BufNewFile *.rb,*.rhtml set softtabstop=2
168 au! BufRead,BufNewFile *.otl set filetype vo_base
169 au FileType python set omnifunc=pythoncomplete#Complete
170 au FileType javascript set omnifunc=javascriptcomplete#CompleteJS
171 au FileType html set omnifunc=htmlcomplete#CompleteTags
172 au FileType css set omnifunc=csscomplete#CompleteCSS
173 au FileType xml set omnifunc=xmlcomplete#CompleteTags
174 au FileType c set omnifunc=ccomplete#Complete