cajus-nvim icon indicating copy to clipboard operation
cajus-nvim copied to clipboard

Inserting multiple strings in succession + scrolling the doc popup

Open diskriminantti opened this issue 2 years ago • 2 comments

First of all, thanks a lot for the repo! Made it very easy for me to switch from CoC to native LSP. Also editing $MYVIMRC is pretty fun when you can evaluate it straight away without any binds to source the file etc.

I wanted to ask a couple of questions which I was unable to figure out on my own:

With my old setup, I could write a list of strings like this:

  1. Type a [ -> nvim completes it to [|] and inserts the cursor between the brackets
  2. Type " to start writing a string out, nvim again completes it to ["|"] and I can begin typing a string
  3. After typing a string, e.g. ["hello|"], and I want to insert another string, I could type a " again, and the result would be like this: ["hello" "|"]

The process works just the same until this point: ["hello|"] . Typing another starting quote will end up like this ["hello "|" "] , which breaks the existing string and is a bit annoying to fix. I have no idea if it's possible to change this behavior to match what it was before , it's just something I noticed after a bit.

Also, I was unable to scroll the documentation popup, which appears by pressing K or <Leader>K. If I understood correctly, in the cmp config it seems like Ctrl+d and Ctrl+f are used for scrolling the documentation window. I'm not sure if it's due to my environment (using Windows Terminal with Ubuntu 20.04), or some existing keybind which prevents them from working or what. For example, pressing Ctrl+d after opening the doc popup, my cursor will just go down half a screen, which I think is its default behavior.

Anyways, maybe you happen to know some fixes off the top of your head or not, but these were some things I found which bothered me and decided to ask 😄

diskriminantti avatar Dec 13 '21 17:12 diskriminantti

Hey thanks for your interest and your questions,

About the [ and " "auto complete" you can have it using vim-sexp and vim-sexp-mappings-for-regular-people plugins, I did use those in my personal setup, if you want you can add these lines on yours: https://github.com/rafaeldelboni/dotfiles/blob/master/config/nvim/fnl/config/plugin.fnl#L45-L49 https://github.com/rafaeldelboni/dotfiles/blob/master/config/nvim/fnl/config/plugin/sexp.fnl

Please check this and this for more info.

About the document scrolling this isn't related to nvim-cmp, but with nvim itself. You can enter the documentation buffer pressing K twice as nanoteee says here :

According to :help vim.lsp.buf.hover(), you should be able to jump into the floating window by calling the function twice in a row (or pressing K twice in your case). It used to work for me but doesn't anymore. I think this PR fixes it: https://github.com/neovim/neovim/pull/12720

rafaeldelboni avatar Dec 13 '21 21:12 rafaeldelboni

Thanks a lot for the help! I got the scrolling working now with those instructions, awesome. 👍

I was still unable to get the quote stuff working as per my example, even after installing the sexp plugins (I did have them installed before as well, forgot to mention it). I do get automatched parenthesis and quotes, but I can't seem to replicate the behavior I previously had (aka. the 3rd step of my initial post is still not the same). It's not a huge deal anyway, so I can live with it. Tried comparing against my old $MYVIMRC, and can't find anything which would explain the difference. Thanks a lot for the help in any case!

diskriminantti avatar Dec 14 '21 16:12 diskriminantti

I will close this issue, feel free to reopen if you need anything related to this again :)

rafaeldelboni avatar Sep 20 '22 20:09 rafaeldelboni