Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Simple Tip of the Day
- X-seq: zsh-users 9580
- From: Hannu Koivisto <azure@xxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Simple Tip of the Day
- Date: Fri, 28 Oct 2005 14:47:51 +0300
- In-reply-to: <ci14m1hm45ig6umsu2v0tkini1gp0bad3r@xxxxxxx> (zzapper's message of "Fri, 28 Oct 2005 12:11:53 +0100")
- Mail-copies-to: nobody
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <ci14m1hm45ig6umsu2v0tkini1gp0bad3r@xxxxxxx>
- Sender: Hannu Koivisto <Hannu.Koivisto@xxxxxxxxxxx>
zzapper <david@xxxxxxxxxx> writes:
> bindkey -M viins '^O' copy-prev-word
>
> "^O" copy-prev-word
>
> allows me to type say
>
>> cp longfilename.tex ^O
>> cp longfilename.tex longfilename.tex
> which I then modify
Wouldn't copy-prev-shell-word be even more useful for that purpose?
It handles things like cp filename\ with\ spaces.txt ^O
> Your most useful binding?
Hmm, I can't name just one. But I couldn't imagine using zsh
without the following:
bindkey '^[[A' history-beginning-search-backward # "Up"
bindkey '^[[B' history-beginning-search-forward # "Down"
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:
cds () {
local DIR="$PWD"
if [[ ! -z "$dirstack" ]]; then
DIR=$(print -rl $dirstack | tac \
| iselect -a -f -n chdir -Q "$PWD" -t "Change directory to..." -p ${#dirstack})
fi
cd "$DIR"
}
As you can see, it requires 'iselect' utility that is available as
a Debian package, for example. (I wish I could implement an
iselect replacement using only zsh/zle.) Also, in order to be
useful it requires you to setopt auto_pushd. I also setopt
pushd_ignore_dups and set DIRSTACKSIZE to a reasonably large value.
--
Hannu
Messages sorted by:
Reverse Date,
Date,
Thread,
Author