mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-20 01:23:43 -05:00
insert section 'Toggle options'
47
Examples.md
47
Examples.md
@@ -136,6 +136,53 @@ builtin bind -x '"\C-x1": __fzf_history';
|
|||||||
builtin bind '"\C-r": "\C-x1\e^\er"'
|
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
|
### Processes
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
Reference in New Issue
Block a user