Tue, 27 May 2014 00:38:03 -0400
Something usable in normal colorschemes and babun
1 | 1 | set nocompatible |
2 | ||
3 | " call pathogen#infect() | |
4 | " call pathogen#helptags() | |
5 | ||
6 | " Setting up Vundle - the vim plugin bundler | |
7 | let has_vundle=1 | |
8 | let vundle_readme=expand('~/.vim/bundle/vundle/README.md') | |
9 | if !filereadable(vundle_readme) | |
10 | let has_vundle=0 | |
11 | echo "Installing Vundle.." | |
12 | echo "" | |
13 | silent !mkdir -p ~/.vim/bundle | |
14 | silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle | |
15 | endif | |
16 | ||
17 | set rtp+=~/.vim/bundle/vundle/ | |
18 | call vundle#rc() | |
19 | Plugin 'gmarik/vundle' | |
20 | ||
21 | Plugin 'altercation/vim-colors-solarized' | |
22 | Plugin 'bling/vim-airline' | |
23 | ||
24 | Plugin 'Shougo/vimproc.vim' | |
25 | Plugin 'Shougo/unite.vim' | |
26 | Plugin 'Shougo/vimshell.vim' | |
27 | Plugin 'sjl/gundo.vim' | |
28 | Plugin 'majutsushi/tagbar' | |
29 | Plugin 'godlygeek/tabular' | |
30 | Plugin 'tomtom/tcomment_vim' | |
31 | ||
32 | Plugin 'danchoi/ri.vim' | |
33 | Plugin 'tpope/vim-fugitive' | |
34 | Plugin 'ludovicchabant/vim-lawrencium' | |
35 | ||
36 | if has_vundle == 0 | |
37 | echo "Installing Plugins, please ignore key map error messages" | |
38 | echo "" | |
39 | :PluginInstall | |
40 | endif | |
41 | " Setting up Vundle - the vim plugin bundler end | |
42 | ||
43 | ||
44 | syntax on | |
45 | filetype plugin indent on | |
46 | ||
47 | set enc=utf-8 | |
48 | ||
49 | set hlsearch | |
50 | set ic smartcase | |
51 | ||
52 | set lcs=tab:→·,trail:· | |
53 | ||
54 | set ve=block | |
55 | ||
56 | set autoindent | |
57 | set expandtab | |
58 | set shiftwidth=2 | |
59 | set softtabstop=2 | |
60 | " vim: enc=utf-8 et sts=2 sw=2 | |
61 | ||
62 | set backspace=indent,eol,start | |
63 | ||
64 | " set nu | |
65 | set scrolloff=2 | |
66 | set ruler | |
67 | set showcmd | |
68 | set wildmenu | |
69 | ||
70 | nmap <silent> <F1> :Unite buffer<CR> | |
71 | nmap <silent> <F2> :Unite file<CR> | |
72 | nmap <silent> <F3> :VimShell<CR> | |
73 | map <silent> <F4> :noh<CR> | |
74 | nmap <silent> <F5> :GundoToggle<CR> | |
75 | nmap <silent> <F8> :TagbarToggle<CR> | |
76 | ||
77 | " This is supposed to get a CtrlP workalike with fuzzy match | |
78 | " but i need to fix ignores and always chdir to a good place | |
79 | if has("win32") || has("win16") | |
80 | nmap <silent> <S-F2> :Unite -start-insert file_rec:!<CR> | |
81 | else | |
82 | nmap <silent> <S-F2> :Unite -start-insert file_rec/async:!<CR> | |
83 | endif | |
84 | ||
85 | " F-n keys call out to normal mode from insert mode | |
86 | imap <F1> <C-O><F1> | |
87 | imap <F2> <C-O><F2> | |
88 | " imap <F3> <C-O><F3> | |
89 | imap <F4> <C-O><F4> | |
90 | " imap <F5> <C-O><F5> | |
91 | " imap <F6> <C-O><F6> | |
92 | " imap <F7> <C-O><F7> | |
93 | imap <F8> <C-O><F8> | |
94 | ||
95 | " Don't assume to scan includes when autocompleting | |
96 | set cpt-=i | |
97 | ||
98 | " Never open with folds collapsed | |
99 | set nofoldenable | |
100 | ||
101 | set lbr | |
102 | set sbr=»\ | |
103 | ||
104 | set statusline=%f%m%r%h%w\ %y\ %=%l,%c\ %p%%\ %L | |
105 | set laststatus=2 | |
106 | ||
107 | if has("win32") || has("win16") | |
108 | let $MYVIM=$HOME.'/vimfiles' | |
109 | ||
110 | if !filewritable( $MYVIM . '/var' ) | |
111 | silent execute '!mkdir "'.$HOME.'\vimfiles\var"' | |
112 | endif | |
113 | if !filewritable( $MYVIM. '/var/backup' ) | |
114 | silent execute '!mkdir "'.$HOME.'\vimfiles\var\backup"' | |
115 | endif | |
116 | if !filewritable( $MYVIM . '/var/tmp' ) | |
117 | silent execute '!mkdir "'.$HOME.'\vimfiles\var\tmp"' | |
118 | endif | |
119 | if !filewritable( $MYVIM . '/var/undo' ) | |
120 | silent execute '!mkdir "'.$HOME.'\vimfiles\var\undo"' | |
121 | endif | |
122 | ||
123 | set guifont=Consolas:h11 | |
124 | set guioptions-=t | |
125 | else | |
126 | let $MYVIM=$HOME.'/.vim' | |
127 | ||
128 | if !filewritable( $MYVIM . '/var/backup' ) | |
129 | silent execute '!mkdir -p "'.$MYVIM.'/var/backup"' | |
130 | endif | |
131 | if !filewritable( $MYVIM . '/var/tmp' ) | |
132 | silent execute '!mkdir "'.$MYVIM.'/var/tmp"' | |
133 | endif | |
134 | if !filewritable( $MYVIM . '/var/undo' ) | |
135 | silent execute '!mkdir "'.$MYVIM.'/var/undo"' | |
136 | endif | |
137 | ||
138 | set guifont=Droid\ Sans\ Mono\ Slashed\ 10 | |
139 | endif | |
140 | ||
141 | set backupdir=$MYVIM/var/backup//,. | |
142 | set directory=$MYVIM/var/tmp//,. | |
143 | ||
144 | set backup | |
145 | set autowrite | |
146 | " set hidden -- autowrite vs hidden, haven't decided. | |
147 | ||
148 | if has('persistent_undo') | |
149 | set undofile | |
150 | set undodir=$MYVIM/var/undo//,. | |
151 | end | |
152 | ||
153 | if has('gui_running') | |
154 | set number | |
155 | set background=dark | |
156 | set columns=120 lines=40 | |
157 | colorscheme solarized | |
158 | end | |
159 | ||
160 | autocmd FileType text setlocal textwidth=78 | |
161 | ||
162 | ||
163 | " -- Perl stuff | |
164 | function! PerlSettings () | |
165 | setlocal keywordprg=perldoc\ -f | |
166 | setlocal makeprg=perl\ -c\ %\ $* | |
167 | setlocal errorformat=%m\ at\ %f\ line\ %l | |
168 | endfunction | |
169 | ||
170 | autocmd FileType perl call PerlSettings() | |
171 | ||
172 | " preload templates into new buffers by file extension | |
173 | " autocmd BuffNewFile * silent! 0r $MYVIM/templates/%:e.template | |
174 | ||
175 | " strip trailing whitespace on save | |
176 | " autocmd BufWritePre * :%s/\s+$//e | |
177 | ||
178 | "let perl_fold = 1 "perl fold scanning is slow | |
179 | let perl_include_pod = 1 | |
180 | ||
181 | " -- Gundo | |
182 | " I prefer python3 on windows if I have to use it. | |
183 | if has('win32') | |
184 | let g:gundo_prefer_python3=1 | |
185 | endif | |
186 | ||
187 | " -- Tagbar | |
188 | if has("win32") || has("win16") | |
189 | let g:tagbar_ctags_bin = 'C:\Users\mhoward\bin\ctags.exe' | |
190 | endif | |
191 | ||
192 | let g:tagbar_autoclose = 1 | |
193 | let g:tagbar_autofocus = 1 | |
194 | let g:tagbar_compact = 1 | |
195 | ||
196 | let g:tagbar_type_perl = { | |
197 | \ 'kinds' : [ | |
198 | \ 'p:packages:1:0', | |
199 | \ 'e:extends', | |
200 | \ 'r:roles', | |
201 | \ 'c:constants:0:0', | |
202 | \ 'f:formats:0:0', | |
203 | \ 'a:attributes', | |
204 | \ 's:subroutines', | |
205 | \ 'l:labels', | |
206 | \ ], | |
207 | \ 'deffile' : '$MYVIM/ctags/perl.cnf' | |
208 | \ } | |
209 | ||
210 | ||
211 | " -- Unite | |
212 | call unite#filters#matcher_default#use(['matcher_fuzzy']) | |
213 | call unite#filters#sorter_default#use(['sorter_rank']) | |
214 | let g:unite_source_history_yank_enable = 1 | |
215 | ||
216 | if executable('ag') | |
217 | let g:unite_source_grep_command = 'ag' | |
218 | let g:unite_source_grep_default_opts = '--nogroup --nocolor --column' | |
219 | let g:unite_source_grep_recursive_opt = '' | |
220 | endif | |
221 | ||
222 | " -- Airline | |
223 | let g:airline#extensions#whitespace#enabled = 0 | |
224 | ||
225 | ||
226 | " Local stuff | |
227 | try | |
228 | if has("win32") || has("win16") | |
229 | source ~/_vimrc.local | |
230 | else | |
231 | source ~/.vimrc.local | |
232 | endif | |
233 | catch | |
234 | endtry | |
235 |