From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7267 invoked by alias); 14 Mar 2017 17:38:34 -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: 22565 Received: (qmail 29928 invoked from network); 14 Mar 2017 17:38:34 -0000 X-Qmail-Scanner-Diagnostics: from mail-lf0-f42.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.215.42):SA:0(0.5/5.0):. Processed in 1.26888 secs); 14 Mar 2017 17:38:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE, HTML_NONELEMENT_30_40,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM,SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: jesper.nygards@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.215.42 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=3o4ehzQ7z4Tv3ORmGYvKmL6vbxRLI2QmqqfVb1V+ru4=; b=rIDUCVIWRpRvve8zXzTlMfBHGcFyiaWwpHjyJNCjIrZj0XlhtpuDchHp5Va9t7C6Bb N3HhJjUp/gHo76sR/rjhP5onCu1ZRbI3z8EE/+OuVnffBcqzJ9EWGpF6caAhozzC0cDp ORFzUM5DTUYQfjGxiHMgV2v0uC66IVXPTEm2quChulEc1P2SJ0mNfw/uvHVCmJcfA+37 UUStdGgMxMra3pee/bWgWaHGLy2p1MxukdDb96YmyU4ih7iX3G53K7TorYlW0oLSQVV0 4Xpqah+wyzqecTzTtXMToeSysqNSd5MNDS008gn42RwRb9XLl26pb2Iap/wDKGFrzDvu L6Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=3o4ehzQ7z4Tv3ORmGYvKmL6vbxRLI2QmqqfVb1V+ru4=; b=bFebmT5ZqONipvTHwLS7si55nQmk0dEOSYncdOx1vg9xvvtmhGc0bXLXWmW79/kPX0 ACOWzmt4sKN2KStmpHNdRETMaGMobuoN3f5CQz6l3LKJAIm80H35Z0bBGEjjlpF+c8o6 N+HRYmv8qysix4fWFvnTnzycq2Aikps8VZQm5xAMuZeQIAKm2hE2qQc9iCE2JoFLrkev zzuP8qb1LaIgegPGXl+o9u3l+89KVr39j4NlzzEIZdv4Ieqgfj3I3l3ydi0fiMfjCb0b +a0ymx8f9V+6dpHQiEeHu9g/9jed6H/3YNCFGY5HFglwW3g4kU2AlfW+rLoCGXpRrGbx GGmg== X-Gm-Message-State: AMke39mSNjOjPHSi7+Mj6QVjeXj9CrgtZoG6Rxks5Ofh5Td7rjL0SDw66VswmMDQKzB3p0o8iT0AaCLb4M3FYw== X-Received: by 10.25.141.12 with SMTP id p12mr11097369lfd.147.1489513104396; Tue, 14 Mar 2017 10:38:24 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= Date: Tue, 14 Mar 2017 18:38:23 +0100 Message-ID: Subject: Completion for cd To: Zsh Users Content-Type: multipart/alternative; boundary=001a11401c1479dd1d054ab44b5e --001a11401c1479dd1d054ab44b5e Content-Type: text/plain; charset=UTF-8 I am using zsh 5.3.1. For a long time I've had the following completion configuration: zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' '+l:|=*' zstyle ':completion::*:::' completer _expand _complete _prefix _approximate _ignored cdpath=(. /opt) The idea is of course that if something I write is the start of a completion, I want it to be completed. If such match is _not_ found, I want completion to the left (prefix completion?) to be attempted. It works well. If I stand in a directory 'statistics' containing the directories 'stats-lib' and 'stats-web', I can write 'cd web' and have it completed to 'stats-web'. That is what I want. However, I have a slight problem with it. In my '/opt' directory, I have a directory called 'webcert'. If I stand in the 'statistics' directory, writing 'cd web' gives me 'webcert', since '/opt' is in the cdpath array. This is as expected since I have configured matcher-list to prefer what is a prefix to what is a suffix, so 'webcert' (in the cdpath) is found, and therefore 'stats-web' (in the current directory) is never offered. I would like to keep the matcher-list configuration, but for the cmpletion to prefer matches in the current directory over matches in cdpath. I therefore added the following configuration: zstyle ':completion:*:*:cd:*:*' completer _expand _complete _complete:withpath _prefix _approximate _ignored zstyle ':completion:*:complete:cd:*:*' tag-order local-directories - zstyle ':completion:*:withpath:cd:*:*' tag-order path-directories This works as intended: now 'stats-web' in the current directory is preferred over 'webcert' in cdpath, so typing 'cd web' completes to 'stats-web'. If I want to go to 'webcert', I can type 'cd webc' and it will complete to 'webcert'. However, now I find a surprising side-effect of this change. I have also this configuration: zstyle ':completion:*:*:cd:*:*' ignore-parents parent pwd But this is broken by my change! If I go to directory 'zsh' in '/usr/local/Cellar', and then type 'cd ../z', I am offered 'zsh' together with 'zsh-completion', whereas before the change, I would only be offered 'zsh-completion', since I have configured cd to ignore the current directory. I can't figure out why my configuration change has caused the 'ignore-parents' style to stop working. --001a11401c1479dd1d054ab44b5e--