Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Best practice for smkx and ZLE?



Hi, Zsh folks,

Is there a consensus in the Zsh community about whether we should generally
be using smkx/rmkx in zle-line-init/finish to switch in to application
keypad mode when ZLE is active? And if so, where it's best to configure
this - i.e. in system-wide /etc/z* files vs. individual user's ~/.zshrc?

I've run in to this a few times working with my own config files and with
Oh My Zsh, and am wondering whether the generally accepted thing is
to do so at this point.

On the upside, doing `smkx` means you can use the terminfo entries to
portably get the character sequences for the arrow and home/end keys.

On the downside:

 - zle_line_init() doesn't compose easily (like $precmd_functions and other
   multi hooks do), so one init file's definition can clobber another's,
   and whoever defines the effective zle_line_init must include it.
- smkx (usually) puts both the cursor and numeric keypads in to application mode.
   There's no default binding for the sequences emitted by the numeric
   keypad in app mode, so using it gives you junk on the command line,
   instead of numbers.
 - Among smaller terminal emulators, there's more variability in behavior
   in application mode than in normal mode. E.g. some don't change Home
   and End behavior while in cursor application mode, or respect smkx
   at all, though they still set $TERM to 'xterm'. But their normal mode
   behavior tends to match xterm's. So terminfo-based
   cursor key bindings may end up being less portable in practice.

There've been a few discussions about it on this list with respect to
particular problems.

http://www.zsh.org/mla/users//2010/msg00065.html
http://www.zsh.org/mla/users//2014/msg00567.html
http://www.zsh.org/mla/users//2014/msg00030.html

But I don't know if there's general consensus, and I haven't seen
anything in the Zsh reference manual or other documentation
recommending it for general use. Any conclusions on this?

Cheers,
Andrew Janke



Messages sorted by: Reverse Date, Date, Thread, Author