From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16635 invoked by alias); 22 Oct 2010 14:29:41 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15474 Received: (qmail 17575 invoked from network); 22 Oct 2010 14:29:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at yahoo.co.uk does not designate permitted sender hosts) X-Yahoo-Newman-Id: 154187.40305.bm@omp1026.mail.ukl.yahoo.com DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=pBOBLzTPayPMxU5Gj8MFlp4H/orBFfLfwwdLVEluFPTAQ+sXITEQ64kN0jee74lMIBj2L57pxJgyLbqiWc319adCP86i5YddqoMapyfE5bjf0TFIbDioYdxMiadORAPaibvwFLXiIcKaH2XAHuMuFsTF4/gUl/nc/M61PFs8FHc= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1287757462; bh=6RDM8dntG8Mc8wX8C6gc2hHCqY7DZjkPf5rhN4cW3LI=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Received:In-reply-to:From:References:To:Subject:Date:Message-ID; b=Cm7QnU0956udJiYFuX10NlaEAUl4jKxSuLtX6KRJLXq/Pj2Oyu0B5TdjwqQoLcRuVmUSxKiaOT35R/cwx+n5ZgtVkHPl7Stx17rc76etjZdOBYWx9nHGyYLEIaKy0Fey3HZB1nzWeMHKeCnylYIU/7xwB1uIEP/g/trH1PEJXO4= X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- X-YMail-OSG: UScoOncVM1lQx5WceqtTrLCP5Rc4H7GZNoB2kN_WctWqhdS 1ryGcOgxMNW1_zXF9tq62VlbbBUdZrf0oTjZG.vAbfIpDN_GV7wSMwWHot4m dl81.R_pkT6XGYcH1Gc273zUsKRJ6SBG3pmctv3ZLyuHSFKFBZYwFcCj1TO_ SB68gMEiaWFqGlxvLD0SUjSwLZDy8kAl_EySYdTUa5aBI_Fp9qvcPYdHBOgZ oU.S_Noz6ckCkSgf1USuk.YAoZn8- X-Yahoo-Newman-Property: ymail-3 In-reply-to: <101021210513.ZM30802@torch.brasslantern.com> From: Oliver Kiddle References: <101021210513.ZM30802@torch.brasslantern.com> To: Zsh Users Subject: Re: Neat hash -d trick Date: Fri, 22 Oct 2010 16:24:21 +0200 Message-ID: <2303.1287757461@thecus> Bart wrote: > A similar trick: [snip] > Now you can type ESC 4 . to insert ../../../.. (or ESC 9 ESC 9 . to > insert 99 levels, if for some insane reason you need that many). If you find counting the directories harder than doing it interactively on the screen we could try using menu selection. This splits either the path currently on the command-line or $PWD if that's empty into directory components and then does menu selection with them in a packed list. zle -C up-dir reverse-menu-complete _generic zstyle ':completion:up-dir::::' completer _up-dir bindkey '^X\e[A' up-dir And _up-dir contains: #compdef -k reverse-menu-complete ^X\e[A local -a dirs local -a dest compset -P '*[=:]' compset -S ':*' if [[ $compstate[context] = tilde ]]; then PREFIX="~$PREFIX" IPREFIX=${IPREFIX%\~} fi dirs=( ${(s./.)${~PREFIX:-$PWD}} ) for f in $dirs; do dest+=${dest[-1]}/$f done PREFIX= compstate[list]=packed compadd -V dirs -d dirs -f -qS/ -a dest I'm not sure if that's depending on further styles I have but you should be able to get the idea. I can't remember how to make menu selection really do reverse-menu-complete and give me the last completion to begin with. It clears off anything up to and equals or colon in the current word and includes a hack for the tilde context. I was also trying to remember if there was a way to separate the completion matches with a slash instead of spaces but I don't think there is. Oliver