*! version August 26, 2018 @ 19:41:45

Title

go -- Change to directories via nicknames

Syntax

go
[to]
nickname
[,
nopush
]

go
add
nickname
[using directory]
[,
nowrite
noexist
]

go
[ list]

go
drop
nickname
[,
nowrite
]

go
rename
old_nickname new_nickname
[,
nowrite
]

go
copy
old_nickname new_nickname
[,
nowrite
]

go
replace
nickname
[using directory]
[,
nowrite
noexist
]

go
write

General
nowrite Suppress writing of the do-file needed to recreate the nickname lookups after quitting Stata.

noexist Suppress checking that a directory exists before adding it to the lookup list. Useful if the directory is on a network drive or disk image which may or may not be mounted/available.

nopush Do not push the current directory onto the directory stack. See pushd.

Description

go is a utility for giving directorys/folders nicknames, so that jumping to them is simpler. This is particularly useful if you have projects in different locations and possibly deeply buried.

Using the various subcommands, you can add, drop, copy, and rename nicknames as well as replace the directory to which a nickname points.

By default, all changes that you make to your list of nicknames is written to a do-file right away, so that you will not curse if you set up nicknames and then quit Stata.
If you would like to postpone writing the nickname file, you can use the nowrite option for all commands which alter the list of nicknames.

Options

nowrite suppresses writing out the file used for storing nicknames and their definitions. This is mostly meant for debugging, and for the definition file itself.

noexist suppresses the check that a directory/folder exists.
This is mostly useful when defining nicknames for directories/folders which are on network or virtual drives which may or may not always be mounted.

nopush suppresses pushing the current working directory onto the directory stack and uses cd instead.
This is only useful if you have pushd installed.
If you do not have pushd installed, do not worry, go will use a simple cd instead.

Remarks

Those who live in a fractured world may end up with their various projects in widely-scattered directories/folders.
Even with Stata's tab-completion of file names, typing endless cd commands can become both annoying and a waste of time.
The go command allows you to define short nicknames for commonly used directories/folders so that you can jump to different locations easily.

If a directory is not specified for go add or go replace, the current working directory gets used.

The nicknames act as actual directory names, so you can drop into a subfolder of a nicknamed folder via

go
nickname/subfolder

These nicknames get written to a do-file in your PERSONAL directory named golookup_your_os.do which can then be read back in the next time you start Stata.
(Click here to see in the Results window what Stata uses for your_os.)
This do-file may be edited by hand, if you like.

Embedded double-quotes are not allowed in the nicknames.
This is intentional, as the nicknames should be nice short names.

Example(s)

. go add start

adds the nickname start which points to whatever the current directory is---a useful way to have a starting directory

. go add projects ~/Documents/Projects

adds the nickname projects which points to ~/Documents/Projects

. go projects

changes the working directory to ~/Documents/Projects

. popd

goes back to whereever you were.

. go projects/FunCity

changes the working directory to ~/Documents/Projects/FunCity

. go

lists all available nicknames along with clickable links to actually go to the directories (the idea for the clickable links was copied from Scott Long's workingdir package)

. go list

does the same as go list

Author

Bill Rising, StataCorp

email: brising@stata.com

web: http://louabill.org