zsh-users
 help / color / mirror / code / Atom feed
* repeat widgets widget
@ 2022-11-10 17:30 Pier Paolo Grassi
  0 siblings, 0 replies; only message in thread
From: Pier Paolo Grassi @ 2022-11-10 17:30 UTC (permalink / raw)
  To: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]

Hello, I have defined a zle widget repeat_widget as such:

repeat_widget(){
  local lastwidget=$LASTWIDGET
  if [[ $lastwidget == repeat_widget ]]
  then
    lastwidget=
    [[ -n $_REPEAT_LAST_WIDGET ]] && lastwidget=$_REPEAT_LAST_WIDGET
  fi
  _REPEAT_LAST_WIDGET=$lastwidget

  zle $lastwidget -w
}

I would like to use it to call multiple times widgets I have associated
with complex key combinations, that are not very comfortable to repeat
multiple times

I have two problems:
1) I would like for repeat_widget to be able to pass numeric arguments to
the proxied widget, but if I do alt-number before calling repeat_widget the
last widget become numeric-argument
2) when I invoke a widget that is LASTWIDGET-aware (ie a widget that does
not reset a search variable if pressed more than one time to show the next
search result on every execution) invoking it with  repeat_widget breaks
this ability

Any idea on how to solve this problems?

to solve (2) without making the called widget aware of repeat_widget I
wonder if zle can override the value of LASTWIDGET, but it seems not from
the documentation

thanks

Pier Paolo Grassi

[-- Attachment #2: Type: text/html, Size: 1620 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-10 17:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10 17:30 repeat widgets widget Pier Paolo Grassi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).