Erik wrote:
> On 15.12.14 12:09, BPJ wrote:
> > > The reason I'm asking is that I'm writing something which parses
> > > keymaps and turns them into another something which a third something
> > > can use to transliterate strings.
> Is your task amenable to using simple methods? E.g.:
> $ echo Ewokhbhs laoohmf rsqhmfr akrn vnqj | tr "[a-y]" "[b-z]"
> In Vim it is so quick and easy to run a line or paragraph through an
> external filter, to be replaced with the filter's output. What could be
> niftier.
Alas it is not. By transliteration I mean things like changing the
two-character sequence "ch" into the single Cyrillic letter "ч"
(U+0447), so the tr utility won't be up to the task. Moreover I'm
doing this outside of Vim, transcribing text files batchwise
programmatically, it's just that I have the needed replacements
already written up as Vim keymaps, so I'm writing a script to
convert Vim keymaps into the correspondence tables needed by the
script doing the file transliteration. (The latter basically
imports the correspondence table as an associative array and
constructs a huge regular expression from the keys, then does a
single longest-leftmost substitution pass. See here for the
theoretical background:
<http://interglacial.com/~sburke/braille/tpj_article.txt>.
(BTW Sean M. Burke's self-description "likes making linguists
think he's a programmer, and programmers think he's a linguist"
would fit me very well too! ;-)
> -- I have yet to see any problem, however complicated, which, when you looked at it in the right way, did not become still more complicated. - Poul Anderson
Great quote from a great writer, BTW!
Mathias Rav wrote:
> On Mon, Dec 15, 2014 at 12:09 PM, BPJ wrote:
> > > Can the "<" (less-than/left angle bracket) char be escaped with backslash in Vim keymaps? Or to put it otherwise: which characters can be escaped with a backslash in a keymap?
> :help mbyte-keymap also says that the first column can be in <> form.
> Did you try using <lt> instead of \<?
Of course I did, that being the normal way, but I wanted to cover
all possibilities I might encounter.
However it seems that `\"` and `\\` *are* the only legit backslash
escapes in Vim keymaps, so I will continue to only support those two.
Anyway thanks for answering both of you!
/bpj
--
--
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.
No comments:
Post a Comment