vimrc(lsp): add codeactions bindings

This commit is contained in:
t14 2024-07-06 11:56:04 +02:00
parent 301bc3ea49
commit cc322fcff8
Signed by: wanderer
SSH Key Fingerprint: SHA256:szgNfbjbimyesAS1xfRZ0DY3hcNv9xC9ocRCJjD4Wgg

@ -1225,6 +1225,19 @@ function! s:on_lsp_buffer_enabled() abort
inoremap <buffer> <expr><c-f> lsp#scroll(+4)
inoremap <buffer> <expr><c-d> lsp#scroll(-4)
" simple code action for normal mode and visual mode
nmap <buffer> <Leader><Leader> <plug>(lsp-code-action)
vmap <buffer> <Leader><Leader> :LspCodeAction<CR>
" alternative that uses floating window
nmap <buffer> <Leader>f <plug>(lsp-code-action-float)
" mapping for filtered code actions
nmap <buffer> <Leader>ri :LspCodeAction refactor.inline<CR>
nmap <buffer> <Leader>ro :LspCodeAction source.organizeImports<CR>
vmap <buffer> <Leader>rm :LspCodeAction refactor.extract<CR>
nmap <buffer> <Leader>rm :LspCodeAction refactor.extract<CR>
" let g:lsp_format_sync_timeout = 1000
let g:lsp_format_sync_timeout = 700
augroup lsp_format_sync