1

In gvim it is possible to get plugin-specific toolbars (see screenshot attached). Is something like this possible in nvim? Is there a GUI for nvim in which it is possible?

From Googling, the only thing I've been able to find is that this is an unpopular question to ask. Apparently using a toolbar is un-vim. I don't understand this. Toolbars do not necessarily involve using a mouse. They are a convenient way to get a quick list of keyboard shortcuts for plugins that may not be frequently used.

For example, sometimes I code in R and I use the excellent Nvim-R plugin. However, I can go for months at a time between R coding sessions, so I naturally forget some of the keybindings. Having a menu entry in a toolbar is a really easy way to jog my memory: enter image description here I would certainly be open to non-toolbar ways to achieve the same thing. Searching through the help each time is not efficient. Quickly outputting a list of keybindings in a side-bar window would be a good solution.

4

I built a plugin for this :)

It’s called popsikey: you define a prefix mapping, and a list of mappings under that prefix. When you type the prefix, all the mappings are presented in a navigable popup. You can then hit the actual mapping key, or navigate with j/k/enter/escape.

If popups aren’t supported, you just get all the mappings defined under the prefix. (Though the code uses features from fairly recent vim, like lambdas and method chaining, so it seems unlikely that popups aren’t supported if the plugin loads without error. Also, I haven’t tested with neovim and I don’t know what its popup API looks like.)

There are some slight limitations due to the RHS of maps being stringly-typed, but it does enough to be useful for simple things, and examples look fairly declarative.

Here's a screenshot with some ALE (<leader>a) commands mapped for ease-of-access:

enter image description here

8
  • A screenshot is a must for such a plugin. – eyal karni Aug 21 '20 at 22:56
  • @eyalkarni how's that? I didn't crop it, but – D. Ben Knoble Aug 23 '20 at 17:53
  • it looks nice indeed – eyal karni Aug 23 '20 at 19:41
  • 1
    The #{k:v} you use isn't compatible with neovim probably. – eyal karni Aug 23 '20 at 19:51
  • 1
    Yeh, Literal dicts are about to be introduced. I am waiting for this to happen. github.com/neovim/neovim/pull/12741 – eyal karni Aug 26 '20 at 21:39
2

First things first, Neovim itself is a server process (that also has a builtin fallback TUI, but it's not of interest here), which communicates with one (or several) frontend UI applications.

Now, all VimScript runs on "the server", while all the UI is drawn by "the frontend". Of course, there's an open inter-process communication channel between them, and you can even send messages from within VimScript, however, Neovim neither defines specific API for creating menus and toolbars, nor even requires "the frontend" to have them at all.

And so, it's theoretically possible, but in practice you just can't.

1
  • Ok, I think I understand. Is it correct to say that this is a consequence of the design of NeoVim relative to Vim? – evencoil Aug 24 '20 at 14:52

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.