If you have root access to your machine, you can get even closer by
using this technique:
sudo useradd test -d /path/to/named/dir
Then, ‘~test’ will be a complete alias for ‘/path/to/named/dir’ and all
of the following will work:
cd ~test
ls -d ~test
echo ~test
Elias
PS: This may not actually be a good idea.
On 11/04/2014 01:57 AM, Stestagg wrote:
> The closest that I can think of is:
>
> 1. Create a directory somewhere: e.g. ~/.named_dirs
> 2. Put symlinks in that directory: e.g. ~/.named_dirs/my_dir >
> /backup/project....
> 3. set your CDPATH: set -x CDPATH '.' "$HOME/.named_dirs"
> (Remember to include "." in CDPATH, fish can be quite picky about this
> and can result in you not being able to change dir much :))
>
> Now, you can type 'cd my_dir' and you'll jump to /backup/project....
>
> Unfortunately the path in the prompt will be resolved to /backup/project...
> but the experience is close to what you described.
>
> ```
> stestagg@Steves-MacBook-Pro ~/t/att> pwd
> /Users/stestagg/tmp/att
> stestagg@Steves-MacBook-Pro ~/t/att> ls
> media
> stestagg@Steves-MacBook-Pro ~/t/att> cd my_dir
> stestagg@Steves-MacBook-Pro /v/spool> pwd
> /private/var/spool
> stestagg@Steves-MacBook-Pro /v/spool> ls -lah ~/dirs/
> ...
> lrwxr-xr-x 1 stestagg staff 11B 4 Nov 00:50 my_dir -> /var/spool/
> ...
> stestagg@Steves-MacBook-Pro /v/spool> echo $CDPATH
> . /Users/stestagg/dirs/
> ```
>
> On Mon, Nov 3, 2014 at 9:13 AM, Cedric Auger <[email protected]
> <mailto:[email protected]>> wrote:
>
> Why not create symlinks?
>
> 2014-11-01 8:40 GMT+01:00 Santhosh T <[email protected]
> <mailto:[email protected]>>:
>
> Hi Greg,
>
> the approach you suggested works, but not user friendly
> autocompleting variables appends SPACE rather than "/"
> i mean:
>
> cd $my_d<TAB>
>
> now it autocompletes as:
>
> cd $my_dir<SPACE>
>
> instead of
>
> cd $my_dir/
>
> thanks
> santhosh
>
>
>
> On Sat, Nov 1, 2014 at 6:35 AM, Greg Reagle
> <[email protected] <mailto:[email protected]>> wrote:
>
>
> On Fri, Oct 31, 2014, at 07:25 PM, Santhosh T wrote:
> > zsh supports named directories as explained in
> >
> > http://blog.bytetouch.com/tag/named-directories/
> >
> > does fishshell has something equivalent?
>
> I am just a fish novice, but here are my two cents.
>
> I don't know if fish has that feature, but it could be done with
> variables:
> . set -U my_dir /usr/local/share
> cd $my_dir/man/
>
> --
> http://www.fastmail.fm - Send your email first class
>
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Fish-users mailing list
> [email protected]
> <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
>
>
>
> --
> .../Sedrikov\...
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Fish-users mailing list
> [email protected]
> <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> Fish-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
------------------------------------------------------------------------------
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users