Ernie Rael wrote:
> Looking to print/popup a list of plugin shortcuts (extracted from map
> commands); the plugin has around a dozen commands. It is currently
> difficult, if not impossible, to reliably get the mappings that exist
> for a command.
>
> Suggest builtin like
>
> mapfind(match_to: dict<any> = null): list<dict<any>>
>
> Where each element of the returned list is a dict as described for the
> return in maparg. Without "match_to" return a list of all mappings; if
> match_to is present, only mappings that match are returned. For example,
> match_to might be, "{rhs: 'DirDiff'}".
>
> Hoping to squeeze this into vim9; to that end I'm thinking of
> implementing no-args mapfind first. This is much simpler and avoids the
> discussion, for now, of what map_to can contain and its semantics.
>
> Looking for a "seems ok", before I embark on implementation.
I suppose that if you want to know "what was that mapping I put in for
that command" and don't even know where you defined it, it can be hard
to find.
You can use :filter:
:filter NextCommand map
But you have to redirect the output and process it, which can be tricky
for special keys.
I can't think of another function to use for this, thus adding mapfind()
seems useful. Would we also make it possible to find using the LHS?
At least the function name should somehow indicate matching the RHS, or
be able to do both.
--
Give a man a computer program and you give him a headache,
but teach him to program computers and you give him the power
to create headaches for others for the rest of his life...
R. B. Forest
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220421202406.AA3B91C0330%40moolenaar.net.