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

Add support for listing partial matches #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
18 changes: 14 additions & 4 deletions bashmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,20 @@ function l {
check_help $1
source $SDIRS

# if color output is not working for you, comment out the line below '\033[1;32m' == "red"
env | sort | awk '/^DIR_.+/{split(substr($0,5),parts,"="); printf("\033[0;33m%-20s\033[0m %s\n", parts[1], parts[2]);}'
if [[ -z $1 ]]; then
# if color output is not working for you, comment out the line below '\033[1;32m' == "red"
env | sort | awk '/^DIR_.+/{split(substr($0,5),parts,"="); printf("\033[0;33m%-20s\033[0m %s\n", parts[1], parts[2]);}'

# uncomment this line if color output is not working with the line above
# env | grep "^DIR_" | cut -c5- | sort |grep "^.*="
# uncomment this line if color output is not working with the line above
# env | grep "^DIR_" | cut -c5- | sort |grep "^.*="
else
# if color output is not working for you, comment out the line below '\033[1;32m' == "red"
env | grep "^DIR_${1}" | sort | awk '/^DIR_.+/{split(substr($0,5),parts,"="); printf("\033[0;33m%-20s\033[0m %s\n", parts[1], parts[2]);}'
# uncomment this line if color output is not working with the line above
# env | grep "^DIR_${1}" | cut -c5- | sort |grep "^.*="
fi
}

# list bookmarks without dirname
function _l {
source $SDIRS
Expand Down Expand Up @@ -158,11 +166,13 @@ function _purge_line {

# bind completion command for g,p,d to _comp
if [ $ZSH_VERSION ]; then
compctl -K _compzsh l
compctl -K _compzsh g
compctl -K _compzsh p
compctl -K _compzsh d
else
shopt -s progcomp
complete -F _comp l
complete -F _comp g
complete -F _comp p
complete -F _comp d
Expand Down