Tips

Define Zsh ZLE widget

You can use the ZLE widget rash-zle-isearch loaded by rash init to define your own modified widget. It takes arguments and passes them to rash isearch directly. Here is a recipe for “Do What I Mean” search:

rash-zle-dwim(){
    rash-zle-isearch --query-template "-x 0 -d . @ {0} "
}
zle -N rash-zle-dwim
bindkey "^Xs" rash-zle-dwim

In the configuration file, you should define an alias called @ like this (see also config.search.alias):

config.search.alias['@'] = [...]  # some complex query

Using RASH in old version of zsh

RASH depends on precmd_functions / preexec_functions hooks in zsh. In old version zsh doesn’t have it. However, you can use RASH by adding this in your .zshrc.

precmd(){
    for f in $precmd_functions
    do
        "$f"
    done
}

preexec(){
    for f in $preexec_functions
    do
        "$f"
    done
}