lichray / nvi2

A multibyte fork of the nvi editor for BSD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Special symbols notation in map

konyahin opened this issue · comments

Hello. I like nvi2 and I like ability to make my own maps with shell integration. It allows me to doing cool stuff, like

" open current word in man
map ;m wb"zyw:^[C!man^V ^["zp^M

" fzf open files
map ;o :^[:!ls -R ^V| fzf >> %^M:edit^M^MIEdit ^[^M^W:bg^M

But I be needed to use unprintable special characters, if I want to use enter, or escape. So my maps become unreadable and unmaintainable. In big brother we can do something like that:

map ;t itest1<Enter>test2<Enter>test3<Esc>

I looked at source code and now I have working prototype of patch with this stuff. But before I will make boring work (documentation, new option and code cleaning), I want to ask you, do you see things like this in nvi? Will you accept my PR, or it to much for nvi?

It may not be backward-compatible to let ex (nvi's cmdline core or scripting language) interpret characters differently, but making special characters more readable and editable is possible. If you like that approach, you can look at how the code displays \uXXXX Unicode escape sequences. The end effect will be displaying U+001B as <Esc>, a five-character wide glyph, but it is treated as one character when editing.

commented

@konyahin nvi2 already does a pretty good job of displaying non-printable characters but, if you'd like to view them oursite of nvi, then just use vis(1) as this is precisely its job.

Thank your @lichray I will think in this direction.
@rjc maybe I will happy with it, thank you.