dhop tricks and tips - Abstrys/dhop GitHub Wiki

Some interesting things to try with dhop...

Use dhop locations with other command line programs

You can use dhop path to print a location that you've set with dhop. You can even send it as input to another command. For example:

mv somefile.rst `dhop path sphinx-proj`

which sends the file somefile.rst to wherever I've set sphinx-proj to point at.

Save your (temporary) place

dhop provides the push and pop commands to quickly change to a different directory while still remembering your current location, and also provides mark and recall to use with a single location (independent of the push/pop stack). However, you can also set temporary, reusable locations in addition to longer-term names simply by using set and forget.

You can use this in conjunction with the tip to use dhop path as input to set temporary directories in which you'd like to place files, or frequently-moving locations with names such as 'todo', 'cur-work', or such.

For example, if I am working on a file buried deep within the source tree of a large project, I can remember its location by typing:

dhop set cur-work

Then, get back to that location:

dhop cur-work

or copy files to it, or to a sub-directory:

cp -r source_files `dhop path cur-work`/source

Once I'm finished working with it, I can just forget it:

dhop forget cur-work

or I might simply overwrite the location using set to give it new value as the directory in which I'm working changes.