Merge pull request #882 from nwinkler/percol-bash3-fix

Fixed percol plugin function syntax
pull/819/merge
Nils Winkler 2017-01-09 09:18:03 +01:00 committed by GitHub
commit 1cf6007a8e
1 changed files with 3 additions and 2 deletions

View File

@ -29,13 +29,14 @@ _replace_by_history() {
if command -v percol>/dev/null; then if command -v percol>/dev/null; then
local current_version=${BASH_VERSION%%[^0-9]*} local current_version=${BASH_VERSION%%[^0-9]*}
if [ $current_version -lt 4 ]; then if [ $current_version -lt 4 ]; then
echo "Warning:You have to upgrade bash to bash 4.x to use percol plugin." echo -e "\033[91mWarning: You have to upgrade Bash to Bash v4.x to use the 'percol' plugin.\033[m"
echo -e "\033[91m Your current Bash version is $BASH_VERSION.\033[m"
else else
bind -x '"\C-r": _replace_by_history' bind -x '"\C-r": _replace_by_history'
# bind zz to percol if fasd enable # bind zz to percol if fasd enable
if command -v fasd>/dev/null; then if command -v fasd>/dev/null; then
zz(){ function zz() {
local l=$(fasd -d | awk '{print $2}' | percol) local l=$(fasd -d | awk '{print $2}' | percol)
cd $l cd $l
} }