m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 16:45:38 -05:00

insert section 'Toggle options'

D630
2015-05-28 05:11:33 +02:00
parent 53437758d4
commit 58d007dadd

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