Skip to content

Instantly share code, notes, and snippets.

Last active March 31, 2023 05:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Shell bookmarks in bash
if [ -d "$HOME/.bookmarks" ]; then
export CDPATH=".:$HOME/.bookmarks:/"
alias {g,go,goto}="cd -P"
local IFS=$'\n'
COMPREPLY=( $( compgen -W "$(/bin/ls ~/.bookmarks)" -- ${COMP_WORDS[COMP_CWORD]}))
} && complete -F _goto goto go g

Simple BASH bookmarks

# pg-up/down autocompletion
bind '"\e[6~": menu-complete'
bind '"\e[5~": menu-complete-backward'

Create ~/.bookmarks and symlink folders inside it. I name mine starting with @ e.g. ln -s /usr/local/src @src

Then you can g and go to the folder.

Inspired from:

Another similar idea here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment