-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
436 lines (379 loc) · 11.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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
set nocompatible " be iMproved, required
syntax on
filetype plugin indent on
call plug#begin('~/.vim/plugged')
" VIM Pretty
"
"
Plug 'scrooloose/nerdtree'
Plug 'chrisbra/colorizer'
"
" VIM PLUGINS
"
Plug 'towolf/vim-helm'
Plug 'bronson/vim-trailing-whitespace'
Plug 'gorodinskiy/vim-coloresque'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'mattn/gist-vim'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'majutsushi/tagbar'
Plug 'godlygeek/tabular'
Plug 'flazz/vim-colorschemes'
" PERSONAL WIKI
Plug 'vimwiki/vimwiki'
"
"SNIPETS
"
Plug 'tmhedberg/SimpylFold'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'scrooloose/nerdcommenter'
"
" Track the engine.
Plug '[email protected]:SirVer/ultisnips.git'
" Snippets are separated from the engine. Add this if you want them:
Plug 'honza/vim-snippets'
"
" GIT
"
Plug 'xuyuanp/nerdtree-git-plugin'
Plug 'rhysd/git-messenger.vim'
Plug 'chemzqm/vim-easygit'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
"
" Terraform Plugin
"
Plug 'hashivim/vim-terraform'
Plug 'vim-syntastic/syntastic'
Plug 'juliosueiras/vim-terraform-completion'
"
" PYTHON
"
Plug 'vim-scripts/indentpython.vim'
Plug 'nvie/vim-flake8'
Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' }
Plug 'davidhalter/jedi-vim'
"
" CODE COMPLETION & SYNTAX
"
Plug 'ekalinin/Dockerfile.vim'
Plug 'Valloric/YouCompleteMe', { 'do': 'python install.py' }
Plug 'dense-analysis/ale'
call plug#end()
set encoding=utf8
if has('python3')
endif
" ===========================
" ===========================
" COLORS / DESIGN
" ===========================
" ===========================
" set background = dark
" colorscheme slate
colorscheme badwolf
" colorscheme elflord
" colorscheme darkblue
"
set tabstop=2
set expandtab
set number
set cursorline
set laststatus=2
set relativenumber
set shell=/usr/bin/zsh
"
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
"
"set clipboard+=unnamedplus
set clipboard=unnamedplus
"
let g:airline_powerline_fonts=1
let g:airline_theme='term'
" let g:airline_theme='alduin'
"
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
"
let g:airline#extensions#tabline#enabled = 1
"
" AIRLINE 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 = ''
"
" prettify the files and folders.
let s:brown = "905532"
let s:aqua = "3AFFDB"
let s:blue = "689FB6"
let s:darkBlue = "44788E"
let s:purple = "834F79"
let s:lightPurple = "834F79"
let s:red = "AE403F"
let s:beige = "F5C06F"
let s:yellow = "F09F17"
let s:orange = "D4843E"
let s:darkOrange = "F16529"
let s:pink = "CB6F6F"
let s:salmon = "EE6E73"
let s:green = "8FAA54"
let s:lightGreen = "31B53E"
let s:white = "FFFFFF"
let s:rspec_red = 'FE405F'
let s:git_orange = 'F54D27'
" ===========================
" ===========================
" AUTOCOMPLETION Keybinds
" ===========================
" ===========================
" YouCompleteMe
let g:ale_completion_enabled = 1
" let g:UltiSnipsExpandTrigger="<c-o>"
" let g:UltiSnipsJumpForwardTrigger="<c-b>"
" let g:UltiSnipsJumpBackwardTrigger="<c-z>"
"
" TERRAFORM Adds
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" (Optional)Remove Info(Preview) window
"set completeopt-=preview
" (Optional)Hide Info(Preview) window after completions
" autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
" autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" (Optional) Enable terraform plan to be include in filter
let g:syntastic_terraform_tffilter_plan = 1
" (Optional) Default: 0, enable(1)/disable(0) plugin's keymapping
let g:terraform_completion_keys = 0
" (Optional) Default: 1, enable(1)/disable(0) terraform module registry completion
let g:terraform_registry_module_completion = 0
" ==========
" Ultisnips
" ==========
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
"let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsExpandTrigger="<c-o>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetsDir = $HOME.'/.vim/UltiSnips/'
let g:UltiSnipsSnippetDirectories=["UltiSnips"]
let g:UltiSnipsListSnippets="<c-h>"
"
" SYNTAX CHECKERS
" let g:syntastic_python_checkers = ['pylint', 'python']
let g:syntastic_python_checkers = ['virutalenv']
let g:syntastic_c_checkers = ['clang_check', 'clang_tidy', 'gcc', 'make', 'cppcheck']
let g:syntastic_css_checkers = ['csslint', 'prettycss']
let g:syntastic_dockerfile_checkers = ['dockerfile_lint']
let g:syntastic_haskell_checkers = ['hdevtools', 'hlint', 'scan']
let g:syntastic_html_checkers = ['eslint', 'gjslint', 'tidy']
let g:syntastic_java_checkers = ['checkstyle', 'javac']
let g:syntastic_javascript_checkers = ['flow', 'eslint', 'jsl']
let g:syntastic_json_checkers = ['jsonlint']
let g:syntastic_mardown_checkers = ['mdl']
let g:syntastic_matlab_checkers = ['mlint']
let g:syntastic_ruby_checkers = ['flog']
let g:syntastic_scala_checkers = ['fsc', 'scalac']
let g:syntastic_sh_checkers = ['bashate', 'sh', 'shellcheck']
let g:syntastic_sql_checkers = ['sqlint']
let g:syntastic_tex_checkers = ['chktex', 'lacheck']
let g:syntastic_zsh_checkers = ['zsh']
"
" ===========================
" ===========================
" NAVIGATION
" ===========================
" ===========================
" move between splits
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>
"
" Code folding (Enable)
set foldmethod=indent
set foldlevel=99
nnoremap <space> za
let g:SimpylFold_docstring_preview=1
"""""""""""""""""""""""""""""""""""""""""""""
""
"" FZF
""
"""""""""""""""""""""""""""""""""""""""""""""
" Mapping selecting mappings
" Insert mode completion
" imap <c-x><c-k> <plug>(fzf-complete-word)
" imap <c-x><c-f> <plug>(fzf-complete-path)
" imap <c-x><c-j> <plug>(fzf-complete-file-ag)
" imap <c-x><c-l> <plug>(fzf-complete-line)
" Default fzf layout
" - down / up / left / right
let g:fzf_layout = { 'down': '~40%' }
" In Neovim, you can set up fzf window using a Vim command
let g:fzf_layout = { 'window': 'enew' }
let g:fzf_layout = { 'window': '-tabnew' }
let g:fzf_layout = { 'window': '10new' }
" Customize fzf colors to match your color scheme
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" Enable per-command history.
" CTRL-N and CTRL-P will be automatically bound to next-history and
" previous-history instead of down and up. If you don't like the change,
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
let g:fzf_history_dir = '~/.local/share/fzf-history'
" [Buffers] Jump to the existing window if possible
let g:fzf_buffers_jump = 1
" [[B]Commits] Customize the options used by 'git log':
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
" [Tags] Command to generate tags file
let g:fzf_tags_command = 'ctags -R'
" [Commands] --expect expression for directly executing the command
let g:fzf_commands_expect = 'alt-enter,ctrl-x'
function! s:fzf_statusline()
" Override statusline as you like
highlight fzf1 ctermfg=161 ctermbg=251
highlight fzf2 ctermfg=23 ctermbg=251
highlight fzf3 ctermfg=237 ctermbg=251
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endfunction
autocmd! User FzfStatusLine call <SID>fzf_statusline()
" ===========================
" ===========================
" PYTHON
" ===========================
" ===========================
let g:pymode_python = 'python3'
let g:pymode_rope = 0
"
" pretty python code
let python_highlight_all=1
"
" pep8 indendation
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix |
"
"
" for modules in same directory.
let g:ale_python_pylint_options = "--init-hook='import sys; sys.path.append(\".\")'"
"
" VIRTUALENV
py3 << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
exec(open(activate_this).read(), dict(__file__=activate_this))
EOF
"
" pretty python
let python_highlight_all=1
let g:syntastic_mode_map = { 'passive_filetypes': ['python'] }
" ===========================
" ===========================
" NERDTREE
" ===========================
" ===========================
">> auto open if no file selected
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" ignore files in NERDTree
let NERDTreeIgnore=['\.pyc$', '\~$']
" autoclose when opening a file
let NERDTreeQuitOnOpen = 0
let g:NERDTreeDisableFileExtensionHighlight = 1
let g:NERDTreeDisableExactMatchHighlight = 1
let g:NERDTreeDisablePatternMatchHighlight = 1
let g:NERDTreeExtensionHighlightColor = {} " this line is needed to avoid error
let g:NERDTreeExtensionHighlightColor['css'] = s:blue " sets the color of css files to blue
let g:NERDTreeExactMatchHighlightColor = {} " this line is needed to avoid error
let g:NERDTreeExactMatchHighlightColor['.gitignore'] = s:git_orange " sets the color for .gitignore files
let g:NERDTreePatternMatchHighlightColor = {} " this line is needed to avoid error
let g:NERDTreePatternMatchHighlightColor['.*_spec\.rb$'] = s:rspec_red " sets the color for files ending with _spec.rb
" ===========================
" ===========================
" MY COMMANDS
" ===========================
" ===========================
" Vim Markdown preview command remapping
let mapleader = ","
nmap <leader>nn :NERDTree<CR>
nmap <leader>st :SyntasticToggleMode<CR>
nmap <leader>t :bo terminal<CR>
hi Terminal ctermbg=333333
" Buffers management
nmap <leader>bn :bn<CR>
nmap <leader>bp :bp<CR>
nmap <leader>bd :bd<CR>
" Resizing
nmap <leader>= :vertical resize +5<CR>
nmap <leader>- :vertical resize -5<CR>
" Fuzzy Search
nmap <leader>f :Files<CR>
nmap <leader>B :Buffers<CR>
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-b': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
" Git shortcuts
nmap <leader>gd :Gdiff<CR>
nmap <leader>ga :Gadd<CR>
nmap <leader>gc :Gcommit<CR>
nmap <leader>gst :Gstatus<CR>
" Tags
nmap <F9> :TagbarToggle<CR>
nmap <leader>ct :!ctags . -R<CR>
" Make file directory the current working directory
nmap <leader>cd :cd %:p:h<cr>:pwd<cr>
" TABs Management
nmap <leader>tn :tabnew<cr>
nmap <leader>to :tabonly<cr>
nmap <leader>tc :tabclose<cr>
inoremap $1 ()<esc>i
inoremap $2 []<esc>i
inoremap $3 {}<esc>i
inoremap $4 {<esc>o}<esc>O
inoremap $q ''<esc>i
inoremap $e ""<esc>i
inoremap $t <><esc>i
" SESSIONS
" let g:workspace_create_new_tabs = 0 " enabled = 1 (default), disabled = 0
" let g:workspace_session_directory = $HOME . '/.vim/sessions/'
" let g:workspace_session_name = 'session.vim'
" let g:workspace_autosave_always = 1
" let g:workspace_autosave_ignore = ['gitcommit']
autocmd BufWritePre * :%s/\s\+$//e
"Git add - remove commands...
let g:easygit_enable_command = 1
"
"