m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-19 00:53:42 -05:00

Updated Examples (markdown)

D630
2016-03-21 08:08:40 +00:00
parent 65045a3397
commit 01e2792969

@@ -237,35 +237,55 @@ builtin bind '"\C-r": "\C-x1\e^\er"'
```sh ```sh
# Toggle bash options (set and shopt) # Toggle bash options (set and shopt)
BOLD=$(tput bold || tput md) __do ()
RESET=$(tput sgr0 || tput me) while
GREEN=$(tput setaf 2 || tput AF 2) builtin read -r b o n _
RED=$(tput setaf 1 || tput AF 1)
#WHITE=$(tput setaf 7 || tput AF 7)
while read -r b o n _
do do
case "${b}${o}" in case ${b}${o} in
"set+o") set -o "$n" ;; set+o)
"set-o") set +o "$n" ;; builtin set -o "$n"
"shopt-s") shopt -u "$n" ;; ;;
"shopt-u") shopt -s "$n" ;; set-o)
esac builtin set +o "$n"
printf ${RESET} ;;
done < <( shopt-s)
< <(shopt -p ; shopt -op) sed " builtin shopt -u "$n"
/ -[so] / { ;;
s/$/ ${BOLD}${GREEN}enabled/; shopt-u)
b return builtin shopt -s "$n"
}; { esac
s/$/ ${BOLD}${RED}disabled/; done
};
: return; __select ()
" | {
sort -k 3 | builtin typeset \
column -t | BOLD=$(command tput bold || command tput md;) \
fzf --ansi --multi --with-nth=3.. --tiebreak=begin RESET=$(command tput sgr0 || command tput me;) \
) GREEN=$(command tput setaf 2 || command tput AF 2;) \
RED=$(command tput setaf 1 || command tput AF 1;);
command sed "
/ -[so] / {
s/$/ ${BOLD}${GREEN}enabled${RESET}/;
b return
}; {
s/$/ ${BOLD}${RED}disabled${RESET}/;
};
: return;
" \
| command sort -k 3 \
| command column -t \
| command fzf --ansi --multi --with-nth=3.. --tiebreak=begin;
}
__input ()
{
builtin shopt -p
builtin shopt -op
}
__do < <(__select < <(__input))
``` ```
### Processes ### Processes