Stop trapping SIGINT to allow further use of Ctrl+C once lfcd is closed (#1231)

* Avoid expansion of file path containing spaces

* Do not trap INT signal on lfcd

* Untrap to stop trapping once lfcd quit

* Revert "Avoid expansion of file path containing spaces"

This reverts commit edcccf8f1bb0eb283aa332dc3a2d2b431eb6d189.

* Trap SIGINT again
This commit is contained in:
Gioele De Vitti 2022-11-11 18:38:57 +01:00 committed by GitHub
parent 75bc064a2f
commit d6616cf08b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,7 +54,7 @@ preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp -uq)"
trap 'rm -f $tmp >/dev/null 2>&1' HUP INT QUIT TERM PWR EXIT
trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT
lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then
dir="$(cat "$tmp")"