-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
286 lines (270 loc) · 7.71 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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set number
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936
set fileencoding=gb2312
set termencoding=utf-8
set autoindent
set sw=4
set ts=4
" set text width to 80
set tw=80
set colorcolumn=80
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=2
set expandtab
let mapleader = ","
" for ctags
set autochdir
set tags+=./tags;
" for ctrlp.
set splitright
set winwidth=85
nnoremap <c-u> viwlU
" open vimrc and save vimrc
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" map c-[ to esc
noremap <c-[> <esc>
syntax enable
set background=dark
let g:solarized_termcolors=256
" nnoremap <C-N> :bn<CR>
nnoremap <C-P> :bp<CR>
" When using tmux as screen-256color, use following lines to fix mapping problem.
if $TERM == 'screen-256color'
map <esc>[[19~ <f8>
endif
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'kien/ctrlp.vim'
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
if executable('ag')
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
endif
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|jpg|png)$'
\ }
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:20'
let g:ctrlp_working_path_mode = 'rw'
Plugin 'taglist.vim'
let Tlist_Ctags_Cmd='ctags'
let Tlist_Show_One_File=1
let Tlist_WinWidt =28
let Tlist_Exit_OnlyWindow=1
let Tlist_Use_Right_Window=1
let Tlist_Use_Left_Windo =1
Plugin 'bling/vim-airline'
let g:airline_theme="molokai"
"let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
Plugin 'vim-airline/vim-airline-themes'
Plugin 'Solarized'
Plugin 'easymotion/vim-easymotion'
map <Leader><Leader> <Plug>(easymotion-prefix)
Plugin 'Valloric/YouCompleteMe'
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
set completeopt=menu,menuone
let g:ycm_add_preview_to_completeopt = 0
let g:ycm_server_python_interpreter='/usr/bin/python3'
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
Plugin 'scrooloose/nerdtree'
let g:NERDTreeChDirMode = 2
map <c-n> :NERDTreeToggle<CR>
Plugin 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'
Plugin 'majutsushi/tagbar'
nnoremap <f8> :TagbarToggle<CR>
let g:UltiSnipsExpandTrigger="<c-h>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
Plugin 'scrooloose/nerdcommenter'
Plugin 'tpope/vim-surround'
" for markdown syntax.
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'jiangmiao/auto-pairs'
filetype plugin on
call vundle#end() " required
filetype plugin indent on " required
" from https://gist.github.com/goerz/36015f27c2a5423c64a5f9dc03865f2c
" Terminal fixes
"
" These originate from some linux distribution's system vimrc. I can't say
" that I understand the details what's going on here, but without these
" settings, I've had problems like vim starting in REPLACE mode for
" TERM=xterm-256color (neovim is fine)
if &term =~? 'xterm'
let s:myterm = 'xterm'
else
let s:myterm = &term
endif
let s:myterm = substitute(s:myterm, 'cons[0-9][0-9].*$', 'linux', '')
let s:myterm = substitute(s:myterm, 'vt1[0-9][0-9].*$', 'vt100', '')
let s:myterm = substitute(s:myterm, 'vt2[0-9][0-9].*$', 'vt220', '')
let s:myterm = substitute(s:myterm, '\\([^-]*\\)[_-].*$', '\\1', '')
" Here we define the keys of the NumLock in keyboard transmit mode of xterm
" which misses or hasn't activated Alt/NumLock Modifiers. Often not defined
" within termcap/terminfo and we should map the character printed on the keys.
if s:myterm ==? 'xterm' || s:myterm ==? 'kvt' || s:myterm ==? 'gnome'
" keys in insert/command mode.
map! <ESC>Oo :
map! <ESC>Oj *
map! <ESC>Om -
map! <ESC>Ok +
map! <ESC>Ol ,
map! <ESC>Ow 7
map! <ESC>Ox 8
map! <ESC>Oy 9
map! <ESC>Ot 4
map! <ESC>Ou 5
map! <ESC>Ov 6
map! <ESC>Oq 1
map! <ESC>Or 2
map! <ESC>Os 3
map! <ESC>Op 0
map! <ESC>On .
" keys in normal mode
map <ESC>Oo :
map <ESC>Oj *
map <ESC>Om -
map <ESC>Ok +
map <ESC>Ol ,
map <ESC>Ow 7
map <ESC>Ox 8
map <ESC>Oy 9
map <ESC>Ot 4
map <ESC>Ou 5
map <ESC>Ov 6
map <ESC>Oq 1
map <ESC>Or 2
map <ESC>Os 3
map <ESC>Op 0
map <ESC>On .
endif
" xterm but without activated keyboard transmit mode
" and therefore not defined in termcap/terminfo.
if s:myterm ==? 'xterm' || s:myterm ==? 'kvt' || s:myterm ==? 'gnome'
" keys in insert/command mode.
map! <Esc>[H <Home>
map! <Esc>[F <End>
" Home/End: older xterms do not fit termcap/terminfo.
map! <Esc>[1~ <Home>
map! <Esc>[4~ <End>
" Up/Down/Right/Left
map! <Esc>[A <Up>
map! <Esc>[B <Down>
map! <Esc>[C <Right>
map! <Esc>[D <Left>
" KP_5 (NumLock off)
map! <Esc>[E <Insert>
" PageUp/PageDown
map <ESC>[5~ <PageUp>
map <ESC>[6~ <PageDown>
map <ESC>[5;2~ <PageUp>
map <ESC>[6;2~ <PageDown>
map <ESC>[5;5~ <PageUp>
map <ESC>[6;5~ <PageDown>
" keys in normal mode
map <ESC>[H 0
map <ESC>[F $
" Home/End: older xterms do not fit termcap/terminfo.
map <ESC>[1~ 0
map <ESC>[4~ $
" Up/Down/Right/Left
map <ESC>[A k
map <ESC>[B j
map <ESC>[C l
map <ESC>[D h
" KP_5 (NumLock off)
map <ESC>[E i
" PageUp/PageDown
map <ESC>[5~
map <ESC>[6~
map <ESC>[5;2~
map <ESC>[6;2~
map <ESC>[5;5~
map <ESC>[6;5~
endif
" xterm/kvt but with activated keyboard transmit mode.
" Sometimes not or wrong defined within termcap/terminfo.
if s:myterm ==? 'xterm' || s:myterm ==? 'kvt' || s:myterm ==? 'gnome'
" keys in insert/command mode.
map! <Esc>OH <Home>
map! <Esc>OF <End>
map! <ESC>O2H <Home>
map! <ESC>O2F <End>
map! <ESC>O5H <Home>
map! <ESC>O5F <End>
" Cursor keys which works mostly
" map! <Esc>OA <Up>
" map! <Esc>OB <Down>
" map! <Esc>OC <Right>
" map! <Esc>OD <Left>
map! <Esc>[2;2~ <Insert>
map! <Esc>[3;2~ <Delete>
map! <Esc>[2;5~ <Insert>
map! <Esc>[3;5~ <Delete>
map! <Esc>O2A <PageUp>
map! <Esc>O2B <PageDown>
map! <Esc>O2C <S-Right>
map! <Esc>O2D <S-Left>
map! <Esc>O5A <PageUp>
map! <Esc>O5B <PageDown>
map! <Esc>O5C <S-Right>
map! <Esc>O5D <S-Left>
" KP_5 (NumLock off)
map! <Esc>OE <Insert>
" keys in normal mode
map <ESC>OH 0
map <ESC>OF $
map <ESC>O2H 0
map <ESC>O2F $
map <ESC>O5H 0
map <ESC>O5F $
" Cursor keys which works mostly
" map <ESC>OA k
" map <ESC>OB j
" map <ESC>OD h
" map <ESC>OC l
map <Esc>[2;2~ i
map <Esc>[3;2~ x
map <Esc>[2;5~ i
map <Esc>[3;5~ x
map <ESC>O2A ^B
map <ESC>O2B ^F
map <ESC>O2D b
map <ESC>O2C w
map <ESC>O5A ^B
map <ESC>O5B ^F
map <ESC>O5D b
map <ESC>O5C w
" KP_5 (NumLock off)
map <ESC>OE i
endif
if s:myterm ==? 'linux'
" keys in insert/command mode.
map! <Esc>[G <Insert>
" KP_5 (NumLock off)
" keys in normal mode
" KP_5 (NumLock off)
map <ESC>[G i
endif
" This escape sequence is the well known ANSI sequence for
" Remove Character Under The Cursor (RCUTC[tm])
map! <Esc>[3~ <Delete>
map <ESC>[3~ x