-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
341 lines (290 loc) · 10.4 KB
/
vimrc
File metadata and controls
341 lines (290 loc) · 10.4 KB
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
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
filetype off
execute pathogen#infect()
let g:airline#extensions#tabline#enabled = 1
set guifont=Source\ Code\ Pro\ for\ Powerline
let g:airline_powerline_fonts = 1
syntax enable
filetype plugin indent on
set modelines=2
set background=dark
colorscheme desert
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Use syntax folding for most filetypes, but open all folds by default
autocmd Syntax c,cpp,vim,xml,html,xhtml,java,javascript setlocal foldmethod=syntax
autocmd Syntax c,cpp,vim,xml,html,xhtml,java,javascript,perl normal zR
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
autocmd Filetype python set tabstop=4
autocmd Filetype python set shiftwidth=4
autocmd Filetype python set smarttab
autocmd Filetype python set expandtab
autocmd Filetype python set softtabstop=0
autocmd Filetype python set autoindent
autocmd Filetype python set enc=utf-8
autocmd Filetype python set keywordprg=pydoc
autocmd Filetype python set iskeyword=a-z,A-Z,48-57,_,.
autocmd Filetype ruby set tabstop=2
autocmd Filetype ruby set shiftwidth=2
autocmd Filetype ruby set smarttab
autocmd Filetype ruby set expandtab
autocmd Filetype ruby set softtabstop=0
autocmd Filetype ruby set autoindent
autocmd Filetype ruby set enc=utf-8
autocmd Filetype sh set tabstop=2
autocmd Filetype sh set shiftwidth=2
autocmd Filetype sh set smarttab
autocmd Filetype sh set expandtab
autocmd Filetype sh set softtabstop=0
autocmd Filetype sh set autoindent
autocmd Filetype sh set enc=utf-8
autocmd Filetype zsh set tabstop=2
autocmd Filetype zsh set shiftwidth=2
autocmd Filetype zsh set smarttab
autocmd Filetype zsh set expandtab
autocmd Filetype zsh set softtabstop=0
autocmd Filetype zsh set autoindent
autocmd Filetype zsh set enc=utf-8
autocmd Filetype javascript set tabstop=2
autocmd Filetype javascript set shiftwidth=2
autocmd Filetype javascript set smarttab
autocmd Filetype javascript set expandtab
autocmd Filetype javascript set softtabstop=0
autocmd Filetype javascript set autoindent
autocmd Filetype javascript set enc=utf-8
autocmd Filetype coffee set tabstop=2
autocmd Filetype coffee set shiftwidth=2
autocmd Filetype coffee set smarttab
autocmd Filetype coffee set expandtab
autocmd Filetype coffee set softtabstop=0
autocmd Filetype coffee set autoindent
autocmd Filetype coffee set enc=utf-8
autocmd Filetype java set tabstop=4
autocmd Filetype java set shiftwidth=4
autocmd Filetype java set smarttab
autocmd Filetype java set expandtab
autocmd Filetype java set softtabstop=4
autocmd Filetype java set autoindent
autocmd Filetype java set enc=utf-8
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
autocmd Filetype css set tabstop=2
autocmd Filetype css set shiftwidth=2
autocmd Filetype css set smarttab
autocmd Filetype css set expandtab
autocmd Filetype css set softtabstop=2
autocmd Filetype css set autoindent
autocmd Filetype css set enc=utf-8
autocmd Filetype html set tabstop=2
autocmd Filetype html set shiftwidth=2
autocmd Filetype html set smarttab
autocmd Filetype html set expandtab
autocmd Filetype html set softtabstop=2
autocmd Filetype html set autoindent
autocmd Filetype html set enc=utf-8
autocmd Filetype velocity set tabstop=2
autocmd Filetype velocity set shiftwidth=2
autocmd Filetype velocity set smarttab
autocmd Filetype velocity set expandtab
autocmd Filetype velocity set softtabstop=2
autocmd Filetype velocity set autoindent
autocmd Filetype velocity set enc=utf-8
autocmd Filetype xml set tabstop=2
autocmd Filetype xml set shiftwidth=2
autocmd Filetype xml set smarttab
autocmd Filetype xml set expandtab
autocmd Filetype xml set softtabstop=2
autocmd Filetype xml set autoindent
autocmd Filetype xml set enc=utf-8
autocmd Filetype haml set tabstop=2
autocmd Filetype haml set shiftwidth=2
autocmd Filetype haml set smarttab
autocmd Filetype haml set expandtab
autocmd Filetype haml set softtabstop=2
autocmd Filetype haml set autoindent
autocmd Filetype haml set enc=utf-8
autocmd Filetype jade set tabstop=2
autocmd Filetype jade set shiftwidth=2
autocmd Filetype jade set smarttab
autocmd Filetype jade set expandtab
autocmd Filetype jade set softtabstop=2
autocmd Filetype jade set autoindent
autocmd Filetype jade set enc=utf-8
autocmd Filetype stylus set tabstop=2
autocmd Filetype stylus set shiftwidth=2
autocmd Filetype stylus set smarttab
autocmd Filetype stylus set expandtab
autocmd Filetype stylus set softtabstop=2
autocmd Filetype stylus set autoindent
autocmd Filetype stylus set enc=utf-8
autocmd Filetype less set tabstop=2
autocmd Filetype less set shiftwidth=2
autocmd Filetype less set smarttab
autocmd Filetype less set expandtab
autocmd Filetype less set softtabstop=2
autocmd Filetype less set autoindent
autocmd Filetype less set enc=utf-8
autocmd Filetype java nnoremap <silent> <buffer> <leader>i :JavaImport<cr>
autocmd Filetype java nnoremap <silent> <buffer> <leader>d :JavaDocSearch -x declarations<cr>
autocmd Filetype java nnoremap <silent> <buffer> <cr> :JavaSearchContext<cr>
autocmd Filetype ant set tabstop=2
autocmd Filetype ant set shiftwidth=2
autocmd Filetype ant set smarttab
autocmd Filetype ant set expandtab
autocmd Filetype ant set softtabstop=2
autocmd Filetype ant set autoindent
autocmd Filetype ant set enc=utf-8
autocmd Filetype make set tabstop=4
autocmd Filetype make set shiftwidth=4
autocmd Filetype make set smarttab
autocmd Filetype make set noexpandtab
autocmd Filetype make set autoindent
autocmd Filetype go set tabstop=4
autocmd Filetype go set shiftwidth=4
autocmd Filetype go set noexpandtab
autocmd Filetype go set autoindent
autocmd Filetype go set smarttab
autocmd Filetype go set enc=utf-8
autocmd Filetype sql set tabstop=2
autocmd Filetype sql set shiftwidth=2
autocmd Filetype sql set smarttab
autocmd Filetype sql set expandtab
autocmd Filetype sql set softtabstop=2
autocmd Filetype sql set autoindent
autocmd Filetype sql set enc=utf-8
autocmd Filetype markdown set tabstop=2
autocmd Filetype markdown set shiftwidth=2
autocmd Filetype markdown set smarttab
autocmd Filetype markdown set expandtab
autocmd Filetype markdown set softtabstop=2
autocmd Filetype markdown set autoindent
autocmd Filetype markdown set enc=utf-8
autocmd Filetype r set tabstop=2
autocmd Filetype r set shiftwidth=2
autocmd Filetype r set smarttab
autocmd Filetype r set expandtab
autocmd Filetype r set softtabstop=2
autocmd Filetype r set autoindent
autocmd Filetype r set enc=utf-8
autocmd Filetype hql set tabstop=2
autocmd Filetype hql set shiftwidth=2
autocmd Filetype hql set smarttab
autocmd Filetype hql set expandtab
autocmd Filetype hql set softtabstop=2
autocmd Filetype hql set autoindent
autocmd Filetype hql set enc=utf-8
else
set autoindent " always set autoindenting on
set foldmethod=syntax
set foldlevelstart=20
endif " has("autocmd")
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set autowrite " Automatically save before commands like :next and :make
set linebreak
set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes) in terminals
set nocp
set completeopt=menu
set wildignore=*.o,*.pyc,*.pyo
set ruler
set title
set scrolloff=3
set visualbell " make the bell visual
syntax on
set backspace=indent,eol,start
" backups/swap
set backupdir=~/.vim/tmp,.
set directory=~/.vim/tmp,.
"set nobackup
"set nowritebackup
set noswapfile
let mapleader = ","
" Don't use Ex mode, use Q for formatting
map Q gq
map <C-6> :e#<CR>
map! <C-6> <Esc>:e#<CR>
" key mappings
nnoremap ' `
nnoremap ` '
nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
nnoremap <leader>n :bn<CR>
nnoremap <leader>p :bp<CR>
nnoremap <leader>w :bw<CR>
nnoremap <leader>P :set paste!<CR>:set paste?<CR>
nnoremap <leader>b :set binary noeol<CR>
nnoremap <leader>m :! make<CR>
if &term =~ '^screen'
" tmux will send xterm-style keys when its xterm-keys option is on
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
endif
" highlight search terms
set hlsearch
set incsearch " Incremental search
nmap <silent> <leader>h :silent :nohlsearch<CR>
" catch trailing whitespace
set listchars=tab:>-,trail:·,eol:$
nmap <silent> <leader>s :set nolist!<CR>
" GUndo
function! MyGundoToggle()
let g:gundo_width = &columns / 4
GundoToggle
endfunction
nnoremap <leader>u :call MyGundoToggle()<CR>
let g:gundo_help = 0
" miniBufExplorer
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModeSelTarget = 1
" better change word
:nnoremap <leader>r :%s/\<<C-r><C-w>\>//g<Left><Left>
nmap pw :inoremap <lt>Space> <lt>Space><lt>Esc>:iunmap <lt>lt>Space><lt>CR><CR> cw
nmap p$ :inoremap <lt>CR> <lt>CR><lt>Esc>:iunmap <lt>lt>CR><lt>CR><CR> c$
" better tab completion
set wildmenu
set wildmode=longest,list,full
" Set tabstop, softtabstop and shiftwidth to the same value
command! -nargs=1 Stab call Stab(<args>)
function! Stab(size)
if a:size > 0
let &l:sts = a:size
let &l:ts = a:size
let &l:sw = a:size
endif
call SummarizeTabs()
endfunction
function! SummarizeTabs()
try
echohl ModeMsg
echon 'tabstop='.&l:ts
echon ' shiftwidth='.&l:sw
echon ' softtabstop='.&l:sts
if &l:et
echon ' expandtab'
else
echon ' noexpandtab'
endif
finally
echohl None
endtry
endfunction