Am 22.05.2017 um 20:14 schrieb Brett Stahlman:
> I would like to be able to save and restore mappings
> programmatically. In order to do so, however, I need to be able to
> determine the exact lhs and rhs used to create the mapping. I had
> assumed the lhs/rhs members of the dictionary returned by maparg()
> would provided this information, but as the simple example below
> illustrates, it does not. The problem is that both the 4 character
> mapping... "<F7>" ...and the single character function key mapping
> produce the same output for maparg()['lhs'] and `nmap <buffer>'. (The
> nmap output does at least colorize the function key, but the text
> output is identical.) The 'rhs' member seems to be treated slightly
> differently, but still inconsistently: in particular, for the maps
> created under default 'cpo', 'rhs' looks correct, but for <F9>
> (created with '<' in 'cpo'), it looks wrong. I suspect what's
> happening is that 'rhs' is always reporting exactly what was typed,
> but since in the general case I have no way of knowing what 'cpo' was
> in effect when the map was created, this isn't very helpful.
>
> Is there a programmatic way to determine lhs and rhs in some sort of
> canonical form? Also helpful would be if hasmapto() (or something
> like it) told you exactly which lhs was mapped to the specified rhs.
> (I realize there could be more than one, since hasmapto() doesn't
> require an exact match, but there's a similar situation with
> mapcheck(), and it just picks one mapping to return, which can be
> useful in certain use cases.) More generally, it seems there should
> be some way to determine a list of lhs from a given rhs...
Maybe you're asking the wrong question.
"Wrong" in the sense that there are other solutions to your problem.
Could you be more specific about your use case?
--
Andy
--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sunday, May 28, 2017
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment