When tasks like navigating into a project, starting tests, local server and neovim become repetitive I usually end up making a tmux script which does everything for me.
Also, aliasing ‘..’ to ‘cd ..’ and such.
You can run dirs -v to get the list, and do cd +(num) to go there.
So:
FreeBSD <jubei/pts/2> (219 /var): dirs -v
0 /var
1 /usr/local
2 ~
FreeBSD <jubei/pts/2> (220 /var): cd +1
/usr/local
FreeBSD <jubei/pts/2> (221 /usr/local): _[0] http://linuxcommand.org/lc3_man_pages/cdh.html [1] http://www.caliban.org/bash/index.shtml#completion
kd foobar ~/Workspace/foobar # define bookmark
cd ~/some/where
kd foobar # goes to bookmark
kd foo # matches on string prefix, last entry wins
cd ~/Workspace/quuuuuux
kd qux "$PWD" # quick bookmark current dir
touch Gemfile # define project root
cd app/controllers/name/space/whatevs
kd # goes to project root
Turns out autojump doesn't work for me, too many projects in parallel. Since this one is manual, it can be very semantic. Those 30 lines saved me hours on end of tab mashing, especially in Go workspaces.[0]: https://github.com/lloeki/dotfiles/blob/master/shell/kd
I have been doing something similar for many years. Someone ported this to Bash... I'll try to get that port up on github.
EDIT: https://raw.githubusercontent.com/jakobi/script-archive/mast...
https://github.com/bag-man/dotfiles/blob/master/bashrc#L73
Lets you change directory with alt+c, although I have tweaked it so you always search from your root folder. Which isn't for everyone. Otherwise fzf alt+c doesn't let you go back up directories which gets frustrating.
export FZF_ALT_C_COMMAND="bfs -type d -nohidden"
(and install bfs of course)It won't let you go back up the tree, but if you are clever you can use `cd -` to jump back to your previous location.
bfs ~ -nohidden -type d -printf '~/%P\n'https://gist.github.com/chew-z/44f3bcdc08eaecdf306868f9a3d0e...
zsh will implicitly cd if you just mention a directory e.g. `$ ../foo/bar [RET]` will cd there without mention. These days I only use `cd -`.
zsh has about a thousand options you can configure.
You're right, it's been so long I completely forgot.
It's auto_cd, and auto_pushd will also automatically push new directories to the dstack.
> zsh has about a thousand options you can configure.
I should probably go through the options list in its entirety one day, but technically according to http://zsh.sourceforge.net/Doc/Release/Options.html it's closer to a quarter of that ;)
There's also `cd foo bar` in zsh, which substitutes foo with bar in the name of $PWD. I rarely used it, and when I do, it's usually for a well known pair of lengthy named dirs, yet it also shaves off a couple of keystrokes pretty much daily for me.