Prezto: Add keybinds for pound-insert and vi-pound-insert

Created on 26 Jan 2018  路  7Comments  路  Source: sorin-ionescu/prezto

Description

This was mentioned in https://github.com/sorin-ionescu/prezto/pull/1533#issuecomment-360908544

Essentially, with the addition of INTERACTIVE_COMMENT, adding a bind makes a bit of sense. pound-insert toggles the first character of the zle buffer, adding or removing a comment.

All 7 comments

I've added a workaround widget because pound-insert seems to be buggy and added a default keybind of M-; for the emacs keymap. Recommendations for the vi equivalent would be appreciated.

As i mention on #1533, vi-pound-insert works perfectly as deployed on the stock ZLE widget.
the hard part is choosing an appropriate and fairly common binding for it.

vim toggle comments is by default bound on # but only in the vmap (visual selection mode mappings) so perhaps binding to # on zsh's vicmd map could be intuitive or cause the least surprise.
Most vim users use a plugin for commenting and the bindings vary widely between implementations of the feature. so maybe # is a reasonable way to go:

bndkey -M vicmd "#" vi-pound-insert

=)

Which terminals have you used vi-pound-insert in? I was having issues in iTerm with zsh 5.4.2, but if it works that's awesome.

i'm using stock xterm (with the Uterm wrapper) and urxvt mostly.
less frequently, but still often i use putty+tmux and xterm+tmux
ive tested it on actual televideo950 and DEC VT100 hardware (not emulated) terminals and
it also works as documented
in emergencies while away from a full sized keyboard I use termux + mosh + tmux on an LG Nexus4 however that environment is heavily tweaked to minimize keyboards, so it's far from stock and probably monkeypatched to oblivion n.n

Well, I've enabled it as # under vicmd, but if there are issues reported, it may be worth switching to our implementation of pound-toggle. Thanks for the suggestion!

my pleasure. It's little nuggets like interacive_comments and pound_insert that make zsh awesome, and zprezto making them available to everyone is awesome-er =)

i'm amazed at the speed at which you implemented the alternative ZLE widget, with great, concise and speedy code, in the classic way that zprezto was relesed long ago by @sorin-ionescu . My compliments to you, @belak and to everyone involved, for your great work.=)

Thanks for the kind words! That's what we're going for. :)

Still have quite a bit to catch up on... I'd like to get the number of PRs and issues back down, but I'm hoping that'll happen over time.

Was this page helpful?
0 / 5 - 0 ratings