Hi, I have the nvim-cmp package installed and I want to bind a keymap to show me the docs of the function my cursor is hovering over currently. For example, let’s take this rust code:
I want to be able to just hover over the split()
function and press a keybind like “” to open up the documentation for the function. I looked at the options for cmp and I saw that there was a cmp.mapping.open_docs()
function, but when I set my keybind to it, it did nothing. I positive this is possible because I saw someone do it, but is there anything I might be doing wrong here?
Here are my mappings:
settings.mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-whatever>" = "cmp.mapping.open_docs()";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
};
I am using nixvim, but that shouldn’t matter for this.