auto-fu.zsh icon indicating copy to clipboard operation
auto-fu.zsh copied to clipboard

bindkey to disable auto-fu?

Open joe9 opened this issue 11 years ago • 1 comments

Hello,

I am trying to figure out how to switch between "predict-on"/"predict-off" and auto-fu.

This is my predict-on setting.

autoload predict-on zle -N predict-off zle -N predict-on bindkey '^Z' predict-on

bindkey '^X^Z' predict-off

bindkey '^X' predict-off zstyle ':predict' verbose true

I noticed that I cannot have both predict-on and auto-fu active at the same time. What do I do to turn-off auto-fu?

Is it possible to have bindkeys as the predict-on does to turn on/off auto-fu?

I tried zle -N auto-fu-off and zle-N auto-fu-deactivate. But, both did not seem to do anything.

Any thoughts, please?

Thanks Joe

joe9 avatar Feb 26 '13 05:02 joe9

Hi, Joe! Ugh, predict-on... Good catch!

To turn-off auto-fu (and then predict-on) is a little tricky, but I can accomplish it like this:

# predict-on setting
autoload -Uz predict-on
zle -N predict-on  
bindkey '^Z' predict-on

auto-fu-exit-predict-on () {
  zle -U $'\C-Z' # assume $'\C-Z' is predict-on key
  zle send-break   
}                  
zle -N auto-fu-exit-predict-on
# -M afu is special; keymap for auto-fu is in effect
bindkey -M afu '^Z' auto-fu-exit-predict-on

# forcibly turn-on auto-fu
auto-fu-force-on () { zle zle-line-init }
zle -N auto-fu-force-on

I hope this helps.

hchbaw avatar Feb 27 '13 00:02 hchbaw