-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmy_configs.vim
251 lines (214 loc) · 8.28 KB
/
my_configs.vim
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
set nu
set relativenumber
set clipboard=unnamedplus
set nowrap " Do not wrap long lines
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
"""""""""""""""""
"nerdtree
"“”“”“”“”“”“”“”“
"close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | end
"close vim if the only window left open is a quickfix
aug QFClose
au!
au WinEnter * if winnr('$') == 1 && getbufvar(winbufnr(winnr()), "&buftype") == "quickfix"|q|endif
aug END
" s/v open file
let g:NERDTreeMapOpenSplit = 's'
let g:NERDTreeMapOpenVSplit = 'v'
"""""""""""""""""
"vim-easy-align
"“”“”“”“”“”“”“”“
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
"""""""""""""""""
"Rainbow
"“”“”“”“”“”“”“”“
let g:rbpt_colorpairs = [
\ [ '1', '#dc322f'],
\ [ '9', '#cb4b16'],
\ [ '13', '#6c71c4'],
\ [ '2', '#859900'],
\ [ '6', '#2aa198'],
\ [ '3', '#b58900'],
\ [ '5', '#d33682'],
\ [ '4', '#268bd2'],
\ ]
" Nesting level to stop coloring at.
" This does shift what colors the upper nests will be if changed.
let g:rbpt_max = 16
" Enable rainbow parentheses for all buffers
augroup rainbow_parentheses
au!
au VimEnter * RainbowParenthesesActivate
au BufEnter * RainbowParenthesesLoadRound
au BufEnter * RainbowParenthesesLoadSquare
au BufEnter * RainbowParenthesesLoadBraces
augroup END
""""""""""""""""""""""""""""""
" airline
""""""""""""""""""""""""""""""
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_theme = 'powerlineish'
"" enable/disable fugitive/lawrencium integration >
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#syntastic#enabled = 1
" unicode symbols
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.whitespace = 'Ξ'
" powerline symbols
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 = ''
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_python_checkers=['flake8']
let g:syntastic_python_flake8_args='--ignore=E111,E114,E121,E501'
let g:pymode_rope = 0
let g:pymode_lint = 0
"let g:pymode_lint_ignore = "E111,E114,E121,E501"
let g:pymode_rope_completion = 0
"let g:pymode_lint_on_write = 1
let g:pymode_trim_whitespaces = 0
let g:pymode_motion = 1
"tagbar appears on the left
let g:tagbar_left=1
let g:rainbow_active = 1
"changed the ~/.vim/bundle/python-mode/after/indent/python.vim: indentkeys No :,shiftwidth=2
"basic.vim cancled trailing space in python/coffe deletion
"select all
map <Leader>sa :%y+<CR>
"for esc
imap jj <Esc>
"copy current file path to clipboard
:nmap cp :let @+ = expand("%")<CR><CR>
"vmap <C-c> "+y
"vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+pa
let g:syntastic_check_on_open=1
let g:syntastic_enable_signs=1
" If you prefer the Omni-Completion tip window to close when a selection is
" made, these lines close it on movement in insert mode or when leaving
" insert mode
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
let g:ack_wildignore = 0
let g:acp_enableAtStartup = 0
" enable completion from tags
let g:ycm_collect_identifiers_from_tags_files = 1
nnoremap <leader>j :YcmCompleter GoToDefinitionElseDeclaration<CR>
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
let g:ycm_seed_identifiers_with_syntax=1
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsListSnippets="<c-e>"
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
" Disable the neosnippet preview candidate window
" When enabled, there can be too much visual noise
" especially when splits are used.
set completeopt-=preview
"command line paste
cnoremap <C-v> <C-R>+
"nnoremap y "+y
"vnoremap y "+y
" Yank from the cursor to the end of the line, to be consistent with C and D.
nnoremap Y y$
function! GetRepoPath()
let path = system("git rev-parse --show-toplevel")
return path[:-2]
endfunction
"change to root the of the repo
map <leader>h :cd <c-r>=GetRepoPath()<cr><cr>
"Auto haskell type inference
map <leader>k :GhcModType <cr>
autocmd filetype haskell nnoremap <leader>kk :GhcModTypeClear <cr>
" Open ack and put the cursor in the right position
map <leader>g :Ack <C-R>=GetRepoPath()<CR><C-A><right><right><right><right>
" ack in the current file
map <leader><space> :Ack <C-R>%<C-A><right><right><right><right>
nnoremap <F12> :TlistToggle<CR>
"not auto folding
"let g:pymode_folding=0
let g:NERDTreeWinPos = "right"
"
"not auto trail white spaces
"let g:pymode_utils_whitespaces=0
set tags=./tags;/
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <Leader>vs :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
"template setting
let g:username = "zhao"
au FocusLost * :wa
autocmd filetype python nnoremap <F5> : <C-U>!python % <CR>
autocmd filetype r nnoremap <F5> :<C-U>!Rscript % <CR>
autocmd filetype c nnoremap <F5> :<C-U>make %:r && ./%:r<CR>
autocmd filetype cpp nnoremap <F5> :<C-U>!g++ -Wall -g -std=c++0x % -o %:r && ./%:r<CR>
autocmd filetype haskell nnoremap <F5> :<C-U>!ghc % -o %:r && ./%:r<CR>
let g:indent_guides_enable_on_vim_startup=1
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=black
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=darkgrey
set listchars=tab:›\ ,trail:•,extends:#,nbsp:.
set list
set scrolloff=3 " Minimum lines to keep above and below curso
"This unsets the "last search pattern" register by hitting return
nnoremap <CR> :noh<CR><CR>
nnoremap <Leader>u :GundoToggle<CR>
let g:Powerline_symbols = 'fancy'
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
let g:Powerline_colorscheme='solarized256'
map <Leader>yr :YRShow<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" TagBar {
nnoremap <leader>tt :TagbarToggle<CR>
" Fugitive {
nnoremap <silent> <leader>ga :Git add %:p<CR><CR>
nnoremap <silent> <leader>gs :Gstatus<CR>
nnoremap <silent> <leader>gd :Gdiff<CR>
"nnoremap <silent> <leader>dfs ZZ:Gedit<CR>
nnoremap <silent> <leader>dq :diffoff<cr> <c-w>h :q<cr>
nnoremap <silent> <leader>gc :Gcommit<CR>
nnoremap <silent> <leader>gb :Gblame<CR>
nnoremap <silent> <leader>gl :Glog<CR>
nnoremap <silent> <leader>gp :Git push<CR>
nnoremap <silent> <leader>gr :Gread<CR>
nnoremap <silent> <leader>gw :Gwrite<CR>
nnoremap <silent> <leader>ge :Gedit<CR>
nnoremap <silent> <leader>gg :GitGutterToggle<CR>
"}
" Tabularize {
nmap <Leader>a& :Tabularize /&<CR>
vmap <Leader>a& :Tabularize /&<CR>
nmap <Leader>a= :Tabularize /=<CR>
vmap <Leader>a= :Tabularize /=<CR>
nmap <Leader>a: :Tabularize /:<CR>
vmap <Leader>a: :Tabularize /:<CR>
nmap <Leader>a:: :Tabularize /:\zs<CR>
vmap <Leader>a:: :Tabularize /:\zs<CR>
nmap <Leader>a, :Tabularize /,<CR>
vmap <Leader>a, :Tabularize /,<CR>
nmap <Leader>a,, :Tabularize /,\zs<CR>
vmap <Leader>a,, :Tabularize /,\zs<CR>
nmap <Leader>a<Bar> :Tabularize /<Bar><CR>
vmap <Leader>a<Bar> :Tabularize /<Bar><CR>
" }
let g:haskell_conceal_wide = 1
let g:ycm_semantic_triggers = {'haskell' : ['.']}