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