-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
67 lines (64 loc) · 2.07 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
set fenc=utf-8
set nobackup
set noswapfile
set autoread
set hidden
set showcmd
set number
set cursorline
set virtualedit=onemore
set smartindent
set visualbell
set showmatch
set laststatus=2
set wildmode=list:longest
nnoremap j gj
nnoremap k gk
syntax enable
set list listchars=tab:\▸\-
set expandtab
set tabstop=2
set shiftwidth=2
set ignorecase
set smartcase
set incsearch
set wrapscan
set hlsearch
nmap <Esc><Esc> :nohlsearch<CR><Esc>
call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
Plug 'mattn/vim-goimports'
Plug 'hashivim/vim-terraform' , { 'for': 'terraform'}
call plug#end()
function! s:on_lsp_buffer_enabled() abort
setlocal omnifunc=lsp#complete
setlocal signcolumn=yes
if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
nmap <buffer> <leader>ac <plug>(lsp-code-action)
nmap <buffer> <leader>cl <plug>(lsp-code-lens)
nmap <buffer> <leader>df <plug>(lsp-definition)
nmap <buffer> <leader>dd <plug>(lsp-document-diagnostics)
nmap <buffer> <leader>im <plug>(lsp-implementation)
nmap <buffer> <leader>pdf <plug>(lsp-peek-definition)
nmap <buffer> <leader>sm <plug>(lsp-document-symbol-search)
nmap <buffer> <leader>Sm <plug>(lsp-workspace-symbol-search)
nmap <buffer> <leader>rf <plug>(lsp-references)
nmap <buffer> <leader>td <plug>(lsp-type-definition)
nmap <buffer> <leader>rn <plug>(lsp-rename)
nmap <buffer> <leader>en <plug>(lsp-next-error)
nmap <buffer> <leader>ep <plug>(lsp-previous-error)
nmap <buffer> <leader>ho <plug>(lsp-hover)
let g:lsp_format_sync_timeout = 500
autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
endfunction
augroup lsp_install
au!
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>"