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

repeat widgets widget



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



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