DEV Community

Cover image for goto - navigate to aliased directories
Lazarus Lazaridis
Lazarus Lazaridis

Posted on • Updated on

goto - navigate to aliased directories

I created a bash utility named goto that allows users to navigate to aliased directories.

goto

It comes with a nice auto-completion script so that whenever you press the tab key after the goto command, bash prompts with suggestions of the available aliases:

$ goto <tab>
bc /etc/bash_completion.d                     
dev /home/iridakos/development
rubies /home/iridakos/.rvm/rubies
Enter fullscreen mode Exit fullscreen mode

Example

The following command will register an alias for a long path:

goto --register workdir /mnt/development/projects/go/workspace
Enter fullscreen mode Exit fullscreen mode

Afterwards, user can navigate to that folder with just:

goto workdir
Enter fullscreen mode Exit fullscreen mode

You can find the code and the installation and usage guides on GitHub.

Update 2018-03-25

The tool can be used also in zsh and there is a brew formula available for macOS users (brew install goto)

Top comments (3)

Collapse
 
ycmjason profile image
YCM Jason

Seems interesting.

Just wondering why not just setting an environment variable with .basrc?

Collapse
 
iridakos profile image
Lazarus Lazaridis

The purpose of the tool is to allow users register aliases for their desired directories (like project directories, workspaces etc) and then with the help of bash completion navigate to them very easily using their aliases. Environment variables wouldn't make this process that easy.

Collapse
 
ycmjason profile image
YCM Jason

This make sense! Quite cool quite cool.