From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10135 invoked from network); 14 Jun 2000 18:24:16 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Jun 2000 18:24:16 -0000 Received: (qmail 405 invoked by alias); 14 Jun 2000 18:24:01 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3163 Received: (qmail 398 invoked from network); 14 Jun 2000 18:24:01 -0000 X-Authentication-Warning: DarkSun.local: luthien set sender to dominik.vogt@gmx.de using -f Date: Tue, 13 Jun 2000 17:54:17 +0200 From: Dominik Vogt To: zsh-users@sunsite.auc.dk Subject: '...' in path names? Message-ID: <20000613175417.A18345@gmx.de> Reply-To: dominik.vogt@gmx.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i I really like to abbreviate something like '../../..' with '....' (you get the idea). (The last time I tried to get it working was zsh-3.0.5). I didn't get any farther than this: alias '...'='cd ../..' alias '....'='cd ../../..' alias '.....'='cd ../../../..' ... which works for '...' in the command position, but not in 'cd ...'. Or altenratively I can get it working in positional parameters: alias -g '...'='../..' alias -g '....'='../../..' alias -g '.....'='../../../..' ... Then I can use 'cd ...'. Any ideas how to improve this situation? It would be cool if it were possible to expand strings of dots in every path without having to . I guess most of the stuff in the list below is not possible yet, so you can consider individual item to be enhancement requests. 1) '.....................' becomes 'cd ../../../'. It should be possible to configure this without dozens of alias lines 2) 'cd .....' becomes 'cd ../../../..' (also without many aliases) Already possible if you don't mind the many aliases you need. You can't have (1) and (2) at the same time 3) '.../bin/zsh' becomes '../../bin/zsh' could be implemented as an enhancement to global aliases 4) '/usr/local/bin/.../bin' becomes '/usr/local/bin/../../bin' could be implemented as an enhancement to global aliases too Furthermore it would be nice if you didn't have to type a slash before and after the dots in a path (on a german keyboard you have to press shift-7 to get a slash which is a bit unwiedly). 5) '..bin' becomed '../bin' and 'bin..man' becomes 'bin/../man' of course you'd need some form of escaping for file names that contain '..'. All of this could be done with new options of the alias command and some changes in alias expansion I think: -p: ('p' stands for 'parameter alias'; e.g. 'alias -p foo=bar') Defines an alias that is only expanded in positional parameters, but not if it occurs in command position. -R: ('R' stands for 'REGEXP'; e.g. alias '(.*)\.\.\.(.*)'='\1../..\2') Allow (extended) regular expression syntax in alias definitions With these two, all of the above could be implemented: # recursively translates ... to ../.. anywhere in a string alias -g -R '(.*)\.\.\.(.*)'='\1../..\2' # these two add a / before and after the .. if necessary alias -g -R '(.*[^/.])..'='\1/..' alias -g -R '..(.*[^/.])'='../\1' # and finally prepend 'cd' alias -R '\.\.(.*)'='cd ..\1' Please reply to me directly, I'm not subscribed to the list. Bye Dominik ^_^ -- Dominik Vogt, dominik.vogt@gmx.de Reply-To: dominik.vogt@gmx.de