-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-bundle.vim
More file actions
264 lines (218 loc) · 7.43 KB
/
init-bundle.vim
File metadata and controls
264 lines (218 loc) · 7.43 KB
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
" NOTE: use vim-plug to manage plugins
set nocompatible
filetype off " required! turn off
function LoadLanguageSupport()
if exists("g:ignore_language_support")
return 0
else
return 1
endif
endfunction
call plug#begin('~/.config/nvim/bundle')
" ====================== plugin definition ==========================
" airline
" a light weight status bar
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" ctrlP
" a great fuzzy buffer finder, toggle with '<leader>f'
Plug 'ctrlpvim/ctrlp.vim'
" TheNerdTree
" a filesystem tree viewer, toggle with '<C-n>'
Plug 'scrooloose/nerdtree'
" emmet
" famous emmet! use '<C-e>' to expand
Plug 'mattn/emmet-vim'
" nerdcommenter
" auto comment, '[count]<leader>c<space>' to toggle
Plug 'scrooloose/nerdcommenter'
" vim-trailing-whitespace
" mark spare white space and use '<leader><space>' to fix it (globally).
Plug 'bronson/vim-trailing-whitespace'
" delimitmate
" complete pair symbol such as (), {} etc
Plug 'raimondi/delimitmate'
" matchit
" extending % matching in HTML, Latex and other language
Plug 'vim-scripts/matchit.zip'
" theme
Plug 'kien/rainbow_parentheses.vim' " for parentheses
Plug 'lifepillar/vim-solarized8'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'tomasr/molokai'
" git tools
"
" vim-gitgutter
" show and switch between the changes in your files
Plug 'airblade/vim-gitgutter'
" fugitive
" git wrapper inner vim
Plug 'tpope/vim-fugitive'
" ** LANGUAGE SUPPORT **
if LoadLanguageSupport()
" LanguageClient
" https://github.com/neoclide/coc.nvim
Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}}
endif " LoadLanguageSupport
" google style code format
Plug 'google/vim-maktaba'
Plug 'google/vim-codefmt'
Plug 'google/vim-glaive'
" ==================== plugin definition end ========================
call plug#end()
" ==================== configuration ================================
" hints:
" 1. use /pluginName to search its config
" airline {{{
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers = 0
" unicode symbols
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_symbols.crypt = '🔒'
let g:airline_symbols.linenr = '☰'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.maxlinenr = '㏑'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.spell = 'Ꞩ'
let g:airline_symbols.notexists = '∄'
let g:airline_symbols.whitespace = 'Ξ'
" co-op with fugitive
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#branch#empty_message = 'no branch info'
" co-op with gitgutter
let g:airline#extensions#hunks#enabled = 1
let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-']
" }}}
" ctrlP {{{
" Setup some default ignores
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]((\.(git|hg|svn)|\_site)|node_modules|bower_modules|build)$',
\ 'file': '\v\.(exe|so|dll|class|png|jpg|jpeg|tar|tar.gz|tar.bz2|pyc|o)$',
\}
let g:ctrlp_show_hidden = 1
" use nearest folder which has a version control info(.svn, .git) as the
" root, or the current directory
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_root_markers = ['Makefile', 'makefile']
" activate ctrlP
let g:ctrlp_map = '<C-f>'
let g:ctrlp_cmd = 'CtrlP'
" key map
nmap <leader>bb :CtrlPBuffer<cr>
nmap <leader>bm :CtrlPMixed<cr>
nmap <leader>bs :CtrlPMRU<cr>
" }}}
" TheNerdTree {{{
map <C-n> :NERDTreeToggle<CR>
let NERDTreeHighlightCursorline=1
let NERDTreeIgnore=[ '\.pyc$', '\.pyo$', '\.obj$', '\.o$', '\.so$', '\.egg$', '^\.git$', '^\.svn$', '^\.hg$' ]
"close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | end
" s/v split open
let g:NERDTreeMapOpenSplit = 's'
let g:NERDTreeMapOpenVSplit = 'v'
" }}}
" emmet {{{
let g:user_emmet_expandabbr_key = '<C-e>'
" let g:user_emmet_leader_key='<C-e>'
" }}}
" nerdcommenter {{{
let g:NERDSpaceDelims=1
let g:NERDAltDelims_python = 1
" }}}
" trailingwhitespace {{{
nnoremap <leader><space> :FixWhitespace<cr>
" }}}
" delimitmate {{{
" }}}
" matchit {{{
" }}}
" rainbow_parentheses {{{
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
let g:rbpt_max = 16
let g:rbpt_loadcmd_toggle = 0
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
" }}}
" molokai {{{
let g:molokai_original = 1
let g:rehash256 = 1
" }}}
" solarized8 {{{
" }}}
" vim-gitgutter {{{
" disable its own key mapping
let g:gitgutter_map_keys = 0
nnoremap <leader>n :GitGutterNextHunk<CR>
nnoremap <leader>N :GitGutterPrevHunk<CR>
" }}}
" fugitive {{{
" }}}
if LoadLanguageSupport()
" coc.nvim
" {{{
call coc#config('languageserver', {
\ "ccls": {
\ "command": $HOME."/.config/nvim/lang-server/ccls/Release/ccls",
\ "filetypes": ["c", "cpp", "cuda", "objc", "objcpp", "cc"],
\ "rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/", "WORKSPACE"],
\ "initializationOptions": {
\ "cache": {
\ "directory": "/tmp/ccls"
\ }
\ }
\ }
\})
nmap gd :call CocAction('jumpDefinition')<CR>
nmap gh :call CocAction('jumpReferences')<CR>
" use tab and s-tab to navigate, use enter to complete
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
" }}}
endif
" code format
" {{{
call glaive#Install()
augroup autoformat_settings
autocmd FileType bzl AutoFormatBuffer buildifier
autocmd FileType c,cpp,proto,javascript AutoFormatBuffer clang-format
autocmd FileType dart AutoFormatBuffer dartfmt
autocmd FileType go AutoFormatBuffer gofmt
autocmd FileType gn AutoFormatBuffer gn
autocmd FileType html,css,sass,scss,less,json AutoFormatBuffer js-beautify
autocmd FileType java AutoFormatBuffer google-java-format
autocmd FileType python AutoFormatBuffer yapf
" Alternative: autocmd FileType python AutoFormatBuffer autopep8
augroup END
" }}}
" ==================== configuration end ============================