The way i work now is that i have a bunch of terminal tabs open. Each tab has a shell which pretty much just sits in a single directory. If i need to switch to a different directory, i switch tabs. A nice effect of this is that each tab builds up a recent shell history specific to the directory it sits in; the shell in the source directory has a history full of build commands, the shell in the installation directory has a history full of start and stop commands, and so on.
This works because i generally use a fairly small (<10) set of different directories, and i don't move between directories much as part of a single task. Partly, this is because i use qualified paths rather than cd'ing around everywhere. I am happy writing (mostly, tab-completing):
vi lib/awesomeapp/dns/client.rb
Whereas a colleague of mine would always do: cd lib
cd awesomeapp
cd dns
vi client.rb
He might get a lot of mileage out of pushd/popd. But for me, it just optimises something i don't spend a lot of time doing.Easy enough to change in system preferences, though. And with using Vim NERDtree, or some other directory plugin, it makes sitting at the top level directory of your project, with multiple projects in multiple tabs, pretty easy.
Are you on Mac? If so, have you done anything to make tab-switching easier/faster? I'm interested because I only recently set mine up this way, and am always open to more efficient methods.
For example, the project I'm working on is always tab 1, pianobar (terminal pandora client) is always tab 4.
This is really nice because it's also how I switch tabs in Chrome. So both Chrome and iTerm have my current work on tab 1.
Although, now ripter has taught me that ⌘1 etc select tabs (i also use iTerm), i hope i'll switch to using that.
$ pwd
/tmp
$ mkdir -p a/b/c
$ ( cd a/b/c ; pwd )
/tmp/a/b/c
$ pwd
/tmpIf you haven't tried it, I highly recommend z. It's impossible to Google for, but it's oh-so-convenient.
Also, by "cd -" I meant cd -[tab], cd -1, cd -2, etc.
cd ~-
setopt autopushd
to have cd work like pushd.And
setopt pushdignoredups
is probably helpful too as it will not push the same directory multiple times on the stack.pushd .
cd some_dir
Some examples here:
http://en.wikipedia.org/wiki/Pushd_and_popd
Edit: change to desktop Wikipedia URL.