-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
334 lines (281 loc) · 8.85 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
set nocp
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" General plugins {{{
Plugin 'scrooloose/syntastic'
Plugin 'sheerun/vim-polyglot'
Plugin 'scrooloose/nerdtree'
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-session'
Plugin 'embear/vim-localvimrc'
Plugin 'bling/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'majutsushi/tagbar'
Plugin 'yegappan/grep'
Plugin 'Yggdroot/indentLine'
Plugin 'DoxygenToolkit.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'rdnetto/YCM-Generator'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'Raimondi/delimitMate'
Plugin 'luochen1990/rainbow'
Plugin 'junegunn/vim-easy-align'
Plugin 'ryanoasis/vim-devicons'
Plugin 'tiagofumo/vim-nerdtree-syntax-highlight'
" Plugin 'SyntaxAttr.vim'
" }}}
" Language specific plugins {{{
" C and C++
Plugin 'a.vim'
Plugin 'vim-jp/vim-cpp'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'Conque-GDB'
Plugin 'rhysd/vim-clang-format'
" JS
Plugin 'kchmck/vim-coffee-script'
Plugin 'jelera/vim-javascript-syntax'
Plugin 'myhere/vim-nodejs-complete'
" GLSL
Plugin 'tikhomirov/vim-glsl'
" Ruby
Plugin 'vim-ruby/vim-ruby'
Plugin 'noprompt/vim-yardoc'
" Lua
Plugin 'raymond-w-ko/vim-lua-indent'
" Markdown
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
" Web
Plugin 'hail2u/vim-css3-syntax'
Plugin 'othree/html5.vim'
Plugin 'cakebaker/scss-syntax.vim'
" }}}
call vundle#end()
filetype plugin indent on
syntax on
" Settings {{{
" These really should be commented.
set autoindent
set backspace=indent,eol,start
set cindent
set cinoptions=g0
set cmdheight=1
set colorcolumn=80
set completeopt=menuone
set concealcursor=c
set conceallevel=2
set confirm
set cursorline
set encoding=utf-8
set expandtab
set ff=unix
set fileencodings=ucs-bom,utf-8,euc-jp,sjis,default,latin1
set fillchars=vert:█,fold:█
set foldcolumn=1
set foldmethod=marker
set foldtext=FoldText()
set formatoptions=croqlt
set hidden
set history=1000
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set lazyredraw
set linebreak
set mouse=a
set noerrorbells
set nolist
set noshowmode
set nostartofline
set notimeout
set number
set nuw=6
set re=1
set shiftwidth=4
set showmatch
set smartcase
set softtabstop=4
set spelllang=en_us
set switchbuf+=usetab,newtab
set t_Co=256
set t_vb=
set tabstop=4
set textwidth=80
set timeoutlen=1000
set title
set ttimeout
set ttimeoutlen=0
set updatetime=500
set visualbell
set wrap
" }}}
function! FoldText() " {{{
" example: █ function! FoldText() ████████ 12 lines █
let line = getline(v:foldstart)
let line = substitute(line, '^\s*\(#\|//\|/\*\|"\)\?\s*\|\s*\(#\|//\|/\*\|"\)\?\s*{{' . '{\d*\s*\(\*/\)\?', '', 'g')
let line = ' ' . line . ' '
let lines_count = v:foldend - v:foldstart + 1
let lines_count_text = ' ' . lines_count . ' lines '
let foldchar = matchstr(&fillchars, 'fold:\zs.')
let foldtextstart = strpart(repeat(foldchar, max([1, indent(v:foldstart)])) . line, 0, (winwidth(0)*2)/3)
let foldtextend = lines_count_text . repeat(foldchar, 8)
let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn + &nuw
return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend
endfunction " }}}
" Mappings {{{
" Alt Key helper for urxvt
if !has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
autocmd InsertEnter * set timeoutlen=0
autocmd InsertLeave * set timeoutlen=2000
augroup END
endif
function! Altmap(char)
if has('gui_running') | return ' <A-'.a:char.'> ' | else | return ' <Esc>'.a:char.' '|endif
endfunction
map <silent> <F2> :NERDTreeToggle \| :NERDTreeMirror<CR>
map <silent> <F3> :TagbarToggle<CR>
map <silent> <F4> :ccl<CR>
map <silent> <F5> :make! \| :copen<CR>
" Esc in insert mode
inoremap kj <Esc>
" Esc in command mode
cnoremap kj <Esc>
" Move tabs with shift + h/l
nnoremap <silent><S-h> :tabmove -1<CR>
nnoremap <silent><S-l> :tabmove +1<CR>
" Switch tabs with ctrl + h/l
nnoremap <silent><C-h> :tabp<CR>
nnoremap <silent><C-l> :tabn<CR>
" Switch HSplits with ctrl + j/k
nnoremap <silent><C-j> :wincmd j<CR>
nnoremap <silent><C-k> :wincmd k<CR>
" Switch splits with alt + hjkl
execute 'nnoremap <silent>'.Altmap('h').':wincmd h<CR>'
execute 'nnoremap <silent>'.Altmap('j').':wincmd j<CR>'
execute 'nnoremap <silent>'.Altmap('k').':wincmd k<CR>'
execute 'nnoremap <silent>'.Altmap('l').':wincmd l<CR>'
" Resize splits with shift + alt + hjkl
nnoremap <silent><S-A-h> :vertical resize -5<CR>
nnoremap <silent><S-A-j> :resize -5<CR>
nnoremap <silent><S-A-k> :resize +5<CR>
nnoremap <silent><S-A-l> :vertical resize +5<CR>
" Remove search highlighting with ctrl + n
noremap <silent><C-n> :nohl<CR>
inoremap <silent><C-n> <C-o>:nohl<CR>
" Map ctrl + s to save current buffer if it has been modified
noremap <silent><C-s> :update<CR>
" Map shift + s to write all buffers
noremap <silent><S-s> :wa<CR>
noremap <C-f> :GrepBuffer<Space>
inoremap <C-f> <C-o>:GrepBuffer<Space>
" ;/, + return moves to the end of the current line and puts ;/,
inoremap ;<CR> <End>;
inoremap ,<CR> <End>,
" space open/closes folds in normal mode
nnoremap <space> za
" space creates folds in visual mode
vnoremap <space> zf
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" autocomplete mappings
let g:ulti_expand_or_jump_res = 0
function! CRCompleteFunc()
let snippet = UltiSnips#ExpandSnippet()
if g:ulti_expand_res > 0
return snippet
endif
return "\<CR>"
endfunction
inoremap <expr><Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr><Down> pumvisible() ? "\<C-n>" : "\<Down>"
inoremap <expr><C-j> pumvisible() ? "\<C-n>" : "\<C-j>"
imap <expr><S-Tab> pumvisible() ? "\<C-p>" : "<Plug>delimitMateS-Tab"
inoremap <expr><Up> pumvisible() ? "\<C-p>" : "\<Up>"
inoremap <expr><C-k> pumvisible() ? "\<C-p>" : "\<C-k>"
imap <expr><CR> pumvisible() ? "<C-r>=CRCompleteFunc()<CR>" : "<Plug>delimitMateCR"
" }}}
map -a :call SyntaxAttr()<CR>
if filereadable('/proc/cpuinfo')
let &makeprg = 'make -j'.(system('grep -c ^processor /proc/cpuinfo')+1)
endif
let NERDTreeIgnore=[ '\.[ls]\?o$', '\~$' ]
let g:indentLine_char = '│'
let g:indentLine_bufNameExclude = [ 'NERD_tree.*' ]
let g:indentLine_setConceal = 0
let g:indentLine_color_gui = '#222222'
let g:indentLine_color_term = 236
let g:indentLine_color_tty = 236
let g:localvimrc_ask = 0
let g:load_doxygen_syntax = 1
let g:DoxygenToolkit_commentType = 'C++'
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
let g:ycm_extra_conf_globlist = ['~/Git/*']
let g:UltiSnipsUsePythonVersion = 3
let g:UltiSnipsJumpForwardTrigger = '<CR>'
let g:UltiSnipsJumpBackwardTrigger = '<S-Tab>'
let g:UltiSnipsEditSplit = 'vertical'
let delimitMate_expand_cr = 2
let delimitMate_expand_space = 1
let g:rainbow_active = 1
let g:rainbow_conf = {
\ 'guifgs': ['#94aad1', '#8ab4be', '#edc472', '#c98dad'],
\ 'ctermfgs': ['12', '14', '11', '13'],
\ 'operators': '_!\|=\|&\|\.\|:\|;\|,\|<\|>\|+\|-\|\/\@<!\*\|\/\(\/\|\*\)\@!_',
\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'],
\ 'separately': {
\ '*': {},
\ 'cpp': {
\ 'parentheses': [
\ 'start=/(/ end=/)/ fold',
\ 'start=/\[/ end=/\]/ fold',
\ 'start=/{/ end=/}/ fold',
\ 'start=/\(\(\<operator\>\)\@<!<\)\&[a-zA-Z0-9_]\@<=<\ze[^<]/ end=/>/']
\ },
\ }
\}
let g:syntastic_stl_format = ''
let g:syntastic_c_auto_refresh_includes = 1
let g:syntastic_cpp_no_include_search = 1
let g:syntastic_cpp_compiler_options = '-std=c++14'
let g:airline_theme = 'powerlineish'
let g:airline_powerline_fonts = 1
let g:airline#extensions#hunks#non_zero_only = 1
let g:ruby_indent_access_modifier_style = 'outdent'
let g:licenses_authors_name = 'ahoka'
set sessionoptions-=help
set sessionoptions-=options
set sessionoptions+=resize
set sessionoptions+=tabpages
let g:session_autosave = 'yes'
let g:session_autoload = 'yes'
let g:session_autosave_periodic = 5
let g:session_default_to_last = 1
let g:session_persist_globals = [ '&expandtab' ]
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
" Trim trailing whitespace
au FileType c,cpp,coffee,java,ruby,python,sh au BufWritePre * :%s/\s\+$//e | :call histdel('/', -1)
au FileType gitcommit,markdown setl spell
au FileType cpp setl cindent cino=j1,(0,ws,Ws
au FileType coffee,html,lua,perl,python,ruby,sh,xml setl shiftwidth=2 softtabstop=2 tabstop=2
au FileType css set omnifunc=csscomplete#CompleteCSS | setlocal iskeyword+=-
let g:hybrid_use_Xresources = 1
colorscheme ahoka
" GVim {{{
set guioptions=+a
set guifont=ProFont
set guicursor=n-v-c:block-Cursor
set guicursor+=i:block-Cursor
set guicursor+=n-v-c:blinkon0
set guicursor+=i:blinkon0
" }}}