mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2025-12-14 20:35:59 +01:00
Add scroll keymapping
This commit is contained in:
17
autoload/lsp/internal/ui/floatwin.vim
Normal file
17
autoload/lsp/internal/ui/floatwin.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
let s:Window = vital#lsp#import('VS.Vim.Window')
|
||||
|
||||
"
|
||||
" lsp#internal#ui#floatwin#scroll
|
||||
"
|
||||
function! lsp#internal#ui#floatwin#scroll(delta) abort
|
||||
let l:ctx = {}
|
||||
function! l:ctx.callback() abort closure
|
||||
for l:winid in s:Window.find({ winid -> s:Window.is_floating(winid) })
|
||||
let l:info = s:Window.info(l:winid)
|
||||
call s:Window.scroll(l:winid, l:info.topline + a:delta)
|
||||
endfor
|
||||
endfunction
|
||||
call timer_start(0, { -> l:ctx.callback() })
|
||||
return "\<Ignore>"
|
||||
endfunction
|
||||
|
||||
@@ -1676,6 +1676,10 @@ Closes an opened preview window
|
||||
Transfers focus to an opened preview window or back to the previous window if
|
||||
focus is already on the preview window.
|
||||
|
||||
<plug>(lsp-floatwin-scroll-up) *<plug>(lsp-floatwin-scroll-up)*
|
||||
<plug>(lsp-floatwin-scroll-down) *<plug>(lsp-floatwin-scroll-down)*
|
||||
|
||||
Scroll all displayed floating windows.
|
||||
|
||||
==============================================================================
|
||||
Autocomplete *vim-lsp-autocomplete*
|
||||
|
||||
@@ -10,6 +10,7 @@ let g:lsp_log_file = get(g:, 'lsp_log_file', '')
|
||||
let g:lsp_log_verbose = get(g:, 'lsp_log_verbose', 1)
|
||||
let g:lsp_debug_servers = get(g:, 'lsp_debug_servers', [])
|
||||
let g:lsp_format_sync_timeout = get(g:, 'lsp_format_sync_timeout', -1)
|
||||
let g:lsp_floatwin_scroll_delta = get(g:, 'lsp_floatwin_scroll_delta', 4)
|
||||
|
||||
let g:lsp_completion_documentation_enabled = get(g:, 'lsp_completion_documentation_enabled', 1)
|
||||
let g:lsp_completion_documentation_delay = get(g:, 'lsp_completion_documention_delay', 80)
|
||||
@@ -172,3 +173,11 @@ nnoremap <plug>(lsp-status) :<c-u>echo lsp#get_server_status()<cr>
|
||||
nnoremap <plug>(lsp-next-reference) :<c-u>call lsp#internal#document_highlight#jump(+1)<cr>
|
||||
nnoremap <plug>(lsp-previous-reference) :<c-u>call lsp#internal#document_highlight#jump(-1)<cr>
|
||||
nnoremap <plug>(lsp-signature-help) :<c-u>call lsp#ui#vim#signature_help#get_signature_help_under_cursor()<cr>
|
||||
|
||||
nnoremap <expr> <plug>(lsp-floatwin-scroll-up) lsp#internal#ui#floatwin#scroll(-g:lsp_floatwin_scroll_delta)
|
||||
nnoremap <expr> <plug>(lsp-floatwin-scroll-down) lsp#internal#ui#floatwin#scroll(g:lsp_floatwin_scroll_delta)
|
||||
inoremap <expr> <plug>(lsp-floatwin-scroll-up) lsp#internal#ui#floatwin#scroll(-g:lsp_floatwin_scroll_delta)
|
||||
inoremap <expr> <plug>(lsp-floatwin-scroll-down) lsp#internal#ui#floatwin#scroll(g:lsp_floatwin_scroll_delta)
|
||||
xnoremap <expr> <plug>(lsp-floatwin-scroll-up) lsp#internal#ui#floatwin#scroll(-g:lsp_floatwin_scroll_delta)
|
||||
xnoremap <expr> <plug>(lsp-floatwin-scroll-down) lsp#internal#ui#floatwin#scroll(g:lsp_floatwin_scroll_delta)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user