From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2215 invoked by alias); 28 Aug 2015 09:51:11 -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: 20475 Received: (qmail 7084 invoked from network); 28 Aug 2015 09:51:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f5-f794b6d000001495-d4-55e02cae5f91 Date: Fri, 28 Aug 2015 10:40:58 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: string to array space problem in filenames Message-id: <20150828104058.7b44a631@pwslap01u.europe.root.pri> In-reply-to: <55DFC1E6.5090400@eastlink.ca> References: <20150821215037.6b010cf7@ntlworld.com> <55DFC1E6.5090400@eastlink.ca> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrELMWRmVeSWpSXmKPExsVy+t/xK7rrdB6EGhx5wW2x4+RKRgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZcxfM4+pYLpoxZL+26wNjNMEuxg5OSQETCQaN7xjgrDFJC7c W8/WxcjFISSwlFGiYeVPZpCEkMA0JomdmyohEtsYJSbNn8oCkmARUJU4cekmG4jNJmAoMXXT bEYQW0RAVGL5is3sILawgLnE69ffwWxeAXuJJxM+gdmcAtoSm/ZNAtrMATQ0WOLTpwyQML+A vsTVv5+gDrKXmHnlDCNEq6DEj8n3wNYyC2hJbN7WxAphy0tsXvMW6k51iRt3d7NPYBSahaRl FpKWWUhaFjAyr2IUTS1NLihOSs810itOzC0uzUvXS87P3cQICdmvOxiXHrM6xCjAwajEw2ux 4X6oEGtiWXFl7iFGCQ5mJRHeEKEHoUK8KYmVValF+fFFpTmpxYcYpTlYlMR5Z+56HyIkkJ5Y kpqdmlqQWgSTZeLglGpgrLPUuaXS+C8s+EKghPJ/jWMmPIcFTqdGH5RMv2bWsHj9xJLq3QsS 5jGo31X65Hz5uths0+gP0+VqmJX+uTGefFVblH3+bG3SR40/k/vS3y49c/D8tcznJ2/VuUry v8oyrC4NTDji+KnzZ5fW8gqhRaosir4PCv17Uhq+O+Q95k0qzGiJCZqtxFKckWioxVxUnAgA ybM4+lUCAAA= On Thu, 27 Aug 2015 19:05:26 -0700 Ray Andrews wrote: > I should probably know this, but I'm rusty after a few months not > thinking about zsh. I have a personal implementation of a dirstack that > just pushes $PWD to the end of a file then rereads the file to an array > which is then sent to 'select' to let me change directory. I like it > because it survives reboot and works across xterms and removes > duplicates and so on. This doesn't answer the question you've actually asked, but if you haven't (and in case I haven't mentioned it before) you might want to take a look at the section "REMEMBERING RECENT DIRECTORIES" in the zshcontrib manual as the "cdr" mechanism does all this with a certain amount of configuration. It looks like I wasn't particularly upfront about the fact that it removes duplicates from the list, so there's a patch below. The configuration I use with this is zstyle ':chpwd:*' recent-dirs-max 20 zstyle ':chpwd:*' recent-dirs-default true zstyle ':completion:*' recent-dirs-insert fallback which prunes the list of directories to 20 (unique) entries and also defaults to "cd" behaviour if the argument to cdr isn't a nubmer --- very useful with completion which gets configured above to allow completion of real directories, not just entries in the list: you can simply hit "tab" to cycle through them, most recently used first, even if what's on the command line is the name itself, and then edit the directory you're presented with in case it's in the target area but not the one you want. This has changed my life (in a small way, admittedly...) pws diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 4e87d41..db0940d 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -339,9 +339,13 @@ previous working directory from a list maintained automatically. It is similar in concept to the directory stack controlled by the tt(pushd), tt(popd) and tt(dirs) builtins, but is more configurable, and as it stores all entries in files it is maintained across sessions and (by default) -between terminal emulators in the current session. (The tt(pushd) -directory stack is not actually modified or used by tt(cdr) unless you -configure it to do so as described in the configuration section below.) +between terminal emulators in the current session. Duplicates are +automatically removed, so that the list reflects the single most recent +use of each directory. + +Note that the tt(pushd) directory stack is not actually modified or used +by tt(cdr) unless you configure it to do so as described in the +configuration section below. subsect(Installation)