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

Re: How to make underlining of a command line disappear after an ordinary key press? (2)



On Oct 12,  1:46pm, Guido van Steen wrote:
} 
} So, this would be the best way to rebind the space bar as well: 
} 
} """space-key-press(){
} if [[ $KEYS = " " ]]; then
}       zle rebind-spacebar
} fi
} zle .self-insert
} }
} 
} zle -N self-insert space-key-press
} """

You're making this WAY more difficult than it needs to be;

    bindkey ' ' rebind-spacebar

should be quite sufficient.

You can't rename a single widget to multiple things, so if you use
"zle -N self-insert space-key-press" then you cannot also use
"zle -N self-insert ordinary-key-press".

Generally speaking you use "zle -N" when you want to replace the behavior
of a widget no matter what key is used to invoke it, and you use bindkey
when you want to change the behavior of a specific key.



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