3 ms·
I like this workflow better: 1. Go to the directory in question 2. Type "save nm" where "nm" is any short name for the directory, like "blog" or "blg" 3. Fro
by alanh 16y ago
I like this workflow better:
1. Go to the directory in question
2. Type "save nm" where "nm" is any short name for the directory, like "blog" or "blg"
3. From now on, type "cd nm" whenever you want to go there.
No session restart required, even.
I copied the code that enables this workflow from http://dotfiles.org/~jacqui/.bashrc http://dotfiles.org/~jacqui/.bashrc
(or was it https://gist.github.com/117528 https://gist.github.com/117528)
The idea is discussed here: http://hints.macworld.com/article.php?story=20020716005123797 http://hints.macworld.com/article.php?story=2002071600512379...
- sjs 16y agoOr in zsh: setopt cdablevars nm=/path/to/whatever cd nm
- unfletch 16y agoin Bash, change the first line to: shopt -s cdable_vars
- iuguy 16y agoin Bash you don't even need to do that, just do: foo=/etc/ cd $foo
- irfn 16y agoyou can put this in ~/.zshrc for persistent zsh bookmarks touch ~/.zshmarks && source ~/.zshmarks function b() { echo "hash -d $1=\"`pwd`\"" >> ~/.zshmarks && source ~/.zshmarks }
- anon_d 16y agoWhy not just: echo "export nm=`pwd`/blog"' >> ~/.profile . ~/.profile cd $nm There's no need for magic when you know how to shell.
- fabjan 16y agoWhy not just shopt -s cdable_vars nm=`pwd`/blog cd nm No need for hacks when you know how to shell.
- anon_d 16y agoAnnoying special cases: $ cd / $ nm=/foo $ ls | grep nm $ cd nm $ pwd /foo $ cd ~ $ ls | grep nm nm $ cd nm $ pwd ~/nm $ echo FFFFFUUUUUUUUU Inflexible: $ cd nm/jan/img cd: No such director nm/jan/img $ echo SHIT SHIT $ cd $nm/jan/img Worse, It's nonstandard and only saves you one chracter.
- hyperbovine 16y agoDollars to donuts the author is a Vimmer. I am and the workflow makes complete sense to me :-)
- deleted 16y ago[deleted]