-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
367 lines (318 loc) · 9.2 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
if has('python3')
silent! python3 1
endif
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin('$HOME/.vim/bundle')
Plugin 'VundleVim/Vundle.vim'
" Automatic {
Plugin 'Valloric/YouCompleteMe'
Plugin 'Raimondi/delimitMate'
Plugin 'tpope/vim-surround'
Plugin 'vim-scripts/CmdlineComplete'
"Plugin 'python-mode/python-mode'
Plugin 'junegunn/vim-easy-align'
" Plugin '907th/vim-auto-save'
" Plugin 'terryma/vim-multiple-cursors'
" Plugin 'fatih/vim-go'
" Plugin 'sirver/ultisnips'
" Plugin 'honza/vim-snippets'
" }
" Looking {
Plugin 'nathanaelkane/vim-indent-guides'
" Plugin 'kien/rainbow_parentheses.vim'
" Plugin 'luochen1990/rainbow'
Plugin 'frazrepo/vim-rainbow'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'jeffkreeftmeijer/vim-numbertoggle'
" Plugin 'itchyny/lightline.vim'
" }
" Utility {
Plugin 'scrooloose/nerdtree'
" Plugin 'junegunn/fzf'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'easymotion/vim-easymotion'
Plugin 'tpope/vim-sensible'
Plugin 'tpope/vim-repeat'
Plugin 'chrisbra/vim-diff-enhanced'
Plugin 'mbbill/undotree'
" Plugin 'sjl/gundo.vim'
" Plugin 'VisIncr'
" Allow saving of files when I forgot to start vim with sudo.
Plugin 'tpope/vim-eunuch'
" cmap w!! w !sudo tee > /dev/null %
" }
" Programming {
Plugin 'dense-analysis/ale'
Plugin 'tpope/vim-commentary'
Plugin 'nvie/vim-flake8'
Plugin 'rking/ag.vim'
" Plugin 'alfredodeza/pytest.vim'
Plugin 'google/yapf'
" Plugin 'vim-syntastic/syntastic'
" Plugin 'scrooloose/nerdcommenter'
" }
" git {
Plugin 'tpope/vim-fugitive'
" Plugin 'airblade/vim-gitgutter'
" }
" Tmux {
Plugin 'tmux-plugins/vim-tmux'
Plugin 'tmux-plugins/vim-tmux-focus-events'
Plugin 'edkolev/tmuxline.vim'
" }
call vundle#end()
" filetype plugin on
syntax enable
filetype plugin indent on
" Last Position {
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" }
" cool settings without plugins {
" 1. Search down into sub-folders
set path+=**
set wildmenu
" 2. Make Tags inner vim
command! MakeTags !ctags -R .
" 3. Don't forget ^x^.
" }
" 4. Tweaks for browsing
let g:netrw_branner=0
let g:netrw_browser_split=4
let g:netrw_altv=1
let g:netrw_liststyle=3
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
set tabstop=4
set shiftwidth=4
set softtabstop=4
set smarttab
set shiftround
set expandtab
set noshowmode
set mouse-=a
set nowrap
set number
set relativenumber
set ruler
set pastetoggle=<F3>
set tabpagemax=20
set cursorline
set cursorcolumn
set colorcolumn=79
set textwidth=79
set hlsearch
set incsearch
set backspace=indent,eol,start
set laststatus=2
set autoindent
set formatoptions=trocq
set noswapfile
set hidden
set complete=k,.,w,b,u,t,i
set nofixendofline
set updatetime=300
let mapleader=','
" let maplocalleader='.'
" }
" AutoSave {
" let g:auto_save = 1 " enable AutoSave on Vim startup"
" let g:auto_save_events = ["InsertLeave", "CursorHold", "CursorHoldI"]
" let g:auto_save_write_all_buffers = 1 " write all open buffers as if you would use :wa"
" let g:auto_save_presave_hook = 'call AbortIfNotGitDirectory()'
" }
" Diff Options {
set diffopt+=algorithm:patience
set diffopt+=indent-heuristic
" }
" Fold {
set foldmethod=indent
set foldnestmax=999
set foldminlines=200
let python_highlight_all = 1
"set foldcolumn=5
" }
" Color {
set background=light
colorscheme evening
hi ColorColumn cterm=None ctermbg=darkred guibg=black
hi CursorColumn cterm=None ctermbg=black guibg=black
hi CursorLine cterm=UnderLine ctermbg=NONE guibg=NONE
hi Normal guibg=NONE ctermbg=NONE
set term=screen-256color
hi LeadingSpace ctermbg=darkblue guibg=Black
match LeadingSpace /^\s\+/
"hi EndingExcess ctermbg=red guibg=Black
"match EndingExcess /\%81v.*/
hi EndingBlank ctermbg=red guibg=Black
match EndingBlank /\s\+$/
" }
" SpellBad {
setlocal spell spelllang=en_us
hi clear SpellBad
hi SpellBad cterm=underline
" }
"
" Undo {
nnoremap <F5> :UndotreeToggle<cr>
set undodir=~/.vim/undo
set undofile
" }
" airline {
"let g:tmuxline_theme = 'airline_insert'
set encoding=utf-8
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tmuxline#enabled = 0
let g:airline#extensions#tabline#formatter = 'default'
let g:Powerline_symbols='unicode'
"set guifont=DroidSansMono\ Nerd\ Font
" }
" indent_guides {
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_guide_size = 1
let g:indent_guides_start_level = 2
let g:indent_guides_auto_colors = 0
hi IndentGuidesOdd ctermbg=gray
hi IndentGuidesEven ctermbg=darkgray
" }
" SyntasticCheck {
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_loc_list_height=5
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 1
let g:syntastic_python_checkers = ['flake8', 'pylint']
let g:syntastic_quiet_messages = {
\ "!level": "errors",
\ "type": "style",
\ "regex": '.*',
\ "file:p": '.*' }
map <F3> :SyntasticCheck python<CR>
" }
" pylint{
let g:pymode_lint_write = 0 "turn off running pylint on file save
nnoremap <leader>p :PyLint<cr> "pressing ,p will run plyint on current buffer"
" }
" Flake8{
let g:PyFlakeOnWrite = 1
let g:PyFlakeCheckers = 'pep8,mccabe,frosted'
let g:pyflakes_use_quickfix = 0
" }
" { Sliver searcher
" }
" UltiSnips {
" Trigger configuration.
" Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<left-shift>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
" }
" YouCompleteMe {
let g:ycm_global_ycm_extra_conf = '~/user/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py'
let g:ycm_python_binary_path = 'python'
let g:ycm_confirm_extra_conf = 1
let g:ycm_extra_conf_globlist = ['~/dev/*','!~/*']
let g:ycm_key_list_select_completion = ['<TAB>', '<Down>']
" }
" CtrlP {
let g:ctrlp_map = '<c-p>'
let g:ctrlp_prompt_mappings = { 'PrtCurLeft()': ['<left>', '<c-^>'] }
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_max_history = &history
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
let g:ctrlp_arg_map = 1
let g:ctrlp_open_new_file = 'h'
let g:ctrlp_open_multiple_files = 'h'
let g:ctrlp_reuse_window = 'netrw\|help\|quickfix'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/.git/*,*/.hg/*,*/.svn/*
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ 'link': 'some_bad_symbolic_links',
\ }
" }
" NerdTree {
map <c-a> :NERDTreeToggle<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
" }
" Easy-Align {
" 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)
" }
"Easy Motion {
" <Leader>f{char} to move to {char}
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
" " s{char}{char} to move to {char}{char}
nmap <Leader>s <Plug>(easymotion-overwin-f2)
"" Move to line
map <Leader><Leader>g <Plug>(easymotion-bd-jk)
nmap <Leader><Leader>g <Plug>(easymotion-overwin-line)
" "" Move to word
map <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w
" }
" rainbow Parentheses
let g:rainbow_active = 1
let g:rainbow_ctermfgs = ['lightblue', 'yellow', 'lightgreen', 'red', 'magenta', 'blue']
" }
" cscope {
if has("cscope")
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
map <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
endif
" GNU Global
let GtagsCscope_Auto_Load = 1
let GtagsCscope_Auto_Map = 1
let GtagsCscope_Quiet = 1
" }
" gitgutter {
" let g:gitgutter_override_sign_column_highlight = 0
" highlight SignColumn ctermbg=red " terminal Vim
" highlight SignColumn guibg=darkred " gVim/MacVim
" if exists('&signcolumn') " Vim 7.4.2201
" set signcolumn=yes
" else
" let g:gitgutter_sign_column_always = 1
" endif
" }
" Pytest {
nmap <silent><leader>f <Esc>:Pytest file<CR>
"nmap <silent><Leader>c <Esc>:Pytest class<CR>
"nmap <silent><Leader>m <Esc>:Pytest method<CR>
"nmap <silent><Leader>s <Esc>:Pytest session<CR>
" }
" ALE {
" let b:ale_linters = ['pylint', 'flake8']
" let b:ale_fixers = ['autopep8', 'remove_trailing_lines']
nmap <silent> <leader>n :ALENext<cr>
nmap <silent> <leader>N :ALEPrevious<cr>
" " nnoremap <buffer> <silent> <LocalLeader>= :ALEFix<CR>
" }
" Google formater {
" autocmd FileType python nnoremap <LocalLeader>= :0,$!yapf<CR>
" }
" fix: RuntimeError: Cannot find Python interpreter path python.
let g:ycm_python_binary_path='python3'