-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
80 lines (74 loc) · 2.55 KB
/
.vimrc
File metadata and controls
80 lines (74 loc) · 2.55 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
set encoding=utf8
set hidden
set autoindent
set number
set title
set wildmenu
set autowrite
syntax on
filetype plugin indent on
nnoremap <C-e> <C-w>
autocmd FileType gitcommit setlocal spell
" Start NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree | wincmd p
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
if executable('terraform-ls')
au User lsp_setup call lsp#register_server({
\ 'name': 'terraform-ls',
\ 'cmd': {server_info->['terraform-ls', 'serve']},
\ 'allowlist': ['terraform'],
\ })
endif
if executable('gopls')
au User lsp_setup call lsp#register_server({
\ 'name': 'gopls',
\ 'cmd': {server_info->['gopls', '-remote=auto']},
\ 'allowlist': ['go', 'gomod', 'gohtmltmpl', 'gotexttmpl'],
\ 'initialization_options': {
\ 'completeUnimported': v:true,
\ 'matcher': 'fuzzy',
\ 'codelenses': {
\ 'generate': v:true,
\ 'test': v:true,
\ },
\ },
\ })
endif
if executable('ty')
au User lsp_setup call lsp#register_server({
\ 'name': 'ty',
\ 'cmd': {server_info->['ty', 'server']},
\ 'allowlist': ['python'],
\ })
endif
if executable('yaml-language-server')
au User lsp_setup call lsp#register_server({
\ 'name': 'yaml-language-server',
\ 'cmd': {server_info->['yaml-language-server', '--stdio']},
\ 'allowlist': ['yaml'],
\ })
endif
autocmd BufWritePre *.tf,*.tfvars call execute('LspDocumentFormatSync')
autocmd BufWritePre *.go
\ call execute('LspDocumentFormatSync') |
\ call execute('LspCodeActionSync source.organizeImports')
nmap gd <plug>(lsp-definition)
nmap gr <plug>(lsp-references)
nmap K <plug>(lsp-hover)
nmap <leader>rn <plug>(lsp-rename)
nmap gi <plug>(lsp-implementation)
nmap gt <plug>(lsp-type-definition)
nmap ga <plug>(lsp-code-action)
nmap [g <plug>(lsp-previous-diagnostic)
nmap ]g <plug>(lsp-next-diagnostic)
nmap gs <plug>(lsp-document-symbol-search)
nmap gS <plug>(lsp-workspace-symbol-search)
nmap <leader>pd <plug>(lsp-peek-definition)
nmap <leader>dl <plug>(lsp-document-diagnostics)
nmap <leader>cl <plug>(lsp-code-lens)
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>"
imap <c-space> <Plug>(asyncomplete_force_refresh)
let g:asyncomplete_auto_completeopt = 0
set completeopt=menuone,noinsert,noselect,preview