Skip to content

Instantly share code, notes, and snippets.

@aont
Created May 31, 2019 02:40
Show Gist options
  • Select an option

  • Save aont/089b5a335cbb75ee3a62c3dc16a0ff79 to your computer and use it in GitHub Desktop.

Select an option

Save aont/089b5a335cbb75ee3a62c3dc16a0ff79 to your computer and use it in GitHub Desktop.
# percol-cdr my custom
setopt BASH_REMATCH
function percol-cdr () {
local selected_line="$( cdr -l | percol )"
if [ -n "$selected_line" ]; then
if [[ "$selected_line" =~ ^[0-9]+ ]]; then
local selected_num=$BASH_REMATCH[1]
cdr $selected_num > /dev/null
else
echo "unexpected error" 1>&2
fi
fi
}
zle -N percol-cdr
alias pcd=percol-cdr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment