0

Context:

I am using NeoVim on mac with a plugin called SpaceVim that I really like. SpaceVim basically loads a ton of mappings all mapped to the space bar.

I also have added a ton of my own personal mappings, all mapped to the comma key.

Problem

When I use SpaceVim mappings, there is a description for each option. For example, if I press "[SPC]f" (this is the SpaceVim mapping for all maps related to files), it will show me a list of options and a description for each option. See photo below:

enter image description here

When I use my own mappings, Vim will show all the options, but I am not sure how to create descriptions for each option. For example, if I press ",m" (this is will show all of my "Miscellaneous" mappings), there is no description: enter image description here

Question

Does anyone know how to add these descriptions to custom vim mappings (stored in vimrc file)?

UPDATE To clarify - I am trying to create mapping previews without the use of spacevim or any other plugin. I did find this plugin which looks promising, but still looking for simple a vim / neovim only solution (which may not exist). https://github.com/spinks/vim-leader-guide Also, custom mappings can be created via spacevim with custom previews (see here for docs - https://spacevim.org/documentation/#bootstrap-functions) but still hoping to find a vim / neovim only solution :)

Thanks!!

6
  • 1
    Welcome to Vi&Vim SE. Please check the documentation before posting a question. Here's a freebie for a new contributor: spacevim.org/documentation/#mappings-guide (Took me five minutes to find this despite never having used SpaceVim.)
    – B Layer
    Aug 17 at 15:45
  • 1
    @BLayer - sorry, to clarify, I am asking if this can be done easily without spacevim (purely in vim or neovim). I found this plugin which looks promising, but still sort of defeats the purpose of trying to do this purely in vim / neovim github.com/spinks/vim-leader-guide Aug 17 at 17:56
  • 1
    That's a feature of SpaceVim. Native Vim has nothing of the sort. You'd have to code it up...which would be a waste of time, obviously, with a plugin(s) already doing it for you.
    – B Layer
    Aug 17 at 18:23
  • 1
    Thanks B and Ben! That makes sense. @D.BenKnoble, very nice! I will have to check out your plugin! Looks like exactly what I'm looking for. Aug 17 at 19:39
  • 1
    As filbranden said, whatever you come up with that works for you, post an answer! I might just convert my comment to an answer...
    – D. Ben Knoble
    Aug 17 at 19:51
1

What @BLayer said in the comments is correct; I thought SpaceVim used a plugin for this, but now I believe they have custom code. You can write your own code to do it (which is what you need to do in a "pure vim" solution), but at that point (unless a plugin doesn't offer what you need), it's not any different from using one.

Shameless plug: I use my own https://github.com/benknoble/popsikey plugin for this. It creates regular mappings when popups aren't supported, though it uses some newer vim8 syntax. It doesn't quite support every map feature, as that's a task with diminishing returns in this declarative style.

Here's a screenshot, for fun:

enter image description here

It's actually surprisingly versatile, especially with the submenu support. Here are a few examples:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.