-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.vim
244 lines (206 loc) · 9.44 KB
/
vimrc.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
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" Vim GIT integration, see :Git for menu
" This plugin does a lot of cool stuff.
Plugin 'tpope/vim-fugitive'
" Press F2 to see the menu pop up on the left, and 'C' will set the reference
" directory for nerdtree:
Plugin 'preservim/nerdtree'
Plugin 'wuelnerdotexe/vim-astro'
Plugin 'fatih/vim-go'
Plugin 'tpope/vim-sensible.git'
" Multi Cursors support
Plugin 'mg979/vim-visual-multi'
" Begin debugging with F5:
Plugin 'puremourning/vimspector'
" Grep stuff with \\v and :Grep
Plugin 'dkprice/vim-easygrep'
" install LSP stuff:
Plugin 'prabirshrestha/vim-lsp'
Plugin 'mattn/vim-lsp-settings'
Plugin 'prabirshrestha/asyncomplete.vim'
Plugin 'prabirshrestha/asyncomplete-lsp.vim'
" :LspInstallServer in a file that is supported
" Install FZF for finding files quickly
" make sure you do this first:
" brew install fzf bat ripgrep the_silver_searcher perl universal-ctags
Plugin 'junegunn/fzf.vim'
" Install color theme
Plugin 'cocopon/iceberg.vim.git'
Plugin 'nordtheme/vim'
" Install airline for the bottom bar
Plugin 'vim-airline/vim-airline.git'
" A bunch of colorschemes
Plugin 'flazz/vim-colorschemes.git'
" Install which key (shows UI for leader mappings)
Plugin 'liuchengxu/vim-which-key'
call vundle#end() " required
filetype plugin indent on " required
let g:mapleader = "\<Space>"
let g:maplocalleader = ','
" CUSTOM CONFIGURATIONS
set et ts=4 sts=4 sw=4 hlsearch ai nu rnu mouse=
set foldmethod=marker
autocmd BufWritePost * !php -l <afile>
au BufReadPost *.tpl set syntax=html
au BufReadPost *.json set syntax=javascript
augroup filetype javascript syntax=javascript
syntax on
autocmd FileType go nnoremap <F5> :GoRun<CR>
colorscheme mango " mild dark with bright orange and olive green
" colorscheme meta5 " cyberpunk dark theme
" colorscheme miko " really weird one, kinda unique
" colorscheme midnight " kind of matrixy
" colorscheme mizore " jean blue dark theme
" colorscheme molokai_dark " ash grey with orange, red, and blue highlights
" colorscheme monokai-pheonix " gunmetal grey with vibrant secondary highlights
" colorscheme moody " mild, dark, subtle
" colorscheme moonshine " ash, amber, chartreuse, very nice!
" colorscheme mopkai " volcanic theme, moody and vibrant
" colorscheme moss " like looking through the polished edge of laminate glass at the perfume display in Macy's
" colorscheme mrkn256 " very HIGH contrast dark theme
" colorscheme marklar " aqua green and orange
" colorscheme maroloccio "purple blue yellow dark
" colorscheme maui "orange blue dark
"
set background=dark
" FZF CONFIGURATIONS
set rtp+=/home/linuxbrew/.linuxbrew/opt/fzf
nnoremap <leader>ff :call fzf#vim#files('.')<CR>
" NERDTREE CONFIGURATIONS
" let NERDTreeQuitOnOpen=0
nnoremap <F2> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
inoremap <f2> <C-r>=system("date +%Y-%m-%d <bar> tr -d '\n'")<cr>
" EASYGREP CONFIGURATIONS
let g:EasyGrepFileAssociations=expand('$HOME/.vim/bundle/vim-easygrep/plugin/EasyGrepFileAssociations')
let g:EasyGrepMode=0
let g:EasyGrepCommand=1
let g:EasyGrepRecursive=1
let g:EasyGrepSearchCurrentBufferDir=1
let g:EasyGrepIgnoreCase=0
let g:EasyGrepHidden=0
let g:EasyGrepBinary=0
let g:EasyGrepFilesToInclude=''
let g:EasyGrepFilesToExclude='*.swp,*~'
let g:EasyGrepAllOptionsInExplorer=1
let g:EasyGrepWindow=0
let g:EasyGrepReplaceWindowMode=0
let g:EasyGrepOpenWindowOnMatch=1
let g:EasyGrepEveryMatch=0
let g:EasyGrepJumpToMatch=0
let g:EasyGrepInvertWholeWord=0
let g:EasyGrepPatternType='regex'
let g:EasyGrepFileAssociationsInExplorer=0
let g:EasyGrepExtraWarnings=0
let g:EasyGrepOptionPrefix='<leader>vy'
let g:EasyGrepReplaceAllPerFile=0
" let g:EasyGrepRoot='/home/eventrentalsystems/public_html'
" DEBUGGING CONFIGURATIONS
" let g:vimspector_install_gadgets = [ 'debugpy', 'vscode-cpptools', 'CodeLLDB', 'vscode-php-debug' ]
" Run :VimspectorInstall to install these
nmap <F5> <Plug>VimspectorContinue
nmap <F3> <Plug>VimspectorStop
nmap <F4> <Plug>VimspectorRestart
nmap <F6> <Plug>VimspectorPause
nmap <F9> <Plug>VimspectorToggleBreakpoint
nmap <leader><F9> <Plug>VimspectorToggleConditionalBreakpoint
nmap <F8> <Plug>VimspectorAddFunctionBreakpoint
nmap <leader><F8> <Plug>VimspectorRunToCursor
nmap <F10> <Plug>VimspectorStepOver
nmap <F11> <Plug>VimspectorStepInto
nmap <F12> <Plug>VimspectorStepOut
" for normal mode - the word under the cursor
nmap <Leader>di <Plug>VimspectorBalloonEval
" for visual mode, the visually selected text
xmap <Leader>di <Plug>VimspectorBalloonEval
" LSP CONFIUGRATIONS
function! s:on_lsp_buffer_enabled() abort
setlocal omnifunc=lsp#complete
setlocal signcolumn=yes
if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
nmap <buffer> gd <plug>(lsp-definition)
nmap <buffer> gs <plug>(lsp-document-symbol-search)
nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
nmap <buffer> gr <plug>(lsp-references)
nmap <buffer> gi <plug>(lsp-implementation)
nmap <buffer> <leader>rn <plug>(lsp-rename)
nmap <buffer> [g <plug>(lsp-previous-diagnostic)
nmap <buffer> ]g <plug>(lsp-next-diagnostic)
nmap <buffer> K <plug>(lsp-hover)
" nmap <buffer> gt <plug>(lsp-type-definition)
" nnoremap <buffer> <expr><c-f> lsp#scroll(+4)
" nnoremap <buffer> <expr><c-d> lsp#scroll(-4)
let g:lsp_format_sync_timeout = 1000
autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
" refer to doc to add more commands
endfunction
augroup lsp_install
au!
" call s:on_lsp_buffer_enabled only for languages that has the server registered.
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END
" WHICH KEY CONFIGURATIONS
let g:which_key_map = {}
" Define the mappings in a dictionary
let g:which_key_map = {}
let g:which_key_map['w'] = {
\ 'name' : '+windows' ,
\ 'w' : ['<C-W>w' , 'other-window'] ,
\ 'd' : ['<C-W>c' , 'delete-window'] ,
\ '-' : ['<C-W>s' , 'split-window-below'] ,
\ '|' : ['<C-W>v' , 'split-window-right'] ,
\ '2' : ['<C-W>v' , 'layout-double-columns'] ,
\ 'h' : ['<C-W>h' , 'window-left'] ,
\ 'j' : ['<C-W>j' , 'window-below'] ,
\ 'l' : ['<C-W>l' , 'window-right'] ,
\ 'k' : ['<C-W>k' , 'window-up'] ,
\ 'H' : ['<C-W>5<' , 'expand-window-left'] ,
\ 'J' : [':resize +5' , 'expand-window-below'] ,
\ 'L' : ['<C-W>5>' , 'expand-window-right'] ,
\ 'K' : [':resize -5' , 'expand-window-up'] ,
\ '=' : ['<C-W>=' , 'balance-window'] ,
\ 's' : ['<C-W>s' , 'split-window-below'] ,
\ 'v' : ['<C-W>v' , 'split-window-below'] ,
\ '?' : ['Windows' , 'fzf-window'] ,
\ }
" Vimspector mappings
let g:which_key_map['<F5>'] = ['<Plug>VimspectorContinue', 'Vimspector Continue']
let g:which_key_map['<F3>'] = ['<Plug>VimspectorStop', 'Vimspector Stop']
let g:which_key_map['<F4>'] = ['<Plug>VimspectorRestart', 'Vimspector Restart']
let g:which_key_map['<F6>'] = ['<Plug>VimspectorPause', 'Vimspector Pause']
let g:which_key_map['<F9>'] = ['<Plug>VimspectorToggleBreakpoint', 'Vimspector Toggle Breakpoint']
let g:which_key_map['<leader><F9>'] = ['<Plug>VimspectorToggleConditionalBreakpoint', 'Vimspector Toggle Conditional Breakpoint']
let g:which_key_map['<F8>'] = ['<Plug>VimspectorAddFunctionBreakpoint', 'Vimspector Add Function Breakpoint']
let g:which_key_map['<leader><F8>'] = ['<Plug>VimspectorRunToCursor', 'Vimspector Run To Cursor']
let g:which_key_map['<F10>'] = ['<Plug>VimspectorStepOver', 'Vimspector Step Over']
let g:which_key_map['<F11>'] = ['<Plug>VimspectorStepInto', 'Vimspector Step Into']
let g:which_key_map['<F12>'] = ['<Plug>VimspectorStepOut', 'Vimspector Step Out']
let g:which_key_map['<Leader>di'] = ['<Plug>VimspectorBalloonEval', 'Vimspector Balloon Eval']
" xmap is similar to nmap but in visual mode
let g:which_key_map['<Leader>di'] = ['<Plug>VimspectorBalloonEval', 'Vimspector Balloon Eval']
" LSP mappings
let g:which_key_map['<buffer>gd'] = ['<plug>(lsp-definition)', 'LSP Definition']
let g:which_key_map['<buffer>gs'] = ['<plug>(lsp-document-symbol-search)', 'LSP Document Symbol Search']
let g:which_key_map['<buffer>gS'] = ['<plug>(lsp-workspace-symbol-search)', 'LSP Workspace Symbol Search']
let g:which_key_map['<buffer>gr'] = ['<plug>(lsp-references)', 'LSP References']
let g:which_key_map['<buffer>gi'] = ['<plug>(lsp-implementation)', 'LSP Implementation']
let g:which_key_map['<buffer>gt'] = ['<plug>(lsp-type-definition)', 'LSP Type Definition']
let g:which_key_map['<buffer><leader>rn'] = ['<plug>(lsp-rename)', 'LSP Rename']
let g:which_key_map['<buffer>[g'] = ['<plug>(lsp-previous-diagnostic)', 'LSP Previous Diagnostic']
let g:which_key_map['<buffer>]g'] = ['<plug>(lsp-next-diagnostic)', 'LSP Next Diagnostic']
let g:which_key_map['<buffer>K'] = ['<plug>(lsp-hover)', 'LSP Hover']
let g:which_key_map['<buffer><expr><c-f>'] = ['lsp#scroll(+4)', 'LSP Scroll Down']
let g:which_key_map['<buffer><expr><c-d>'] = ['lsp#scroll(-4)', 'LSP Scroll Up']
" Register the mappings with vim-which-key
call which_key#register('<leader>', 'g:which_key_map')
nnoremap <silent> <leader> :WhichKey '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
vnoremap <silent> <localleader> :<c-u>WhichKeyVisual ','<CR>
" nnoremap <C-w> :<c-u>WhichKeyVisual 'C-w'<CR>
" nmap g :<c-u>WhichKey 'g'<CR>
" vmap g :<c-u>WhichKeyVisual 'g'<CR>
set timeoutlen=500