Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to prevent overlap with git plugins in zsh. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ install:
@echo 'USAGE:'
@echo '------'
@echo 's <bookmark_name> - Saves the current directory as "bookmark_name"'
@echo 'g <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"'
@echo 'go <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"'
@echo 'd <bookmark_name> - Deletes the bookmark'
@echo 'l - Lists all available bookmarks'
@echo 'g <tab> - Tab completion is available for all commands'
@echo 'g --help - Complete usage'
@echo 'go <tab> - Tab completion is available for all commands'
@echo 'go --help - Complete usage'
12 changes: 6 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Usage
-----

s <bookmark_name> - Saves the current directory as "bookmark_name"
g <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"
go <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"
d <bookmark_name> - Deletes the bookmark
l <bookmark_name> - Lists the specified bookmark associated with "bookmark_name"
l - Lists all available bookmarks
Expand All @@ -29,8 +29,8 @@ Addition Features
pd <bookmark_name> - `pushd` to the directory associated with "bookmark_name"
_p <bookmark_name> - Prints the directory associated with "bookmark_name"
s - Saves the default directory
g - Goes to the default directory
g - - Goes to the previous directory
go - Goes to the default directory
go - - Goes to the previous directory

# Mac OS X Only
o <bookmark_name> - Open the directory associated with "bookmark_name" in Finder
Expand All @@ -47,8 +47,8 @@ Example
$ l
webfolder /var/www/
localbin /usr/local/bin/
$ g web<tab>
$ g webfolder # cd to /var/www/
$ go web<tab>
$ go webfolder # cd to /var/www/
$ o webfolder # Open in Finder if on a mac


Expand All @@ -65,7 +65,7 @@ Environment variables

Set `SHELLMARKS_ITERM_SESSION` to a session name to change the session that is launched when using `y` in iTerm2 on `osx`

If `SHELLMARK_PWD` is set, `pwd` is executed after `g` and `pd`
If `SHELLMARK_PWD` is set, `pwd` is executed after `go` and `pd`

Based Off
---------
Expand Down
31 changes: 15 additions & 16 deletions shellmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

# USAGE:
# s <bookmark_name> - Saves the current directory as "bookmark_name"
# g <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"
# go <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"
# d <bookmark_name> - Deletes the bookmark

# l - Lists all available bookmarks
# l <prefix> - Lists the specified bookmarks starting with prefix"
# pd <bookmark_name> - pd is the same as `g` but uses pushd
# pd <bookmark_name> - pd is the same as `go` but uses pushd
# s - Saves the default directory
# g - Goes to the default directory
# g - - Goes to the previous directory
# go - Goes to the default directory
# go - - Goes to the previous directory
# _p <bookmark_name> - Prints the directory associated with "bookmark_name"

# Mac only (disabled on other systems)
Expand Down Expand Up @@ -55,7 +55,7 @@ function s {
}

# jump to bookmark
function g {
function go {
check_help $1
source $SDIRS
if [ -z $1 ]; then
Expand Down Expand Up @@ -187,7 +187,7 @@ function check_help {
if [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ] ; then
echo ''
echo 's <bookmark_name> - Saves the current directory as "bookmark_name"'
echo 'g <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"'
echo 'go <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"'
echo 'd <bookmark_name> - Deletes the bookmark'
echo ''
if [ "`uname`" = "Darwin" ]; then
Expand All @@ -196,14 +196,14 @@ function check_help {
echo ''
fi
echo 's - Saves the default directory'
echo 'g - Goes to the default directory'
echo 'go - Goes to the default directory'
echo 'l - Lists all available bookmarks'
echo 'l <prefix> - Lists the bookmark starting with "prefix"'
echo '_p <bookmark_name> - Prints the directory associated with "bookmark_name"'
echo 'pd <bookmark_name> - Same as "g" but uses pushd '
echo 'pd <bookmark_name> - Same as "go" but uses pushd '
if [ $SHELLMARKS_k ]; then
echo ''
echo "k <bookmark_name> - Tries use 'g', if the bookmark does not exist try autojump's j"
echo "k <bookmark_name> - Tries use 'go', if the bookmark does not exist try autojump's j"
fi
kill -SIGINT $$
fi
Expand Down Expand Up @@ -245,7 +245,7 @@ function _l {
# validate bookmark name
function _bookmark_name_valid {
exit_message=""
if [ "$1" != "$(echo $1 | sed 's/[^A-Za-z0-9_]//g')" ]; then
if [ "$1" != "$(echo $1 | sed 's/[^A-Za-z0-9_]//go')" ]; then
exit_message="bookmark name is not valid"
echo $exit_message
fi
Expand Down Expand Up @@ -282,18 +282,18 @@ function _purge_line {
fi
}

# bind completion command for o g,p,d,pd to _comp
# bind completion command for o go,p,d,pd to _comp
if [ $ZSH_VERSION ]; then
compctl -K _compzsh o
compctl -K _compzsh g
compctl -K _compzsh go
compctl -K _compzsh _p
compctl -K _compzsh d
compctl -K _compzsh y
compctl -K _compzsh pd
else
shopt -s progcomp
complete -F _comp o
complete -F _comp g
complete -F _comp go
complete -F _comp _p
complete -F _comp d
complete -F _comp y
Expand All @@ -307,12 +307,12 @@ if [ $SHELLMARKS_k ]; then

if [ -n "$1" ]; then
if (grep DIR_$1 .sdirs &>/dev/null); then
g "$@"
go "$@"
else
j "$@"
fi
else
g "$@"
go "$@"
fi
}

Expand All @@ -333,4 +333,3 @@ if [ $SHELLMARKS_k ]; then
fi

fi