Mercurial > dotfiles.old
annotate vimrc @ 17:d9f2af48349b
Update plugins
author | zegervdv <zegervdv@me.com> |
---|---|
date | Wed, 12 Mar 2014 21:39:25 +0100 |
parents | 17afab9bd228 |
children | fdff344860ef |
rev | line source |
---|---|
0 | 1 set nocompatible |
2 set laststatus=2 | |
3 set noshowmode | |
4 | |
5 execute pathogen#infect() | |
6 | |
7 set backspace=2 | |
8 set autowrite | |
9 | |
10 set vb | |
11 set guioptions-=r | |
12 set guioptions-=l | |
13 set guioptions-=R | |
14 set guioptions-=L | |
15 | |
16 syntax on | |
17 set expandtab | |
18 set number | |
19 set ruler | |
20 set nocursorline | |
21 set showmatch | |
22 set title | |
23 set wrap | |
24 set wrapmargin=2 | |
25 set linebreak | |
26 set lbr | |
27 set tabstop=2 shiftwidth=2 | |
28 color hybrid | |
29 set guifont=Inconsolata\ for\ Powerline:h12 | |
30 set autowrite | |
31 set hidden | |
32 set hlsearch | |
33 set incsearch | |
34 set ignorecase | |
35 set smartcase | |
36 set smartindent | |
37 set autoindent | |
38 set scrolloff=4 | |
39 set textwidth=80 | |
40 | |
41 set history=100 | |
42 set wildmenu | |
43 | |
44 set diffopt+=iwhite | |
45 | |
46 set formatoptions= | |
47 set formatoptions+=c " Format comments | |
48 set formatoptions+=r " Continue comments by default | |
49 set formatoptions+=o " Make comment when using o or O from comment line | |
50 set formatoptions+=q " Format comments with gq | |
51 set formatoptions+=n " Recognize numbered lists | |
52 set formatoptions+=2 " Use indent from 2nd line of a paragraph | |
53 set formatoptions+=l " Don't break lines that are already long | |
54 set formatoptions+=1 " Break before 1-letter words | |
55 | |
56 set splitright | |
57 set virtualedit=block | |
58 set conceallevel=0 | |
59 | |
60 set cryptmethod=blowfish | |
61 | |
62 filetype plugin indent on | |
63 autocmd FileType ruby set tabstop=2|set shiftwidth=2 | |
64 | |
65 set clipboard=unnamed | |
66 | |
16 | 67 set viminfo='10,\"100,:20,%,n~/.viminfo |
68 | |
69 " When editing a file, always jump to the last known cursor position. | |
70 " Don't do it for commit messages, when the position is invalid, or when | |
71 " inside an event handler (happens when dropping a file on gvim). | |
72 autocmd BufReadPost * | |
73 \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") | | |
74 \ exe "normal g`\"" | | |
75 \ endif | |
0 | 76 |
77 map <Leader>d :bp<bar>sp<bar>bn<bar>bd<CR> | |
78 | |
79 " See long lines as line breaks | |
80 map j gj | |
81 map k gk | |
82 | |
83 " remap tag-search to better place | |
84 nmap <C-$> <C-]> | |
85 | |
86 " Jump to end of line in insert mode | |
87 inoremap <C-e> <C-o>A | |
88 | |
89 " Jump one character in insert mode | |
90 inoremap <C-f> <C-o>l | |
91 | |
4
050d4d8c6796
Vim: use double space to alternate files
zegervdv <zegervdv@me.com>
parents:
3
diff
changeset
|
92 " Switch between the last two files |
050d4d8c6796
Vim: use double space to alternate files
zegervdv <zegervdv@me.com>
parents:
3
diff
changeset
|
93 nnoremap <SPACE><SPACE> <C-^> |
050d4d8c6796
Vim: use double space to alternate files
zegervdv <zegervdv@me.com>
parents:
3
diff
changeset
|
94 |
0 | 95 " Very Magic search patterns |
96 nmap / /\v | |
97 cmap s/ s/\v | |
98 | |
99 | |
100 inoremap £ \ | |
101 | |
4
050d4d8c6796
Vim: use double space to alternate files
zegervdv <zegervdv@me.com>
parents:
3
diff
changeset
|
102 " nnoremap <SPACE> <C-e> |
0 | 103 |
104 " Close Quickfix window (,qq) | |
5 | 105 " map <leader>qq :cclose<CR> |
0 | 106 |
107 nnoremap <silent> n n:call HLNext(0.4)<cr> | |
108 nnoremap <silent> N N:call HLNext(0.4)<cr> | |
109 | |
110 function! HLNext (blinktime) | |
111 highlight WhiteOnRed ctermfg=white ctermbg=red guifg=white guibg=red | |
112 let [bufnum, lnum, col, off] = getpos('.') | |
113 let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/)) | |
114 let target_pat = '\c\%#'.@/ | |
115 let ring = matchadd('WhiteOnRed', target_pat, 101) | |
116 redraw | |
117 exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm' | |
118 call matchdelete(ring) | |
119 redraw | |
120 endfunction | |
121 | |
122 " Swap v and CTRL-V | |
123 nnoremap v <C-V> | |
124 nnoremap <C-V> v | |
125 | |
126 vnoremap v <C-V> | |
127 vnoremap <C-V> v | |
128 | |
129 " Use backspace as delete in visual mode | |
130 vmap <BS> x | |
131 | |
132 " Keep selection when shifting | |
133 vmap <expr> > KeepVisualSelection(">") | |
134 vmap <expr> < KeepVisualSelection("<") | |
135 | |
136 function! KeepVisualSelection(cmd) | |
137 set nosmartindent | |
138 if mode() ==# "V" | |
139 return a:cmd . ":set smartindent\<CR>gv" | |
140 else | |
141 return a:cmd . ":set smartindent\<CR>" | |
142 endif | |
143 endfunction | |
144 | |
145 let g:indent_guides_auto_colors = 0 | |
146 let g:indent_guides_guide_size = 1 | |
147 highlight IndentGuidesEven guibg=background | |
148 highlight IndentGuidesOdd guibg='#282a2e' | |
149 | |
150 " Show trailing whitespaces | |
151 " exec "set listchars=tab:\uBB\uBB,trail:\uB7,nbsp:~" | |
152 " set list | |
153 | |
154 " Vim Math plugin; make simple calculations | |
155 vmap <expr> ++ VMATH_YankAndAnalyse() | |
156 nmap ++ vip++ | |
157 | |
158 " Airline configuration | |
159 let g:airline_inactive_collapse=0 | |
160 let g:airline_powerline_fonts=1 | |
161 | |
162 let g:airline_left_sep = '' | |
163 let g:airline_right_sep = '' | |
164 | |
165 let g:airline_theme = 'tomorrow' | |
166 | |
167 let g:airline#extensions#syntastic#enabled = 0 | |
168 | |
169 nnoremap <F5> :buffers<CR>:buffer<Space> | |
170 noremap <C-TAB> <C-w><C-w> | |
171 | |
172 " Set leader to , | |
173 let mapleader = "," | |
174 | |
175 " Custom key mappings | |
176 | |
177 let g:yankring_replace_n_pkey = 'cp' | |
178 | |
179 " Nerdtree | |
180 map <F2> :NERDTreeToggle<CR> | |
181 map <Leader>e :NERDTreeToggle<CR> | |
182 let NERDTreeIgnore = ['\.aux$', '\.log$', '\.out$'] | |
183 | |
184 " Vim - Rspec | |
185 map <leader>t :call RunCurrentSpecFile()<CR> | |
186 map <leader>s :call RunNearestSpec()<CR> | |
187 map <leader>l :call RunLastSpec()<CR> | |
188 map <leader>r :call RunAllSpecs()<CR> | |
189 | |
190 " Cucumber | |
191 map <leader>f :call RunAllFeatures()<CR> | |
192 map <leader>k :call RunCurrentFeature()<CR> | |
193 | |
194 " Autocomplete | |
195 inoremap <C-Space> <C-N> | |
196 | |
197 " Single char insertion | |
198 " nmap <Space> i_<Esc>r | |
199 | |
200 " Clear highlight | |
201 nnoremap <silent> <leader>n :nohlsearch<CR> | |
202 | |
203 " ctrl p - Fuzzy file finder | |
204 noremap <C-p> :CtrlP<CR> | |
205 let g:ctrl_map = '<c-p>' | |
206 let g:ctrl_cmd = 'CtrlP' | |
207 | |
208 map <C-l> :CtrlPBuffer<CR> | |
209 map <C-m> :CtrlPTag<CR> | |
210 | |
5 | 211 if executable('ag') |
212 let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
213 let g:ctrlp_use_caching = 0 | |
214 endif | |
215 | |
0 | 216 " ctrl p - Commands |
217 map <leader>p :CtrlPCmdPalette<CR> | |
218 | |
219 " Markdown | |
220 let g:vim_markdown_folding_disabled=1 | |
221 | |
222 " tComment remap | |
223 nmap <leader>c <C-_><C-_> | |
224 | |
225 " Neo Complete | |
226 let g:acp_enableAtStartup=0 | |
227 let g:neocomplete#enable_at_startup=1 | |
228 let g:neocomplete#enable_smart_case=1 | |
229 let g:neocomplete#sources#syntax#min_keyword_length=3 | |
230 let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' | |
231 | |
232 " Define dictionary. | |
233 let g:neocomplete#sources#dictionary#dictionaries = { | |
234 \ 'default' : '', | |
235 \ 'vimshell' : $HOME.'/.vimshell_hist', | |
236 \ 'scheme' : $HOME.'/.gosh_completions' | |
237 \ } | |
238 " Recommended key-mappings. | |
239 " <CR>: close popup and save indent. | |
240 inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> | |
241 function! s:my_cr_function() | |
242 return neocomplete#close_popup() . "\<CR>" | |
243 " For no inserting <CR> key. | |
244 "return pumvisible() ? neocomplete#close_popup() : "\<CR>" | |
245 endfunction | |
246 " <TAB>: completion. | |
247 inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" | |
248 " <C-h>, <BS>: close popup and delete backword char. | |
249 inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>" | |
250 | |
251 autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | |
252 autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags | |
253 autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS | |
254 autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | |
255 autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags | |
256 autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete | |
257 if !exists('g:neocomplete#sources#omni#input_patterns') | |
258 let g:neocomplete#sources#omni#input_patterns = {} | |
259 endif | |
260 | |
261 " Neo Snippets | |
262 imap <C-k> <Plug>(neosnippet_expand_or_jump) | |
263 smap <C-k> <Plug>(neosnippet_expand_or_jump) | |
264 xmap <C-k> <Plug>(neosnippet_expand_target) | |
265 | |
266 imap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
267 \ "\<Plug>(neosnippet_expand_or_jump)" | |
268 \: pumvisible() ? "\<C-n>" : "\<TAB>" | |
269 smap <expr><TAB> neosnippet#expandable_or_jumpable() ? | |
270 \ "\<Plug>(neosnippet_expand_or_jump)" | |
271 \: "\<TAB>" | |
272 let g:neocomplete#sources#omni#input_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' | |
273 | |
274 let g:neosnippet#snippets_directory='~/.vim/snippets' | |
275 | |
276 " Tabular | |
277 inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
278 | |
279 function! s:align() | |
280 let p = '^\s*|\s.*\s|\s*$' | |
281 if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
282 let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
283 let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
284 Tabularize/|/l1 | |
285 normal! 0 | |
286 call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) | |
287 endif | |
288 endfunction | |
289 | |
290 " Align Migration files | |
291 vmap <c-a> :Tabularize /:/l1l0l0<CR> | |
292 | |
293 nmap <Leader>a= :Tabularize /=<CR> | |
294 vmap <Leader>a= :Tabularize /=<CR> | |
295 nmap <Leader>a=> :Tabularize /=><CR> | |
296 vmap <Leader>a=> :Tabularize /=><CR> | |
297 nmap <Leader>a: :Tabularize /:\zs/l0l1<CR> | |
298 vmap <Leader>a: :Tabularize /:\zs/l0l1<CR> | |
299 nmap <Leader>a, :Tabularize /,\zs/l0l1<CR> | |
300 vmap <Leader>a, :Tabularize /,\zs/l0l1<CR> | |
301 vmap <Leader>a- :Tabularize /-<CR> | |
302 | |
303 | |
304 | |
305 augroup markdown | |
306 au! | |
307 au BufNewFile,BufRead *.md,*.markdown setlocal filetype=ghmarkdown | |
308 augroup END | |
309 | |
310 | |
311 " Latex plugin | |
312 au BufNewFile,BufRead,BufEnter *.tex setlocal spell spelllang=en_gb | |
313 au BufNewFile,BufRead,BufEnter *.tex setlocal textwidth=0 | |
314 au BufNewFile,BufRead,BufEnter *.txt setlocal spell spelllang=en_gb | |
315 au BufNewFile,BufRead,BufEnter *.txt setlocal textwidth=0 | |
316 | |
317 let g:tex_conseal = "" | |
318 | |
319 let g:tex_comment_nospell=1 | |
320 let g:Tex_DefaultTargetFormat = 'pdf' | |
321 let g:tex_flavor = 'latex' | |
322 let g:Tex_TreatMacViewerAsUNIX = 1 | |
323 let g:Tex_ExecuterUNIXViewerInForeground = 1 | |
324 let g:Tex_ViewRule_pdf = 'open -a Preview' | |
325 let g:Tex_ViewRule_ps = 'open -a Preview' | |
326 | |
327 " Tagbar mapping | |
328 nmap <F8> :TagbarToggle<CR> | |
329 | |
330 " The silver searcher | |
331 " let g:ackprg = 'ag --nogroup --nocolor --column' | |
332 | |
333 " Multiple cursor insert | |
334 let g:multi_cursor_next_key='<C-n>' | |
335 let g:multi_cursor_prev_key='<C-m>' | |
336 let g:multi_cursor_skip_key='<C-x>' | |
337 let g:multi_cursor_quit_key='<Esc>' | |
338 | |
339 " Gundo tree | |
340 nnoremap <leader>u :GundoToggle<CR> | |
341 | |
342 " Yank ring | |
343 nnoremap <silent> <leader>y :YRShow<CR> | |
344 | |
13 | 345 " Open pdf in Preview |
0 | 346 let g:livepreview_previewer = 'open -a Preview' |
3
44d3af8838f8
Add support for local zshrc and vimrc files
zegervdv <zegervdv@me.com>
parents:
0
diff
changeset
|
347 |
13 | 348 |
349 " Smalls | |
350 nmap s <Plug>(smalls) | |
351 omap s <Plug>(smalls) | |
352 xmap s <Plug>(smalls) | |
353 | |
14
09c60bc0fc38
Add vim-textmanip for visual block dragging
zegervdv <zegervdv@me.com>
parents:
13
diff
changeset
|
354 " Textmanip |
09c60bc0fc38
Add vim-textmanip for visual block dragging
zegervdv <zegervdv@me.com>
parents:
13
diff
changeset
|
355 xmap <C-j> <Plug>(textmanip-move-down) |
09c60bc0fc38
Add vim-textmanip for visual block dragging
zegervdv <zegervdv@me.com>
parents:
13
diff
changeset
|
356 xmap <C-k> <Plug>(textmanip-move-up) |
09c60bc0fc38
Add vim-textmanip for visual block dragging
zegervdv <zegervdv@me.com>
parents:
13
diff
changeset
|
357 xmap <C-h> <Plug>(textmanip-move-left) |
09c60bc0fc38
Add vim-textmanip for visual block dragging
zegervdv <zegervdv@me.com>
parents:
13
diff
changeset
|
358 xmap <C-l> <Plug>(textmanip-move-right) |
09c60bc0fc38
Add vim-textmanip for visual block dragging
zegervdv <zegervdv@me.com>
parents:
13
diff
changeset
|
359 xmap <F10> <Plug>(textmanip-toggle-mode) |
09c60bc0fc38
Add vim-textmanip for visual block dragging
zegervdv <zegervdv@me.com>
parents:
13
diff
changeset
|
360 |
13 | 361 " Load local vimrc |
3
44d3af8838f8
Add support for local zshrc and vimrc files
zegervdv <zegervdv@me.com>
parents:
0
diff
changeset
|
362 if filereadable($HOME . "/.vimrc.local") |
44d3af8838f8
Add support for local zshrc and vimrc files
zegervdv <zegervdv@me.com>
parents:
0
diff
changeset
|
363 source ~/.vimrc.local |
44d3af8838f8
Add support for local zshrc and vimrc files
zegervdv <zegervdv@me.com>
parents:
0
diff
changeset
|
364 endif |