-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig-vim.vim
More file actions
218 lines (184 loc) · 6.43 KB
/
config-vim.vim
File metadata and controls
218 lines (184 loc) · 6.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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Load Providers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PYTHON PROVIDERS {{{
if has('macunix')
" OSX
let g:python3_host_prog = '/usr/local/bin/python3' " -- Set python 3 provider
let g:python_host_prog = '/usr/local/bin/python2' " --- Set python 2 provider
elseif has('unix')
" Ubuntu
let g:python3_host_prog = '/usr/bin/python3' " -------- Set python 3 provider
let g:python_host_prog = '/usr/bin/python' " ---------- Set python 2 provider
"Needed for vim appimage. See https://github.com/vim/vim-appimage/releases
set pythonthreedll=libpython3.10.so
elseif has('win32') || has('win64')
" Windows
endif
" }}}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => LANGUAGE SERVER
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ## vim-lsp ecosystem
"
"{{{
"Plug 'prabirshrestha/vim-lsp'
"Plug 'mattn/vim-lsp-settings'
"Plug 'prabirshrestha/asyncomplete.vim'
"Plug 'prabirshrestha/asyncomplete-lsp.vim'
"
"" ## config
"filetype plugin on
"
"function! s:on_lsp_buffer_enabled() abort
" setlocal omnifunc=lsp#complete
" setlocal signcolumn=yes
" if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
"
" let g:lsp_format_sync_timeout = 1000
" autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
"
"endfunction
"
"augroup lsp_install
" au!
" " call s:on_lsp_buffer_enabled (set the lsp shortcuts) when an lsp server
" " is registered for a buffer.
" autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
"augroup END
"}}}
" ## coc-vim ecosystem
"{{{
" Use "coc.preferences.formatOnType": true to enable format on type feature.
" https://vi.stackexchange.com/a/31087/5223
" https://github.com/neoclide/coc-prettier
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => PLUGINS
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugins-vim')
" - common plugins"
source $HOME/.vim/config-common.vim
" - Coc.nvim"
if empty($COC_PROFILE)
let g:coc_profile = "default"
else
let g:coc_profile = $COC_PROFILE
endif
source $HOME/.vim/viml/coc-nvim.vim
" - Makes Gvim only colorschems work in term / nc with neovim
Plug 'godlygeek/csapprox'
" - Replaces gitgutter, which erros on managed windows devices
if has('nvim') || has('patch-8.0.902')
Plug 'mhinz/vim-signify'
else
Plug 'mhinz/vim-signify', { 'tag': 'legacy' }
endif
" - POLYFILL: Neovim Healthcheck
Plug 'rhysd/vim-healthcheck'
" ```
" - WIDGET: Terminal/ Vimshell
" ```
if executable('mingw32-make')
Plug 'Shougo/vimproc', {
\ 'do' : 'mingw32-make -f make_mingw32.mak'
\ }
elseif executable('make')
Plug 'Shougo/vimproc', {
\ 'do' : 'make'
\ }
else
Plug 'Shougo/vimproc'
endif
Plug 'Shougo/vimshell'
"{{{
autocmd FileType vimshell let b:copilot_enabled = v:false
nnoremap <S-t> :VimShellPop<CR>
nnoremap <C-Space> :VimShellPop<CR>
inoremap <C-Space> <esc>:VimShellPop<CR>
vnoremap <C-Space> :VimShellPop<CR>
"linux
nnoremap <C-@> :VimShellPop<CR>
inoremap <C-@> <esc>:VimShellPop<CR>
vnoremap <C-@> :VimShellPop<CR>
let g:vimshell_user_prompt = 'fnamemodify(getcwd(), ":~")'
let g:vimshell_prompt = '$ '
" open new splits actually in new tab
let g:vimshell_split_command = "tabnew"
if has("gui_running")
let g:vimshell_editor_command = "gvim"
endif
" Use same keybindings to go forward and back in prompt as in vim bash
"inoremap <buffer> <S-k> <Plug>(vimshell_previous_prompt)
"inoremap <buffer> <S-j> <Plug>(vimshell_next_prompt)
" Unmap C-j, C-k in normal mode to use default navigation
function! VSmap(...)
nmap <buffer><silent> <C-J> 10j
nmap <buffer><silent> <C-K> 10k
endfunction
function! VSmapChooser()
if has("nvim")
call jobstart(['bash','-c','echo "-"; exit;'],{'on_stdout':'VSmap'})
else
call job_start(['bash','-c','echo "-"; exit;'],{'out_cb':'VSmap'})
endif
endfunction
"Group name can be arbitrary so long as doesn't conflict with another
augroup VimshellMapping
autocmd!
"Get filetype with :echom &filetype when in buffer
autocmd FileType vimshell :call VSmapChooser()
augroup END
"}}}
"Plug 'supermomonga/vimshell-inline-history.vim', { 'depends' : [ 'Shougo/vimshell.vim' ] }
Plug 'tecfu/vimshell-inline-history.vim', { 'depends' : [ 'Shougo/vimshell.vim' ] }
"{{{
function! VSHistmapCB(...)
let g:vimshell_inline_history#default_mappings = 0
imap <buffer> <C-j> <Plug>(vimshell_inline_history#next)
imap <buffer> <C-k> <Plug>(vimshell_inline_history#prev)
endfunction
function! VSHistmap()
if has("nvim")
call jobstart(['bash','-c','echo "-"; exit;'],{'on_stdout':'VSHistmapCB'})
else
call job_start(['bash','-c','echo "-"; exit;'],{'out_cb':'VSHistmapCB'})
endif
endfunction
"Group name can be arbitrary so long as doesn't conflict with another
augroup VSHistMapping
autocmd!
"Get filetype with :echom &filetype when in buffer
autocmd FileType vimshell :call VSHistmap()
augroup END
"}}}
" - THEME
" coc ui styling
" Not a fan of the gray gutter (SignColumn) that comes with the theme
highlight SignColumn guibg=black ctermbg=black
" Not a fan of pink background in popup menu
highlight Pmenu ctermbg=DarkGreen guibg=DarkGreen
" hi CocErrorSign ctermfg=white guifg=white
"hi CocErrorFloat ctermfg=white guifg=white
hi CocInfoSign ctermfg=black guifg=black
hi CocFloating ctermfg=black guifg=black
hi CocFloating ctermbg=DarkRed guibg=DarkRed
hi CocHintFloat ctermfg=white guifg=white
hi CocWarningFloat ctermfg=white guifg=white
hi CocErrorFloat ctermfg=white guifg=white
"hi CocFloating ctermbg=DarkYellow guibg=DarkYellow
"hi QuickFixLine ctermbg=DarkRed guibg=DarkRed
"hi QuickFixLine ctermbg=yellow guibg=yellow
"hi QuickFixLine ctermfg=white guifg=white
Plug 'tecfu/tokyonight-vim'
"let g:tokyonight_style = 'night'
let g:tokyonight_enable_italic = 1
set termguicolors
" Define a function to set the colorscheme and background color
function! SetColorscheme()
highlight Normal guibg=#222436 ctermbg=235
highlight EndOfBuffer guibg=#222436 ctermbg=235
endfunction
" Use an autocmd to call the function on VimEnter with ++once to ensure it runs only once
autocmd VimEnter * ++once call SetColorscheme()
call plug#end()
colorscheme tokyonight