mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 17:13:42 -05:00
Updated Examples (markdown)
64
Examples.md
64
Examples.md
@@ -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)
|
||||||
|
builtin set +o "$n"
|
||||||
|
;;
|
||||||
|
shopt-s)
|
||||||
|
builtin shopt -u "$n"
|
||||||
|
;;
|
||||||
|
shopt-u)
|
||||||
|
builtin shopt -s "$n"
|
||||||
esac
|
esac
|
||||||
printf ${RESET}
|
done
|
||||||
done < <(
|
|
||||||
< <(shopt -p ; shopt -op) sed "
|
__select ()
|
||||||
|
{
|
||||||
|
builtin typeset \
|
||||||
|
BOLD=$(command tput bold || command tput md;) \
|
||||||
|
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] / {
|
/ -[so] / {
|
||||||
s/$/ ${BOLD}${GREEN}enabled/;
|
s/$/ ${BOLD}${GREEN}enabled${RESET}/;
|
||||||
b return
|
b return
|
||||||
}; {
|
}; {
|
||||||
s/$/ ${BOLD}${RED}disabled/;
|
s/$/ ${BOLD}${RED}disabled${RESET}/;
|
||||||
};
|
};
|
||||||
: return;
|
: return;
|
||||||
" |
|
" \
|
||||||
sort -k 3 |
|
| command sort -k 3 \
|
||||||
column -t |
|
| command column -t \
|
||||||
fzf --ansi --multi --with-nth=3.. --tiebreak=begin
|
| command fzf --ansi --multi --with-nth=3.. --tiebreak=begin;
|
||||||
)
|
}
|
||||||
|
|
||||||
|
__input ()
|
||||||
|
{
|
||||||
|
builtin shopt -p
|
||||||
|
builtin shopt -op
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__do < <(__select < <(__input))
|
||||||
```
|
```
|
||||||
|
|
||||||
### Processes
|
### Processes
|
||||||
|
|||||||
Reference in New Issue
Block a user