prabirshrestha / vim-lsp

async language server protocol plugin for vim and neovim
MIT License
3.07k stars 303 forks source link

Vim <Ctrl-D> and <Ctrl-F> stopped working #1522

Closed mettavi closed 7 months ago

mettavi commented 7 months ago

Hi, I recently installed vim-lsp and noticed that the normal vim keys to move half a screen <Ctrl-D> and a full screen <Ctrl-F> down stopped working.

It looks like these mappings overwrote them:

    nnoremap <buffer> <expr><c-f> lsp#scroll(+4)
    nnoremap <buffer> <expr><c-d> lsp#scroll(-4)

I confirmed this by running :verbose map <C-d>/<C-f>.

Is this expected behavior, or do I need to change the configuration?

cherryeclipseworks commented 7 months ago

In vim i manage to get it working by doing this mapping:

    nmap <expr><buffer> <c-d> popup_list()->empty() ? '<c-d>' : lsp#scroll(+4)
    nmap <expr><buffer> <c-u> popup_list()->empty() ? '<c-u>' : lsp#scroll(-4)

I'm just trying to make it work properly with neovim now

mettavi commented 7 months ago

Thanks, I don't completely understand the syntax, but it seems to work. 🙏 Should this be the default?

In neovim, I use the built-in lsp with nvim-lspconfig and mason.

cherryeclipseworks commented 7 months ago

it's pretty simple actually

it's a ternary checking for the list of popups opened, for some reason the function pumvisible() doens't work, probably should be the default

cc @prabirshrestha