Repository navigation
Home
Welcome to Working Directory! This page is a quick introduction to the project.
Imagine this scenario:
You are building software, and your project (named FooFoo) uses tools or libraries with strong conventions about where stuff goes. In this scenario, let’s imagine you’re using Java. This often means the useful bits of code are buried somewhere, like this:
/Users/capt.picard/work/FooFoo/src/main/java/org/fooSo you start out a new shell in your home directory and navigate all the way down there:
/Users/capt.picard$ cd work
/Users/capt.picard/work$ cd FooFoo
/Users/capt.picard/work/FooFoo$ cd src/main/java/org/foo
/Users/capt.picard/work/FooFoo/src/main/java/org/foo$Whew! Maybe not a big deal once, but I hope you don’t have to do this every day! Fortunately you have command-line completion, cutting down on all that typing:
/Users/capt.picard$ cd wo[TAB]/Foo[TAB]/s[TAB]/m[TAB]/j[TAB][TAB][TAB]
/Users/capt.picard/work/FooFoo/src/main/java/org/foo$Wait, what? That’s still a lot of typing! This is much quicker for users of Working Directory:
/Users/capt.picard$ wd
/Users/capt.picard/work/FooFoo/src/main/java/org/foo$That’s it! Let’s see how that magic works.
Whenever you start a new project or workspace, just tell Working Directory (or just “wd”) that you want to make a new scheme:
/Users/capt.picard$ wdscheme foofooThis creates a set of 10 slots associated with that scheme and copies in the contents of your previous scheme. (If you don’t need a clone of the previous scheme, you can clear those out with wdc.) Now you simply navigate to your project root, or wherever you most commonly need to start when you work on that project, using regular cd and all the tab-completions you can tolerate. Once there, you can store that directory in the default slot like this:
/Users/capt.picard/work/FooFoo/src/main/java/org/foo$ wdsIf you then look at the list of slot assignments with wdl, you’ll see that you’ve stored the current directory in the 0th slot:
/Users/capt.picard$ wdl
0 /Users/capt.picard/work/FooFoo/src/main/java/org/foo
1
2
3
4
5
6
7
8
9The first slot is special—you can access it without specifying a number at all. Just type wd to navigate to that slot and wds to set it to the current directory. The remaining slots require their number to retrieve or store. If you want to store the directory that holds your project tests in slot 3:
/Users/capt.picard$ cd work/FooFoo/src/test/java
/Users/capt.picard/work/FooFoo/src/test/java$ wds3
/Users/capt.picard/work/FooFoo/src/test/java$ wdl
0 /Users/capt.picard/work/FooFoo/src/main/java/org/foo
1
2
3 /Users/capt.picard/work/FooFoo/src/test/java
4
5
6
7
8
9Now you can quickly navigate between source and test on the command-line:
/Users/capt.picard$ wd
/Users/capt.picard/work/FooFoo/src/main/java/org/foo$ wd3
/Users/capt.picard/work/FooFoo/src/test/java$ wd
/Users/capt.picard/work/FooFoo/src/main/java/org/foo$You can have as many schemes as you want, but each scheme only stores 10 directories. This allows for maximum accessibility on the command-line with single-word aliases for going to or storing into each slot.
Working Directory has many other features that you may start to use over time:
- It automatically stores the current scheme into similarly-named environment variables for quick use on the command-line for any purpose, like
cp. - Storing directories in slots doesn’t require that you be in the directory. Just give a directory as a parameter to
wds[0-9]and it will store it instead of the current directory. - wd is cross-platform, written in Bash and Zsh. I’ve personally used it heavily for over a decade on macOS, Linux, and Windows (cygwin, msys, WSL).
- wd provides a completion function for its schemes, so
wdscheme [TAB][TAB]will list all of your existing schemes. - Since wd stores schemes and slots on disk, all of your terminals will share the same scheme, so there’s no need to set the scheme every session. Storing a directory from one terminal makes it available in any other terminal.
- You can also temporarily override the working scheme in a particular shell using the
-toption, e.g.wdscheme -t tempscheme
Working Directory has been available for some years and gets constant daily use by its small community. Most people who’ve started using it never stop! Lately you can fetch the source from github or download the latest stable release directly.