config/shell: update default fzf bindings & secure intentions

This commit is contained in:
xeruf 2021-06-13 15:51:25 +02:00
parent b5aa87edac
commit 8c4a4191af
3 changed files with 30 additions and 5 deletions

View File

@ -12,6 +12,7 @@ indent_character: '|'
journals:
default: ~/data/2-standards/notes/journal/jrnl.txt
intentions: ~/data/2-standards/notes/journal/intentions.txt
intentions-nug: ~/data/2-standards/notes/journal/intentions-nug.txt
nug: ~/data/2-standards/notes/journal/nugnug.txt
linewrap: 99
tagsymbols: '@'

View File

@ -142,11 +142,16 @@ alias listen='pactl load-module module-loopback; echo "Press Enter to stop"; rea
alias browse-safe='sudo systemctl disable --now systemd-resolved && sudo rm -f /etc/resolv.conf && echo "nameserver 185.228.168.10" | sudo tee /etc/resolv.conf && sudo chattr +i /etc/resolv.conf'
browse-unsafe() {
echo "Why do you want to browse unsafe?"
while test ${#intention} -lt 10
do read intention
done
jrnl intentions-nug "$intention"
trap 'echo Browsing safe; browse-safe' INT
sudo chattr -i /etc/resolv.conf &&
sudo mv /etc/resolv.conf /etc/resolv.conf.bak &&
sudo systemctl enable --now systemd-resolved &&
sleep 100
sleep ${1:-100}
browse-safe
}

View File

@ -43,7 +43,24 @@ test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so$
# enable pass extensions
export PASSWORD_STORE_ENABLE_EXTENSIONS="true"
# fzf defaults
export FZF_DEFAULT_OPTS='--select-1 --exit-0 --tiebreak=end,length --history=/var/tmp/fzf-history --ansi --bind="alt-enter:execute(test -O {} && $EDITOR {} || sudoedit {}),alt-bspace:execute(gio trash {}),change:top,double-click:execute(xdg-open {}),alt-c:yank"'
FZF_BINDINGS=$(echo '
change:top
alt-enter:execute(test -O {} && $EDITOR {} || sudoedit {})
alt-bspace:execute(gio trash {})
double-click:execute(xdg-open {})
ctrl-a:select-all
alt-a:select-all
alt-c:yank
alt-w:toggle-preview-wrap
alt-j:preview-half-page-down,alt-k:preview-half-page-up
shift-down:preview-half-page-down,shift-up:preview-half-page-up
alt-shift-down:preview-down,alt-shift-up:preview-up
esc:close
' | xargs -I% echo -n "%," | head -c-1)
#alt-r:preview(bat {}),
export FZF_DEFAULT_OPTS="--select-1 --ansi --marker=o
--tiebreak=end,length --history=/var/tmp/fzf-history --bind='$FZF_BINDINGS'
--preview-window=60%,border-left"
FD_BASE="fd --hidden --color=always --no-ignore-vcs"
export FZF_DEFAULT_COMMAND="$FD_BASE --type file"
export FZF_CTRL_T_COMMAND="$FD_BASE -d 7"
@ -54,7 +71,9 @@ export CTEST_PARALLEL_LEVEL=3
if test -z "${DISPLAY}" && test "${XDG_VTNR}" -eq 1 ; then
echo "What do you want to do?"
read response
jrnl intentions "$response"
while test $(echo "$intention" | wc -c) -lt 6
do read intention
done
jrnl intentions "$intention"
exec startx
fi