From c6e096e35d43fd3ecaaadad5ff92fee2d37a0922 Mon Sep 17 00:00:00 2001 From: Yakkala Yagnesh Raghava Date: Sat, 6 Aug 2011 00:14:15 +0900 Subject: [PATCH] Add BOOKMARKing functionality to dirs plugin --- plugins/available/dirs.plugins.bash | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) mode change 100644 => 100755 plugins/available/dirs.plugins.bash diff --git a/plugins/available/dirs.plugins.bash b/plugins/available/dirs.plugins.bash old mode 100644 new mode 100755 index dfa9a32..a9f5974 --- a/plugins/available/dirs.plugins.bash +++ b/plugins/available/dirs.plugins.bash @@ -50,3 +50,35 @@ function dirs-help() { echo "8 : Chance to stack location 8." echo "9 : Chance to stack location 9." } + + +# ADD BOOKMARKing functionality +# usage: + +if [ ! -f ~/.dirs ]; then # if doesn't exist, create it + touch ~/.dirs +else + source ~/.dirs +fi + +alias L='cat ~/.dirs' + +G () { # goes to distination dir otherwise , stay in the dir + cd ${1:-$(pwd)} ; +} + +S () { # SAVE a BOOKMARK + /bin/sed "/$@/d" ~/.dirs > ~/.dirs1; + \mv ~/.dirs1 ~/.dirs; + echo "$@"=\"`pwd`\" >> ~/.dirs; + source ~/.dirs ; +} + +R () { # remove a BOOKMARK + /bin/sed "/$@/d" ~/.dirs > ~/.dirs1; + \mv ~/.dirs1 ~/.dirs; +} + +alias U='source ~/.dirs' # Update BOOKMARK stack +# set the bash option so that no '$' is required when using the above facility +shopt -s cdable_vars -- 2.17.1