-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
173 lines (155 loc) · 4.73 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
if !has('nvim')
source $VIMRUNTIME/defaults.vim
endif
let g:netrw_liststyle=3
set shell=zsh
set splitright
set ts=2 sw=2 expandtab
" Cursor in terminal
" https://vim.fandom.com/wiki/Configuring_the_cursor
" 1 or 0 -> blinking block
" 2 solid block
" 3 -> blinking underscore
" 4 solid underscore
" Recent versions of xterm (282 or above) also support
" 5 -> blinking vertical bar
" 6 -> solid vertical bar
set timeoutlen=500
set ttimeoutlen=5
if &term =~ '^xterm'
" insert mode
let &t_SI .= "\e[5 q"
" normal mode
let &t_EI .= "\e[1 q"
let &t_ti .= "\e[1 q"
let &t_te .= "\e[0 q"
" reset cursor when vim exits
autocmd VimLeave * silent !echo -ne "\033]112\007"
endif
set laststatus=2
nnoremap , :Files<CR>
nnoremap ; :Rg<CR>
nnoremap <C-p> :NERDTreeToggle<CR>
let g:lt_location_list_toggle_map = '<leader>l'
let g:lt_quickfix_list_toggle_map = '<leader>q'
" Automatic install
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin("~/.vim/plugged")
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'christoomey/vim-tmux-navigator'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'preservim/nerdtree'
Plug 'kevinoid/vim-jsonc'
Plug 'Valloric/ListToggle'
Plug 'dense-analysis/ale'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'rhysd/vim-lsp-ale'
Plug 'Shougo/echodoc.vim'
Plug 'mattn/vim-lsp-settings'
Plug 'tomlion/vim-solidity'
call plug#end()
let g:lsp_document_code_action_signs_enabled = 0
let g:lsp_document_highlight_enabled = 0
let g:lsp_fold_enabled = 1
let g:lsp_semantic_enabled = 0
let g:lsp_text_edit_enabled = 0
let g:lsp_use_lua = has('nvim-0.4.0') || (has('lua') && has('patch-8.2.0775'))
nmap <plug>() <Plug>(lsp-float-close)
" ALE configuration
let g:ale_linters_explicit = 1
let g:ale_linters = {
\'_': ['vim-lsp'],
\'solidity': ['solc']}
let g:ale_fixers = {
\'*': ['trim_whitespace'],
\'go': ['gofmt'],
\'javascript': ['prettier-eslint'],
\'typescript': ['prettier'],
\'json': ['jq'],
\'python': ['black'],
\'solidity': ['prettier'],
\'html': ['prettier'],
\'yaml': ['prettier'],
\'rust': ['rustfmt']}
nnoremap <leader>1 :LspCodeAction<CR>
nnoremap <leader>2 :LspHover<CR>
nnoremap <leader>3 :LspImplementation<CR>
nnoremap <leader>4 :LspCallHierarchyIncoming<CR>
nnoremap <leader>5 :LspCallHierarchyOutgoing<CR>
nnoremap <leader>f :ALEFix<CR>
nnoremap <leader>r :ALEStop<CR>:ALELint<CR>
nnoremap <leader>g :LspDefinition<CR>
nnoremap <leader>s :LspWorkspaceSymbol<CR>
nnoremap <leader>t :LspPreviousDiagnostic<CR>
nnoremap <leader>y :LspNextDiagnostic<CR>
nnoremap <leader>rn :LspRename<CR>
nnoremap <leader>c :NERDTreeFind<CR>
vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
autocmd FileType qf nnoremap <buffer> <CR> <CR>:cclose<CR>
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
let g:echodoc#enable_at_startup = 1
if has('nvim')
let g:echodoc#type = 'floating'
else
let g:echodoc#type = 'popup'
endif
runtime macros/matchit.vim
filetype plugin on
" Asyncomplete
imap <Nul> <Plug>(asyncomplete_force_refresh)
hi Pmenu ctermbg=DarkGray ctermfg=white
cnoreabbrev LCHI :LspCallHierarchyIncoming
cnoreabbrev LCHO :LspCallHierarchyOutgoing
"let g:lsp_log_verbose = 1
"let g:lsp_log_file = expand('~/vim-lsp.log')
" for asyncomplete.vim log
"let g:asyncomplete_log_file = expand('~/asyncomplete.log')
"
let g:lsp_settings = {
\ "eclipse-jdt-ls": {
\ 'cmd': [
\ 'java',
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
\ '-Dosgi.bundles.defaultStartLevel=4',
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
\ '-Dlog.level=ALL',
\ '-noverify',
\ '-Dfile.encoding=UTF-8',
\ '-Xmx1G',
\ '-jar',
\ expand('~/eclipse-jdt-ls/plugins/org.eclipse.equinox.launcher_*.jar'),
\ '-configuration',
\ expand('~/eclipse-jdt-ls/config_mac'),
\ '-data',
\ expand('~/eclipse-jdt-ls/workspace')
\ ]
\ }
\ }
" Flux file type
au BufRead,BufNewFile *.flux
set filetype=flux
if executable('flux-lsp')
au User lsp_setup call lsp#register_server({
\ 'name': 'flux lsp',
\ 'cmd': {server_info->[&shell, &shellcmdflag, 'flux-lsp']},
\ 'whitelist': ['flux'],
\ })
endif
nnoremap <space> za
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix