-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
executable file
·425 lines (379 loc) · 13.6 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
set nocompatible
filetype off
set number
set history=1000
set visualbell
set autoread
set hidden
syntax on
set noswapfile
set nobackup
set nowb
set fo=tcq
set modeline
set bg=dark
set encoding=utf8
set autoindent
set smartindent
set smarttab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set expandtab
set nowrap
set foldnestmax=3
set nofoldenable
set noerrorbells visualbell t_vb=
set scrolloff=8
set sidescrolloff=15
set ruler
set sidescroll=1
set shell=bash
set ff=unix
set clipboard=unnamedplus
set laststatus=2
set textwidth=0
hi Normal ctermbg=none
highlight NonText ctermbg=none
set foldmethod=indent
set foldlevel=99
set tags=./tags,tags;$HOME
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Plugin 'gmarik/vundle'
Plugin 'tpope/vim-fugitive'
Plugin 'skwp/vim-easymotion'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-surround.git'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'Raimondi/delimitMate'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'majutsushi/tagbar'
Plugin 'CyCoreSystems/vim-cisco-ios'
Plugin 'flazz/vim-colorschemes'
Plugin 'rafi/awesome-vim-colorschemes'
Plugin 'joonty/vdebug'
Plugin 'nvie/vim-flake8'
Plugin 'tmhedberg/SimpylFold'
Plugin 'skywind3000/asyncrun.vim'
Plugin 'w0rp/ale'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'davidhalter/jedi-vim'
Plugin 'ClockworkNet/vim-junos-syntax'
Plugin 'preservim/nerdtree'
Plugin 'Shougo/deoplete.nvim'
Plugin 'roxma/nvim-yarp'
Plugin 'roxma/vim-hug-neovim-rpc'
Plugin 'klen/python-mode'
Plugin 'mitsuhiko/vim-jinja'
Plugin 'mbbill/undotree'
Plugin 'sirver/UltiSnips'
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'honza/vim-snippets'
Plugin 'vimwiki/vimwiki'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'vim-scripts/DoxygenToolkit.vim'
Plugin 'vhdirk/vim-cmake'
Plugin 'numirias/semshi', {'do': ':UpdateRemotePlugins'}
Plugin 'ervandew/supertab'
Plugin 'fatih/vim-go'
Plugin 'kkoomen/vim-doge'
Plugin 'rust-lang/rust.vim'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'dkprice/vim-easygrep'
Plugin 'vim-python/python-syntax'
Plugin 'kien/ctrlp.vim'
Plugin 'puremourning/vimspector'
Plugin 'NewLunarFire/wla-vim'
Plugin 'dahu/vim-rng'
"Plugin 'ycm-core/YouCompleteMe'
set background=dark
colorscheme jellygrass
highlight LiteralTabs ctermbg=darkgreen guibg=darkgreen
match LiteralTabs /\s\ /
highlight ExtraWhitespace ctermbg=darkgreen guibg=darkgreen
match ExtraWhitespace /\s\+$/
filetype plugin indent on
let g:tagbar_ctags_bin = "/usr/bin/ctags"
let g:doge_doc_standard_python = 'sphinx'
let g:doge_mapping = '<Leader>D'
let g:vimspector_enable_mappings = 'HUMAN'
let g:terminal_scrollback_buffer_size = 100000
let g:deoplete#enable_at_startup = 1
let g:jedi#use_splits_not_buffers = "bottom"
let g:jedi#documentation_command = "<leader>k"
let g:jedi#completions_command = "<C-A>"
let g:SimplyFold_docstring_preview=1
let g:flake8_show_quickfix=0
let g:flake8_show_in_gutter=0
let python_highlight_all=1
let g:Powerline_symbols = 'fancy'
"let g:ycm_confirm_extra_conf = 0
"let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
"let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
"let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py'
let g:ale_rust_cargo_use_check = 1
let g:ale_python_flake8_options = '--config=$HOME/.flake8'
let g:rustfmt_autosave = 1
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
let g:ultisnips_python_style = 'sphinx'
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
"let g:airline_symbols.space = '\ua0'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers = 0
let g:airline#extensions#wordcount#enabled = 1
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_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 = 'Ξ'
let wiki = {}
let wiki.path = '~/vimwiki'
let wiki.syntax = 'markdown'
let wiki.ext = '.md'
let wiki.nested_syntaxes = {'ruby': 'ruby', 'python': 'python', 'c++': 'cpp', 'sh': 'sh', 'racket': 'racket'}
let g:vimwiki_list = [wiki]
let g:vimwiki_hl_headers = 1
let g:vimwiki_global_ext = 0
let g:vimwiki_markdown_link_ext = 1
let g:vimwiki_ext2syntax = {'.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
let g:pymode_options_colorcolumn = 0
let g:pymode_lint_on_write = 0
let g:pymode_preview_position = 'botright'
let g:pymode_python = 'python3'
let g:pymode_run_bind = '<leader>r'
let g:python_highlight_all = 1
let g:go_def_mapping_enabled = 0
nmap <C-U> :UndotreeToggle<CR>
nmap <C-N> :NERDTreeToggle<CR>
nmap <C-W> :tabprevious<CR>
nmap <C-E> :tabnext<CR>
nmap <C-T> :tabnew<CR>
nmap <C-B> :tabnew term://bash<CR>
nmap <C-Y> :tabnew term://python3<CR>
nmap <C-G> :TagbarToggle<CR>
nnoremap <C-F> za
augroup WrapLineInMarkdown
autocmd!
autocmd FileType markdown setlocal wrap
augroup END
au FileType python nnoremap <leader>l :w <bar> !black % && flake8 % <CR>
au FileType rust nnoremap <leader>l :RustFmt <CR>
au BufEnter *.css set shiftwidth=2
au BufEnter *.css set tabstop=2
au BufEnter *.css set softtabstop=2
au BufEnter *.html set shiftwidth=2
au BufEnter *.html set tabstop=2
au BufEnter *.html set softtabstop=2
au BufEnter *.sls set shiftwidth=2
au BufEnter *.sls set tabstop=2
au BufEnter *.sls set softtabstop=2
au BufEnter *.yml set shiftwidth=2
au BufEnter *.yml set tabstop=2
au BufEnter *.yml set softtabstop=2
au BufEnter *.yaml set shiftwidth=2
au BufEnter *.yaml set tabstop=2
au BufEnter *.yaml set softtabstop=2
au BufEnter *.cisco set ft=cisco
au BufEnter *.junos set ft=junos
au BufEnter *.asm set filetype=wla
au BufEnter *.z80 set filetype=wla
au BufEnter *.s set filetype=wla
au BufEnter *.sls set filetype=yaml
au BufEnter *.wiki set ft=markdown
au BufEnter *.md set ft=markdown
au BufRead,BufWrite,BufNew *.wiki set ft=markdown
au BufRead,BufWrite,BufNew *.md set ft=markdown
nnoremap <silent> vv <C-w>v
nnoremap <silent> ss <C-w>s
nnoremap <silent> bn :bn<CR>
nnoremap <silent> bp :bp<CR>
nnoremap <silent> bB :vsplit term://bash<CR>
nnoremap <silent> bP :vsplit term://python3<CR>
nnoremap <silent> ,e <C-w>+<C-w>+<C-w>+<C-w>+<C-w>+
nnoremap <silent> ,w <C-w>-<C-w>-<C-w>-<C-w>-<C-w>-
nnoremap <silent> ,q <C-w><<C-w><<C-w><<C-w><<C-w><
nnoremap <silent> ,r <C-w>><C-w>><C-w>><C-w>><C-w>>
nnoremap <leader>cd :Glcd<CR>
nmap <leader>gs :Git<cr>
nmap <leader>gd :Git diff<cr>
nmap <leader>gb :Git blame<cr>
nmap <leader>gc :Git commit<cr>
nmap <leader>gp :Git pull<cr>
nmap <leader>gP :Git push<cr>
tnoremap <Esc> <C-\><C-n>
nnoremap <silent> ,K <C-w>K
nnoremap <silent> ,J <C-w>J
nnoremap <silent> ,H <C-w>H
nnoremap <silent> ,L <C-w>L
nnoremap <silent> ,k <C-w>k
nnoremap <silent> ,j <C-w>j
nnoremap <silent> ,h <C-w>h
nnoremap <silent> ,l <C-w>l
let @q="\<Esc>^i#\<Esc>j"
nnoremap <Space> @q
nnoremap <leader><space> @q@q@q@q@q@q@q@q@q@q
let @a="kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
nnoremap <silent> ,a @a
nnoremap <PageUp> @a
let @z="jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj"
nnoremap <PageDown> @z
nnoremap <silent> ,z @z
" Code Editor macro
let @E="\<Esc>\\ww\<Esc>:tabnew term://bash\<CR>:set nonu\<CR>bP\<CR>,K,j,h:tabnew\<CR>:set nu\<CR>:NERDTreeToggle\<CR>,l:TagbarToggle\<CR>:tabnew\<CR>:NERDTreeToggle\<CR>,l:TagbarToggle\<CR>:tabnew\<CR>:NERDTreeToggle\<CR>,l:TagbarToggle\<CR>:tabnext\<CR>"
nnoremap <leader>E @E
" Open another editor tab in Editor mode
let @T="\<Esc>\:tabnew\<CR>:set nu\<CR>:NERDTreeToggle\<CR>,l:TagbarToggle\<CR>"
nnoremap <leader>T @T
" Pentest Editor macro
let @H="\<Esc>\\ww\<Esc>:tabnew\<CR>:set nu\<CR>:NERDTreeToggle\<CR>,l:TagbarToggle\<CR>:tabnew\<CR>:set nu\<CR>:NERDTreeToggle\<CR>,l:TagbarToggle\<CR>:tabnew term://bash\<CR>:set nonu\<CR>:tabnew term://bash\<CR>:set nonu\<CR>:tabnext\<CR>"
nnoremap <leader>H @H
" Writing Editor macro
let @W="\<Esc>\\ww\<Esc>:tabnew\<CR>:set nonu\<CR>:NERDTreeToggle\<CR>,l:tabnew\<CR>:set nonu\<CR>:NERDTreeToggle\<CR>,l:tabnew\<CR>:set nonu\<CR>:NERDTreeToggle\<CR>,l:tabnext\<CR>"
nnoremap <leader>W @W
call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' })
let g:go_snippet_engine = "ultisnips"
let g:go_autodetect_gopath = 1
let g:go_def_mode = 'gopls'
let g:go_def_mod_mode='godef'
autocmd filetype c nnoremap <leader>b :w <bar> !build_wrap.sh % c -b<CR>
autocmd filetype c nnoremap <leader>r :w <bar> !build_wrap.sh % c -br<CR>
autocmd filetype c nnoremap <leader>g :sp <CR>:exec("tag ".expand("<cword>"))<CR>
autocmd filetype c nnoremap <leader>. :CtrlPTag<cr>
autocmd filetype wla nnoremap <leader>b :w <bar> !build_wrap.sh % asm -b<CR>
autocmd filetype wla nnoremap <leader>r :w <bar> !build_wrap.sh % asm -br<CR>
autocmd filetype asm nnoremap <leader>b :w <bar> !build_wrap.sh % asm -b<CR>
autocmd filetype asm nnoremap <leader>r :w <bar> !build_wrap.sh % asm -br<CR>
au FileType py nmap <leader>r :PymodeRun<CR>,k
au FileType go nmap <leader>r <Plug>(go-run-split)<CR>,k
au filetype go nnoremap <leader>b :GoBuild <CR>
au Filetype go nnoremap <leader>q :GoDebugStart <CR>
au FileType go nmap <leader>qs <Plug>(go-debug-step)
au FileType go nmap <leader>qc <Plug>(go-debug-continue)
au FileType go nmap <leader>qn <Plug>(go-debug-next)
au FileType go nmap <leader>qb <Plug>(go-debug-breakpoint)
au FileType go nmap <leader>f <Plug>(go-files)
au FileType go nmap <leader>d <Plug>(go-deps)
au FileType go nmap <leader>g <Plug>(go-def-split)
au FileType go nmap <leader>G <Plug>(go-def-stack)
au filetype sh nnoremap <leader>r :!%:p<Enter>
autocmd BufRead,BufNewFile *.md setlocal spell spelllang=en_us
autocmd BufRead,BufNewFile *.md setlocal spell spellfile=~/en.utf-8.add
autocmd filetype markdown nnoremap <Backspace> :VimwikiGoBackLink <CR>
autocmd filetype markdown nnoremap <leader>con :set spell spelllang=en_us<CR>
autocmd filetype markdown nnoremap <leader>coff :set nospell<CR>
autocmd filetype markdown nnoremap <leader>cn ]s
autocmd filetype markdown nnoremap <leader>cp [s
autocmd filetype markdown nnoremap <leader>cf z=
autocmd filetype markdown nnoremap <leader>ca zg
autocmd filetype markdown nnoremap <leader>b :w <bar> !build_wrap.sh %:p md -b<CR>
function! ToggleHex()
let l:modified=&mod
let l:oldreadonly=&readonly
let &readonly=0
let l:oldmodifiable=&modifiable
let &modifiable=1
if !exists("b:editHex") || !b:editHex
let b:oldft=&ft
let b:oldbin=&bin
setlocal binary
let &ft="xxd"
let b:editHex=1
%!xxd
else
let &ft=b:oldft
if !b:oldbin
setlocal nobinary
endif
let b:editHex=0
%!xxd -r
endif
let &mod=l:modified
let &readonly=l:oldreadonly
let &modifiable=l:oldmodifiable
endfunction
command! -bar Hex call ToggleHex()
function ToggleColorScheme()
let g:fav_colors = ['gruvbox', 'iceberg', 'molokai', 'nord', 'muon', 'sonokai', 'space-vim-dark', 'Atelier_CaveDark', 'void', 'wwdc16', 'bitterjug', 'birds-of-paradise', 'badwolf', 'CandyPaper', 'smarties', 'khaki', 'neverland2', '1989', 'znake', 'twilight256', 'flatland', 'happy_hacking', 'codedark', 'orbital', 'northpole', 'dzo', 'greenvision', 'blacklight', 'jhlight', 'jitterbug', 'kalisi', 'lapis256', 'lodestone', 'lucius', 'made_of_code', 'miko', 'morning', 'mushroom', 'plasticine', 'seoul256', 'softbluev2', 'soso', 'tabula', 'moonshine', 'moss', 'monokai-phoenix', 'minimalist', 'magellan', 'luinnar']
let g:fav_colors_idx = RandomNumber(0, len(g:fav_colors)-1)
echo g:fav_colors[g:fav_colors_idx]
:exe "colo " .. g:fav_colors[g:fav_colors_idx]
let g:color_idx = index(g:colors, g:colors_name)
endfunction
nnoremap <leader>t :call ToggleColorScheme()<CR>
function FormatJSON()
:1,$s/'/"/g
:1,$s/None/null/g
:1,$s/False/false/g
:1,$s/True/true/g
:%!python -m json.tool
endfunction
command! -bar FormatJSON call FormatJSON()
function ObsidianLink()
let g:previouslink=expand("%:p")
execute("Glcd")
let startlink=searchpos('[[', 'bn', line('.'))[1] + 1
let endlink=searchpos(']]', 'n', line('.'))[1] - 2
let ss=getline(".")[startlink:endlink] . ".md"
let pwd=getcwd() . "/"
let obsidianlink=fnameescape(pwd . ss)
execute("e " . obsidianlink)
endfunction
function ObsidianGoBack()
if exists("g:previouslink")
execute("e " . g:previouslink)
endif
endfunction
autocmd filetype markdown nnoremap <leader>g :call ObsidianLink()<CR>
autocmd filetype markdown nnoremap <leader>G :call ObsidianGoBack()<CR>
let g:colors = getcompletion('', 'color')
let g:color_idx = index(g:colors, g:colors_name)
func! NextColors()
if g:color_idx <= (len(g:colors) - 1)
let g:color_idx += 1
else
let g:color_idx = 0
endif
echo g:colors[g:color_idx]
return g:colors[g:color_idx]
endfunc
func! PrevColors()
if g:color_idx >= 0
let g:color_idx -= 1
else
let g:color_idx = len(g:colors) - 1
endif
echo g:colors[g:color_idx]
return g:colors[g:color_idx]
endfunc
func! RandoColor()
let g:color_idx = RandomNumber(0, len(g:colors)-1)
echo g:colors[g:color_idx]
:exe "colo " .. g:colors[g:color_idx]
:exe "AirlineTheme random"
endfunc
nnoremap <leader>[ :exe "colo " .. NextColors()<CR>
nnoremap <leader>] :exe "colo " .. PrevColors()<CR>
nnoremap <leader>c :call RandoColor()<CR>