-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
315 lines (263 loc) · 8.28 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
"
" Author: Ash<[email protected]>
"
" Execute pathogen right away
execute pathogen#infect()
execute pathogen#helptags()
" Set the shell (to avoid errors)
set shell=/bin/sh
" Disable compatibility mode (VIM mode)
set nocompatible
" Most terminal emulators have mouse support, enable it
if has('mouse')
set mouse=a
endif
" Use ',' key as the leader instead of '\'
let mapleader = ','
" Don't use Ex mode, use Q for formatting
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
inoremap <C-U> <C-G>u<C-U>
" Enable filetype plugin
filetype plugin on
" Enable indentation
filetype indent on
" Soft tabs with four character width
set expandtab
set shiftwidth=4
set softtabstop=4
set smarttab
" Always display ruler
set ruler
" Enable syntax
syntax enable
" Enable Search highighting
set hlsearch
" Disable the omnicomplete preview window (causes flickering with the
" statusline)
set completeopt-=preview
" Build room in Status line for plugins like airline, powerline to render
" their stuff even in non-split windows
set laststatus=2
" Hide the default mode text below the Status line
set noshowmode
" Set character encoding to UTF8
set encoding=utf-8
" Persist the global variables across sessions
set viminfo+=!
" Enable persistent undo across vim sessions
if has("persistent_undo")
set undofile
set undodir=~/.vimundo
endif
" New windows don't cause all windows to be resized to equal sizes
set noequalalways
" Setup for vimdiff
" Call this only in diff mode
func! VimDiffSetup()
" Set the same filetype for both the diff windows
if len(&ft)
call setwinvar(2/winnr(),'&ft',&ft)
else
let &ft=getwinvar(2/winnr(),'&ft')
endif
" Disable folding in diff mode
set nofoldenable foldcolumn=0
wincmd b
set nofoldenable foldcolumn=0
endfun
" GUI related stuff
if has("gui_running")
" Diff setup
if &diff
" set columns=200
" Setup on loading vimdiff
augroup SmartDiffSetup
autocmd!
autocmd VimEnter * :call VimDiffSetup()
augroup END
else
" set columns=100
endif
" Set GUI Font
if has('mac')
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline:h12
elseif has('unix')
set guifont=DejaVu\ Sans\ Mono\ 11
else
" Godsave this OS :P
endif
" Set geometry
set columns=250
set lines=70
endif
" Set up colorscheme
colorscheme MolokaiSaber
" Enable doxygen for c, cpp and idl files
let g:load_doxygen_syntax = 1
let g:doxygen_enhanced_color = 1
" Disable P4 Active Status
let g:p4EnableActiveStatus = 0
" Disable RST foldoing
augroup DisableRstFolding
autocmd!
autocmd Filetype rst setlocal nofoldenable
augroup END
" Set Java syntax highlighting for *.aidl
augroup AidlAsjava
autocmd!
autocmd BufReadPost *.aidl set syntax=java
augroup END
" Set Makefile syntax highlighting for *.inc
augroup IncAsMakefiles
autocmd!
autocmd BufReadPost *.inc set syntax=make
augroup END
" Set Thrift syntax highlighting for *.thrift
augroup ThriftAsThrift
autocmd!
autocmd BufReadPost *.thrift set syntax=thrift
augroup END
" Set Smali syntax highlighting for *.smali
augroup SmaliAsSmali
autocmd!
autocmd BufReadPost *.smali set syntax=smali
augroup END
" Set 2 spaces for Javascript
augroup JavascriptSoftTabs
autocmd!
autocmd Filetype javascript setlocal shiftwidth=4 softtabstop=4 expandtab
augroup END
" go fmt uses hard tabs for formatting
" Just in vim use 4 spaces but file still will have hard tabs
augroup GoFmtTabs
autocmd!
au BufNewFile,BufRead *.go setlocal tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab
augroup END
"=============================================================================
" BEGIN TMUX
"=============================================================================
if &term =~ '^screen'
" Extended mouse mode in tmux
set mouse+=a
set ttymouse=xterm2
" tmux sends xterm-style keys when 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"
execute "set <xHome>=\e[1;*H"
execute "set <xEnd>=\e[1;*F"
execute "set <Insert>=\e[2;*~"
execute "set <Delete>=\e[3;*~"
execute "set <PageUp>=\e[5;*~"
execute "set <PageDown>=\e[6;*~"
execute "set <xF1>=\e[1;*P"
execute "set <xF2>=\e[1;*Q"
execute "set <xF3>=\e[1;*R"
execute "set <xF4>=\e[1;*S"
execute "set <F5>=\e[15;*~"
execute "set <F6>=\e[17;*~"
execute "set <F7>=\e[18;*~"
execute "set <F8>=\e[19;*~"
execute "set <F9>=\e[20;*~"
execute "set <F10>=\e[21;*~"
execute "set <F11>=\e[23;*~"
execute "set <F12>=\e[24;*~"
endif
"=============================================================================
" END TMUX
"=============================================================================
"=============================================================================
" BEGIN PLUGINS
"=============================================================================
" CtrlP Plugin stuff
let g:ctrlp_map = '<C-P>'
let g:ctrlp_cmd = 'CtrlPBuffer'
let g:ctrlp_show_hidden = 1
let g:ctrlp_root_markers = ['build.config']
let g:ctrlp_max_height = 25
let g:ctrlp_max_files = 500000
let g:ctrlp_regexp = 1
"let g:ctrlp_user_command = 'find %s ( -type f -o -type l)'
let g:ctrlp_lazy_update = 1
let ctrlp_filter_greps = "".
\ "egrep -iv '\\.(" .
\ "jar|class|swp|swo|log|a|d|so|o|pyc|jpe?g|png|gif|mo|po" .
\ ")$' | " .
\ "egrep -v '^(\\./)?(" .
\ "deploy/|lib/|classes/|libs/|deploy/vendor/|.git/|.hg/|.svn/|.*migrations/" .
\ ")'"
let ctrlp_git_command = "" .
\ "cd %s && git ls-files . -co --exclude-standard | " .
\ ctrlp_filter_greps
let ctrlp_fallback_user_command = "" .
\ "find %s '(' -type f -or -type l ')' -maxdepth 15 -not -path '*/\\.*/*' | " .
\ ctrlp_filter_greps
let g:ctrlp_user_command = ['.git/', ctrlp_git_command, ctrlp_fallback_user_command]
call ctrlp_bdelete#init()
nnoremap <silent> <C-L> :CtrlP<CR>
" Riv plugin
let g:riv_fold_auto_update = 0
" tagbar plugin
nnoremap <silent> <Leader>t :TagbarToggle<CR>
let g:tagbar_map_prevtag = "<C-M>"
" easytags plugin
let g:easytags_async = 1
let g:easytags_languages = {
\ 'javascript': {
\ 'cmd': 'jsctags',
\ 'args': [],
\ 'fileoutput_opt': '-f',
\ 'stdout_opt': '-f-',
\ 'recurse_flag': '-R'
\ }
\}
" Mark Plugin
let g:mwDefaultHighlightingPalette = 'extended'
let g:mwAutoLoadMarks = 1
let g:mwAutoSaveMarks = 1
nnoremap <Plug>IgnoreMarkSearchNext <Plug>MarkSearchNext
nnoremap <Plug>IgnoreMarkSearchPrev <Plug>MarkSearchPrev
" YouCompleteMe plugin
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
" jedi plugin
augroup JediDisablePreviewForPython
autocmd!
autocmd FileType python setlocal completeopt-=preview
augroup END
" nerdtree plugin
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
nnoremap <F3> :NERDTreeToggle<CR>
" Indent Guide plugin
let g:indent_guides_auto_colors = 0
let g:indent_guides_start_level = 2
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_guide_size=1
" undotree plugin
let g:undotree_SetFocusWhenToggle = 1
let g:undotree_SplitWidth = 25
nnoremap <silent> <Leader>u :UndotreeToggle<CR>
" Airline - Setup using powerline symbols
let g:airline_exclude_preview = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = ''
let g:airline_theme='powerlineish'
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
"============================================================================
" END PLUGINS
"============================================================================
" Source the RPM related goodies
source ~/.vim/.vimrc-rpm.vim
" ~/.vimrc ends here