-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimplug
191 lines (164 loc) · 5.93 KB
/
.vimplug
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
" Plugin loading and handling
let plug_path = '~/.vim/autoload/plug.vim'
if has('win32')
let plug_path = "$LOCALAPPDATA/nvim-data/site/autoload/plug.vim"
endif
"
if empty(glob(plug_path))
echo "Installing vim-plug to ". plug_path
if has('win32')
silent !iwr -useb "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" | ni plug_path -Force
else
silent !curl -fLo plug_path --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/bundle')
if !exists('g:vscode')
Plug 'dracula/vim', {'as': 'vim-dracula-theme'}
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/nerdcommenter'
Plug 'cohama/lexima.vim'
Plug 'thaerkh/vim-indentguides'
Plug 'machakann/vim-sandwich'
Plug 'sheerun/vim-polyglot'
Plug 'junegunn/goyo.vim'
"Plug 'ap/vim-buftabline'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-fugitive'
Plug 'mhinz/vim-signify',
Plug 'ryanoasis/vim-devicons', !has('win32') ? {} : { 'on': [] }
endif
call plug#end()
autocmd BufWritePre *.go :silent call CocAction('runCommand', 'editor.action.organizeImport')
" Color scheme
set termguicolors
augroup colorscheme_customization
autocmd ColorScheme dracula highlight Normal ctermbg=244 guibg=NONE ctermbg=NONE
autocmd ColorScheme dracula highlight DraculaBgDark ctermbg=244 guibg=#172030
autocmd ColorScheme dracula highlight DraculaBgDarker ctermbg=244 guibg=#101220
autocmd ColorScheme dracula highlight DraculaTodo cterm=bold ctermfg=cyan gui=bold guifg=cyan guibg=black
augroup END
color dracula
" Restore some overridden colors
highlight CocUnderLine cterm=underline gui=underline
highlight link CocErrorSign Error
highlight link CocWarningSign WarningMsg
highlight link CocInfoSign Special
highlight link CocHintSign NonText
highlight link CocSelectedText Visual
highlight link CocCodeLens LineNr
highlight link CocErrorHighlight SpellBad
highlight link CocWarningHighlight SpellLocal
highlight link CocInfoHighlight SpellRare
highlight link CocHintHighlight Conceal
" -------------------------------------------------------------"
" vim-plug settings PS
" -------------------------------------------------------------"
" NERDTree
let g:NERDTreeSortHiddenFirst=1
let g:NERDTreeChDirMode=2
let g:NERDTreeHijackNetrw=1
let g:NERDTreeMinimalUI=1
let g:NERDTreeIgnore=['^__pycache__']
let g:NERDTreeCascadeSingleChildDir=0
let g:NERDTreeCascadeOpenSingleChildDir=0
let g:NERDTreeStatusline='%( %{pathshorten(fnamemodify(getcwd(), ":~"))}%)'
" NERDCommenter
let g:NERDCreateDefaultMappings=0
" Vim Airline
"let g:airline_extensions = [ ]
let g:airline_extensions=[
\'branch',
\'quickfix',
\'coc',
\'tabline',
\]
let g:airline_powerline_fonts = 1
function! AirlineInit()
call airline#parts#define_function('filesize', 'GetFileSize')
call airline#parts#define_condition('filesize', 'expand("%:t") != ""')
let g:airline_section_a = airline#section#create(['%{PrettyPrintCurrentDirectory()}'])
"let g:airline_section_z = airline#section#create(['filesize', ':%{col(\'.\')}'])
let g:airline_section_z = airline#section#create(['filesize'])
let g:airline_symbols.dirty='✗'
endfunction
autocmd User AirlineAfterInit call AirlineInit()
" -------------------------------------------------------------"
" Language Server Protocol settings LS
" -------------------------------------------------------------"
" Extension List
let g:coc_global_extensions=[
\'coc-tsserver',
\'coc-css',
\'coc-html',
\'coc-json',
\'coc-prettier',
\'coc-emmet',
\'coc-yaml',
\'coc-omnisharp',
\'coc-vimlsp',
\'coc-sh',
\'coc-powershell',
\'coc-clangd',
\'coc-rust-analyzer',
\'coc-pyright',
\'coc-go',
\'coc-docker',
\]
" Completion
set keywordprg=:call\ <SID>ShowDocumentation()
" Documentation
autocmd! User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
"autocmd! User CocLocationsChange CocList --normal -A location
"autocmd CursorHold * silent call CocActionAsync('highlight')
" LSP Snippets
let g:coc_snippet_next='<TAB>'
let g:coc_snippet_prev='<S-TAB>'
" -------------------------------------------------------------"
" vim-plug keymaps PK
" -------------------------------------------------------------"
" Vim-Signify
nnoremap <silent> <Leader>- :SignifyToggle<CR>
" NERDTree
nnoremap <silent> <C-b> :NERDTreeToggle<CR>
" NERDCommenter
nnoremap <silent> <Leader>cc :call nerdcommenter#Comment(0, 'toggle')<CR>
vnoremap <silent> <Leader>cc :call nerdcommenter#Comment(0, 'toggle')<CR>
" LSP Diagnostics
nnoremap <Leader>i :<C-u>CocList --normal --no-sort diagnostics<CR>
nmap <silent> <c <Plug>(coc-diagnostic-prev)
nmap <silent> >c <Plug>(coc-diagnostic-next)
" LSP Autocompletion
inoremap <silent> <expr><C-Space> coc#refresh()
"inoremap <expr><TAB> pumvisible() ? "\<C-y>" : "\<TAB>"
"inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
"inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-TAB>"
" LSP Gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gt <Plug>(coc-type-defintion)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" LSP Rename
nmap <Leader>cn <Plug>(coc-rename)
" LSP CodeAction
nmap <Leader>a <Plug>(coc-codeaction)
nnoremap <Leader>; :<C-u>CocList --normal --no-sort<CR>
"nnoremap <Leader>t :<C-u>CocList --normal --no-sort symbols<CR>
"nnoremap <Leader>x :<C-u>CocList --normal --no-sort extensions<CR>
" LSP Documentation
nnoremap <silent> <C-k> :call ShowDocumentation()<CR>
" LSP Format
nmap <silent> <Leader>f <Plug>(coc-format)
vmap <silent> <Leader>f <Plug>(coc-format-selected)
function! ShowDocumentation() abort
if &filetype == "vim"
execute "h ".expand("<cword>")
else
call CocAction("doHover")
endif
endfunction
" vim:ft=vim