Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Wishlist for zsh: 3 tcsh features
- X-seq: zsh-users 4353
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Wishlist for zsh: 3 tcsh features
- Date: Mon, 8 Oct 2001 17:39:15 +0000
- In-reply-to: <20011008161313.EC4ACD804@xxxxxxxxxxxxxxxxx>
- In-reply-to: <OF594BCCA9.4364E8B5-ON80256ADF.0059B87C@xxxxxxxxxxxxxxx>
- In-reply-to: <3BC1DDEE.FA306604@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20011008161313.EC4ACD804@xxxxxxxxxxxxxxxxx> <OF594BCCA9.4364E8B5-ON80256ADF.0059B87C@xxxxxxxxxxxxxxx> <3BC1DDEE.FA306604@xxxxxxxxxxx>
On Oct 8, 5:25pm, martin.ebourne@xxxxxxxxxxxx wrote:
}
} 1) <Meta-Del>: In tcsh, when deleting elements in a path,
} <Meta-Del> generally deletes everything up to the next
} "/" character, e.g.
}
} In ZSH this is controlled with the WORDCHARS env var. Mine is set to:
} WORDCHARS='*?_-.[]~#'
You can also try using vi-backward-kill-word instead of backward-kill-word.
} 2) <Meta-p>, part 1 : In tcsh, <Meta-p>, when looking up history
} elements that begin with the already-typed string, will return
} a unique list of elements that match the string, e.g.:
}
} One solution to this is prevent history lines from getting duplicated in
} the first place. Something like:
} setopt hist_find_no_dups
Just that one, should give what James wants. If it doesn't, we need to
fix it.
} 3) <Meta-p>, part 2 : In tcsh, <Meta-p> will return the command that
} matches exactly what's been typed already:
}
} The ZLE widgets 'history-beginning-search-backward' and '
} history-beginning-search-forward' are probably what you are after.
On Oct 8, 6:10pm, Oliver Kiddle wrote:
}
} Those two widgets annoyingly don't allow you to navigate up and down in
} multiple line commands so you may prefer to try `up-line-or-search' and
} `down-line-or-search' which are similar. They also have their faults
} though because they only use the first word on the current line in their
} search. Ideally, these will be replaced with more primitive widgets
} (e.g. just up-line) so that I can write one which works exactly as I
} like in a shell function.
I don't think it's possible to get more primitive than up-line-or-history,
which goes up one line in a multi-line buffer or up one history entry at
the beginning of the buffer. Unless you're looking for a primitive that
won't move out of the multi-line buffer when it reaches the top?
Meanwhile, something like this should work:
function up-line-or-beginning-search {
if [[ $LASTWIDGET != $WIDGET ]]
then
if [[ $BUFFER == *$'\n'* ]]
then
__last_up_line=up-line-or-history
else
__last_up_line=history-beginning-search-backward
fi
fi
zle .${__last_up_line:-beep}
}
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author