-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
360 lines (307 loc) · 12.7 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
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
Plugin 'cocopon/iceberg.vim'
Plugin 'nightsense/seabird'
Plugin 'chriskempson/base16-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'ryanoasis/vim-devicons'
Plugin 'tpope/vim-surround.git'
Plugin 'airblade/vim-gitgutter'
Plugin 'davidhalter/jedi-vim.git'
Plugin 'tmhedberg/SimpylFold'
Plugin 'Valloric/YouCompleteMe'
Plugin 'kamwitsta/nordisk'
Plugin 'tyrannicaltoucan/vim-deep-space'
Plugin 'saalaa/ancient-colors.vim'
Plugin 'NLKNguyen/papercolor-theme'
Plugin 'PyCQA/pylint'
Plugin 'nvie/vim-flake8'
Plugin 'powerline/powerline'
Plugin 'ctrlp.vim'
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'nightsense/vim-crunchbang'
Plugin 'exitface/synthwave.vim'
Plugin 'derekwyatt/vim-scala'
Plugin 'mustache/vim-mustache-handlebars'
Plugin 'pangloss/vim-javascript'
Plugin 'maxmellon/vim-jsx-pretty'
Plugin 'sbdchd/neoformat'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'dense-analysis/ale'
Plugin 'tpope/vim-fugitive'
Plugin 'prettier/vim-prettier'
Plugin 'hhatto/autopep8'
Plugin 'google/yapf'
Plugin 'ambv/black'
Plugin 'mileszs/ack.vim'
Plugin 'leafgarland/typescript-vim'
Plugin 'vim-ruby/vim-ruby'
Plugin 'ericqweinstein/ruumba'
Plugin 'mattn/emmet-vim'
Plugin 'epilande/vim-react-snippets'
Plugin 'SirVer/ultisnips'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
let python_highlight_all=1
syntax on
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Unfold code when on open
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" set foldmethod=syntax slows ALE so avoid it
set foldmethod=indent
augroup OpenAllFoldsOnFileOpen
autocmd!
autocmd BufRead * normal zR
augroup END
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ALEes :help ale-lint-file-linters
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:ale_fixers = { 'javascript': ['eslint'], 'python': ['black', 'isort', 'autopep8', 'prettier'], 'json': ['jsonlint']}
let g:ale_linters = {
\ 'javascript': ['eslint'],
\ 'json': ['jsonlint'],
\ 'python': ['pylint', 'autopep8', 'flake8', 'black'],
\ 'scala': ['scalac'],
\ 'eruby': ['ruumba', 'erb'],
\ 'ruby': ['ruby'],
\ 'java': ['javalsp']
\}
let g:ale_javascript_prettier_options = '--single-quote'
let g:ale_completion_enabled = 0
let g:airline#extensions#ale#enabled = 1
" signs on gutter
let g:ale_sign_column_always = 1
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--'
let g:ale_open_list = 1
" Only run linters named in ale_linters settings.
let g:ale_linters_explicit = 1
" something to do with performance cacheing
let g:ale_cache_executable_check_failures = 1
" control when to run lint
" let g:ale_lint_on_text_changed = 'never'
" let g:ale_lint_on_enter = 0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" AIRLINE FORMAT
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ttimeoutlen=50
let g:airline_theme = 'powerlineish'
let g:airline#extensions#hunks#enabled=0
let g:airline#extensions#branch#enabled=1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
set statusline+=%#warningmsg#
set statusline+=%*
set number
" Provides tab-completion for all file-related tasks
set path+=**
" Display all matching files when we tab complete
set wildmenu
" Split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
set splitbelow
set splitright
set encoding=utf-8
set wildignore=*.swp,*.bak,*.pyc,*.class,*.DS_Store,*.swo
let NERDTreeIgnore = ['\.pyc$', '\.swp$', '*\.DS_Store', '\.DS_Store$', '\.DS_Store', '\.swo$', '__pycache__']
"set background=dark
set background=light
colorscheme PaperColor
"colorscheme iceberg
"colorscheme base16-default-dark
"colorscheme stormpetrel
"colorscheme petrel
"colorscheme crunchbang
"colorscheme srcery-drk
"colorscheme synthwave
"colorscheme deep-space
" enable when its not rendering as expected
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"if has('termguicolors')
" set termguicolors " 24-bit terminal
"else
" let g:synthwave_termcolors=256 " 256 color mode
"endif
"
"set termguicolors
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"vertical line for cursor good for dark only
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set cursorcolumn
"hi CursorColumn ctermbg=8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NEOFORMAT CODE formatter
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" " defaults when no file type specified
" " Enable alignment
let g:neoformat_basic_format_align = 1
let g:neoformat_basic_format_retab = 1
let g:neoformat_basic_format_trim = 1
let g:neoformat_run_all_formatters = 1
let g:neoformat_try_formatprg = 1
"
" " javascript formatter: https://github.com/prettier/prettier
" " python formatter: https://github.com/google/yapf
" " scala formatter: https://github.com/scala-ide/scalariform
let g:javascript_plugin_flow = 1
let g:javascript_plugin_ngdoc = 1
let g:jsx_ext_required = 0
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NERDTree configuration
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let NERDTreeAutoDeleteBuffer = 1
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let NERDTreeShowHidden=1
" Open NERDTree always as certain width
let g:NERDTreeWinSize = 50
autocmd VimEnter * NERDTree
autocmd VimEnter * set winfixwidth
"" VERY SLOW so disabled as suggested
let NERDTreeHighlightCursorline = 0
" limited scope file ext for highlighting
let g:NERDTreeLimitedSyntax = 1
let g:NERDTreeHighlightFolders = 1 " enables folder icon highlighting using exact match
let g:NERDTreeHighlightFoldersFullName = 1 " highlights the folder name
" Devicons
" Needs the following font:
" brew tap caskroom/fonts
" brew cask install font-hack-nerd-font
" ~default file icon
if exists("g:loaded_webdevicons")
call webdevicons#refresh()
endif
set guifont=Hack\ Nerd\ Font:14
let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = ''
" ~default folder icon
let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol = ''
" ~custom file icons
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {} " needed
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['css'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['html'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['js'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['json'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['md'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['scss'] = ''
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['sql'] = ''
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd FileType nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd FileType nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('md', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('txt', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('csv', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('gz', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('jar', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('in', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('yaml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('xml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('iml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('sql', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('html', 'Magenta', 'none', '#ff00ff', '#151515')
call NERDTreeHighlightFile('hbs', 'Magenta', 'none', '#ff00ff', '#151515')
call NERDTreeHighlightFile('styl', 'Magenta', 'none', '#ff00ff', '#151515')
call NERDTreeHighlightFile('css', 'Magenta', 'none', '#ff00ff', '#151515')
call NERDTreeHighlightFile('sass', 'Magenta', 'none', '#ff00ff', '#151515')
call NERDTreeHighlightFile('py', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('js', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('scala', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('php', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('java', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('json', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('sql', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('ds_store', 'Gray', 'none', '#686868', '#151515')
call NERDTreeHighlightFile('gitconfig', 'Gray', 'none', '#686868', '#151515')
call NERDTreeHighlightFile('gitignore', 'Gray', 'none', '#686868', '#151515')
call NERDTreeHighlightFile('bashrc', 'Gray', 'none', '#686868', '#151515')
call NERDTreeHighlightFile('bashprofile', 'Gray', 'none', '#686868', '#151515')
call NERDTreeHighlightFile('swp', 'Gray', 'none', '#686868', '#151515')
"call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
"call NERDTreeHighlightFile('py', 'blue', 'none', '#3366FF', '#151515')
"call NERDTreeHighlightFile('py', 'Magenta', 'none', '#ff00ff', '#151515')
"call NERDTreeHighlightFile('scala', 'yellow', 'none', 'yellow', '#151515')
"call NERDTreeHighlightFile('ds_store', 'Gray', 'none', '#686868', '#151515')
"call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set mouse=a
set backspace=indent,eol,start
set clipboard=unnamed
set runtimepath^=~/.vim/bundle/ctrlp.vim
" CtrlP configurations
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.swo,*.swm,*.swn
" let g:ycm_path_to_python_interpreter="/usr/local/bin/python3"
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_python_binary_path=substitute(system("which python"), "\n$", "", "")
let $PYTHONPATH=getcwd() . ":" . $PYTHONPATH
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
set ts=2 sw=2 et
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
set laststatus=2
"Remove all trailing whitespace by pressing F5
nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>
" refresh color highlights
autocmd BufEnter,InsertLeave * :syntax sync fromstart
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Searching texts within files
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" The Silver Searcher
" Make sure silver searcher is installed in your computer
" brew install the_silver_searcher
if executable('ag')
let g:ackprg = 'ag --vimgrep'
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" bind \ (backward slash) to grep shortcut
command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
nnoremap \ :Ag<SPACE>
" search word under cursor
nnoremap <C-f> :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" shortcut to run emmet ,, (comma comma)
let g:user_emmet_leader_key=','
let g:UltiSnipsExpandTrigger="<C-l>"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Profiling
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" :profile start profile.log
" :profile func *
" :profile file *
" " At this point do slow actions
" :profile pause
" :noautocmd qall!