-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.vimrc
436 lines (383 loc) · 10.4 KB
/
.vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
"
" Lucas de Vries' .vimrc
" Nick: GGLucas
" Mail: [email protected]
" Website: lucas.glacicle.org
"
" {{{ Key mappings
"" {{{ Convenience shortcuts
""" {{{ Mapleader
let mapleader=","
""" }}}
""" {{{ File actions
" Save file
nmap ƒ :up<CR>
" Close everything
nmap ZN :wqa<CR>
" Close the tab
nmap ZV :tabclose<CR>
""" }}}
""" {{{ Window navigation
nmap <Left> <C-w>h
nmap <Down> <C-w>j
nmap <Up> <C-w>k
nmap <Right> <C-w>l
""" }}}
""" {{{ Buffer navigation
nmap <silent> ∩ :A<CR>
nmap <silent> ∪ :e .<CR>
nmap <silent> <Leader>- <C-^>
nmap <silent> ♥ :bnext<CR>
nmap <silent> √ :bprev<CR>
""" }}}
""" {{{ Editing shortcuts
" Creating new lines without comment leader
nmap go o<Esc>S
nmap gO O<Esc>S
" Return to visual mode after indenting
xmap < <gv
xmap > >gv
" Consistency!
nnoremap Y y$
" Double dash for end of line, double underscore for beginning
noremap -- $
noremap __ ^
" Use ,, for regular , (since it's the leader)
nnoremap ,, ,
" Faster scrolling
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" Clear screen and remove highlighting
nnoremap <silent> <C-l> :nohl<CR>
" Swap ` and '
noremap ' `
noremap ` '
" Go back to start of edit after repeat
nmap . .'[
" Insert/remove braces around single line
nnoremap ysb mZkA {<Esc>jo}<Esc>`Z
nnoremap dsb mZkA<BS><BS><Esc>jjddk`Z
" Wordwise C-Y
inoremap <silent> <C-E> <C-C>:let @z = @"<CR>mz
\:exec 'normal!' (col('.')==1 && col('$')==1 ? 'k' : 'kl')<CR>
\:exec (col('.')==col('$')-1 ? 'let @" = @_' : 'normal! yiW')<CR>
\`zp:let @" = @z<CR>a
""" }}}
""" {{{ Spellcheck
nmap <Leader>ss :set nospell<CR>
nmap <Leader>se :set spell spelllang=en<CR>
nmap <Leader>sn :set spell spelllang=nl<CR>
""" }}}
""" {{{ Quickfix window
nmap <silent> <Leader>vp :call Pep8()<CR>
nnoremap <silent> ]t :cnext<CR>
nnoremap <silent> [t :cprev<CR>
""" }}}
""" {{{ Remove inconvenient binds
xmap K k
nmap Q <Nop>
""" }}}
"" }}}
"" {{{ Plugin bindings
""" {{{ Bisect
nmap ↓ <Plug>BisectDown
nmap ↑ <Plug>BisectUp
nmap ← <Plug>BisectLeft
nmap → <Plug>BisectRight
nmap Æ <Plug>StopBisect
xmap ↓ <Plug>VisualBisectDown
xmap ↑ <Plug>VisualBisectUp
xmap ← <Plug>VisualBisectLeft
xmap → <Plug>VisualBisectRight
xmap Æ <Plug>VisualStopBisect
let g:bisect_disable_paging = 1
""" }}}
""" {{{ Command-T
nmap <silent> <Leader>t :CommandT<CR>
nmap <silent> <Leader>T :CommandTFlush<CR>
let g:CommandTToggleFocusMap = []
let g:CommandTSelectNextMap = ["<Tab>"]
let g:CommandTSelectPrevMap = ["<C-p>"]
""" }}}
""" {{{ Lusty Explorer
nmap <silent> <Leader>n :LustyBufferExplorer<CR>
nmap <silent> <Leader>G :LustyFilesystemExplorer<CR>
nmap <silent> <Leader>r :LustyFilesystemExplorerFromHere<CR>
""" }}}
""" {{{ Taglist
nmap <silent> <Leader>l :TlistOpen<CR>
nmap <silent> <Leader>L :TlistToggle<CR>
""" }}}
""" {{{ NERD Tree
nmap <silent> <Leader>h :call TreeOpenFocus()<CR>
nmap <silent> <Leader>H :NERDTreeToggle<CR>
""" }}}
""" {{{ BClose
nmap <silent> <Leader>d :Bclose<CR>
nmap <silent> <Leader>D :Bclose!<CR>
""" }}}
""" {{{ Operator-Replace
map <Leader>_ <Plug>(operator-replace)
""" }}}
""" {{{ LateX Suite
fun! RefreshTex()
let dir = getcwd()
cd %:p:h
silent call Tex_CompileLatex()
silent !pkill -USR1 xdvi
exe "cd " . dir
redraw!
endfun
nmap <Leader>z :call RefreshTex()<CR>
""" }}}
""" {{{ Git
nmap <Leader>gA :Git add<Space>
nmap <Leader>ga :Git add %<CR>
nmap <silent> <Leader>gsu :!sh -c "git stash; git svn rebase; git stash pop &> /dev/null; git status -uno; read -n1"<CR>:e<CR>
nmap <silent> <Leader>gsp :!sh -c "git stash; git svn dcommit; git stash pop &> /dev/null; read -n1"<CR>:e<CR>
nmap <silent> <Leader>gw :!sh -c "git pull --rebase origin master; read -n1"<CR>:e<CR>
nmap <silent> <Leader>gR :!sh -c "git stash && git pull origin master && git stash pop; read -n1"<CR>:e<CR>
nmap <silent> <Leader>gp :Git push origin master<CR>
nmap <silent> <Leader>gl :Gitv<CR>:redraw!<CR>
nmap <silent> <Leader>gL :Gitv!<CR>:redraw!<CR>
vmap <silent> <Leader>gl :Gitv!<CR>:redraw!<CR>
nmap <silent> <Leader>gc :Gcommit -a<CR>:redraw!<CR>
nmap <silent> <Leader>gC :Gcommit <CR>:redraw!<CR>
nmap <silent> <Leader>gS :Gstatus<CR>:redraw!<CR>
nmap <silent> <Leader>gd :Git diff<CR>:redraw!<CR>
nmap <silent> <Leader>gD :Git diff --cached<CR>:redraw!<CR>
nmap <silent> <Leader>gb :Gblame<CR>:redraw!<CR>
""" }}}
""" {{{ Gundo
nmap <Leader>gg :GundoToggle<CR><CR>:GundoFocus<CR>
""" }}}
"" }}}
"" {{{ Text objects
vnoremap iP :<C-U>silent! normal! }kV{jj<CR>
omap iP :normal ViP<CR>
"" }}}
" }}}
"" {{{ Configuration
"" {{{ Plugin configuration
""" {{{ Pathogen
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
""" }}}
""" {{{ Supertab
let g:SuperTabDefaultCompletionType = "<c-n>"
""" }}}
""" {{{ NERD Commenter
let NERDDefaultNesting = 1
""" }}}
""" {{{ NERD Tree
let NERDTreeIgnore = ['\~$', '\.pyc$', '\.swp$', '\.class$', '\.o$', '\.pyo$']
let NERDTreeSortOrder = ['\/$', '\.[ch]$', '\.py$', '*']
""" }}}
""" {{{ Taglist
let Tlist_Use_Right_Window = 1
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Show_One_File = 1
let Tlist_Enable_Fold_Column = 0
""" }}}
""" {{{ Python syntax
let python_highlight_all = 1
let python_highlight_space_errors = 0
""" }}}
""" {{{ Command-T
let g:CommandTMaxHeight = 10
let g:CommandTAlwaysShowDotFiles = 1
let g:CommandTScanDotDirectories = 1
let g:CommandTSelectPrevMap = ['<C-p>']
let g:CommandTSelectNextMap = ['<Tab>', '<C-n>']
""" }}}
""" {{{ snipMate
let g:snips_author = "Lucas de Vries"
let g:snips_mail = "[email protected]"
let g:snippets_dir = "~/.vim/snippets"
""" {{{ AutoPairs
let g:AutoPairsShortcutFastWrap = '<C-_>'
let g:AutoPairsCenterLine = 0
""" }}}
""" {{{ ZenCoding
let g:user_zen_settings = {'indentation': ' ',}
let g:user_zen_leader_key = '<C-t>'
""" }}}
""" {{{ Don't load ruby if we don't have it
if !has('ruby')
let g:command_t_loaded = 1
let g:loaded_lustyexplorer = 1
endif
""" }}}
""" {{{ EasyMotion
let g:EasyMotion_leader_key = '-'
let g:EasyMotion_keys = 'aoeuhtnsbcdfgijklmpqrvwxyz'
nmap -J -j
nmap -K -k
nmap -h -f
nmap -H -F
""" }}}
"" }}}
""" {{{ Powerline
let g:Powerline_symbols = 'unicode'
let g:Powerline_colorscheme = 'custom'
""" }}}
""" {{{ Gundo
let g:gundo_right = 1
""" }}}
"" {{{ Vim settings
""" {{{ General
" Use UTF-8 encoding
set encoding=utf-8
" Allow hidden buffers with changes
set hidden
" Keep files centralized, don't create swapfiles
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set noswapfile
" Data to store in the viminfo file
set viminfo='100,f1,<50,:50,/50,h,!
" File patterns to ignore in completions
set wildignore=*.o,*.d,*.pyc,*.pyo,.git,.svn
" Allow more memory
set maxmempattern=5000
" Don't use filetype indent
filetype on
filetype plugin on
filetype indent on
""" }}}
""" {{{ Display
" Characters to use in list mode
set listchars=tab:│\ ,trail:·
set list
" Always display statusline
set laststatus=2
" Show chain while typing
set showcmd
" Show search match while typing
set incsearch
" Show line and column number
set number
set ruler
" Show matching brackets when typed
set showmatch
" Number of lines from the edge to scroll
set scrolloff=3
" Display shorter messages
set shortmess=aAtI
" Don't show so many completions
set pumheight=8
" Highlight matches on a search
set hls
" Don't fold less than 2 lines
set foldminlines=2
" By default, marker folding
set fdm=marker
" Only fold one level by default
set fdn=1
" Highlight syntax
syntax on
""" }}}
""" {{{ Editing
" Text width
let g:textwidth=0
set textwidth=0
" Use actual block mode for visual block
set virtualedit=block
" Global match by default
set gdefault
" Smart case insensitive search
set ignorecase
set smartcase
""" }}}
""" {{{ Formatting
" Enter spaces when tab is pressed:
set expandtab
" Use 4 spaces to represent a tab
set tabstop=4
set softtabstop=4
" Number of spaces to use for auto indent
set shiftwidth=4
" Copy indent from current line when starting a new line
set autoindent
" Don't reindent on ::
set cinkeys=0{,0},0),0#,!^F,o,O,e")
" Allow backspacing over more items
set backspace=indent,eol,start
" Options for formatting blocks (gq)
set formatoptions=tcn12
" Don't display a user completion scratch window
set completeopt=menu,menuone
""" }}}
""" {{{ Colors
" Color Schemes
if $TERM == 'linux'
" Virtual Console
colorscheme delek
else
" Color terminal
set t_Co=256
colorscheme customleo
endif
""" }}}
"" }}}
"" }}}
" }}}
" {{{ Autocommands
"" {{{ Filetype detection
autocmd BufNewFile,BufRead *.{md,mkd,mark,markdown} set ft=markdown
autocmd BufNewFile,BufRead *.tex set ft=tex
autocmd BufNewFile,BufRead *.go set ft=go
autocmd BufNewFile,BufRead *.as set ft=cpp
autocmd BufNewFile,BufRead COMMIT_EDITMSG set ft=gitcommit
autocmd BufNewFile,BufRead *.ftl set ft=html
autocmd BufNewFile,BufRead *.fish set ft=fish
"" }}}
"" {{{ Filetype settings
" Files to indent with two spaces
autocmd FileType xhtml,html,xml,sass,tex,plaintex,yaml silent setlocal ts=2 sts=2 sw=2
" Git: Don't jump to last position, no modeline
autocmd FileType gitcommit call setpos('.', [0, 1, 1, 0])
autocmd FileType git setlocal nomodeline nolist
" Files to set default textwidth
autocmd FileType mail,tex setlocal textwidth=78
autocmd FileType mail,tex let b:textwidth=78
"" }}}
"" {{{ Filetype highlighting
" Python keywords
autocmd FileType python syn keyword Identifier self
autocmd FileType python syn keyword Type True False None
" Mail header highlighting
autocmd FileType mail hi link mailHeader Comment
autocmd FileType mail hi link mailSubject Function
"" }}}
"" {{{ Other
" Project-specifics
autocmd BufReadPost ~/projects/sr2/* set noet inc= lcs=tab:\ \ ,trail:· ff=dos
autocmd BufReadPost ~/projects/sr2/* syn keyword cRepeat foreach
autocmd BufReadPost ~/projects/sr2/* syn region Comment start=+\(class\)\?doc(+ end=+);+
autocmd BufReadPost /mnt/starruler/* set noet inc= lcs=tab:\ \ ,trail:·
autocmd BufReadPost /mnt/starruler/Game Data/*.txt set ft=starruler
autocmd BufReadPost /mnt/starruler/Locales/*.txt set ft=defs
" Rainbow Parenthesis
command Rainbow so ~/.vim/plugin/RainbowParenthsis.vim
autocmd BufReadPost * Rainbow
" Jump to last known cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
"" }}}
" }}}
" {{{ Functions
"" {{{ TreeOpenFocus(): Open the nerd tree or focus it.
function! TreeOpenFocus()
let wnr = bufwinnr("NERD_tree_1")
if wnr == -1
:NERDTreeToggle
else
exec wnr."wincmd w"
endif
endfunction
"" }}}
" vim:fdm=marker