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

Re: Simple Tip of the Day



Konstantin Sobolev wrote:
> On Friday 28 October 2005 15:47, Hannu Koivisto wrote:
> > bindkey -s '^[[5~' 'cds\r' # "PageUp"
> >
> > Just in case you are wondering what that 'cds' is, it is an
> > interactive way to select a directory from the directory
> > stack-treated-as-history, along the lines of a similar feature in
> > 4nt:
> >
[...]
>
> I'm using menu completion for this:
>
> bindkey "^Z" "menu-complete"
> bindkey -s '\ec' 'cd -^Z'

I'm using something very similar:

zle -N select-from-cd-stack
select-from-cd-stack() {
    LBUFFER=$LBUFFER"~+"
    zle menu-complete
    if [[ ${LBUFFER[-2,-1]} = "~+" ]]; then
        LBUFFER=${LBUFFER[1,-3]}
    fi
}
bindkey '\ed' select-from-cd-stack

The advantage is that I can also use it for other commands like cp (for 
example when I want to copy a file from a directory in the stack to the 
current one). And since I have setopt auto_cd, I can instantly jump to 
directories in the stack.

Another (default) binding that I really like is:
bindkey "^[h" run-help

Christian



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