This commit is contained in:
caandt 2024-12-25 14:31:37 -05:00
parent 28633e37bd
commit a83f726779
2 changed files with 19 additions and 1 deletions

View file

@ -24,7 +24,7 @@ _load history
_load aliases
# set xdg env vars to keep home directory clean
_load xdg
_load show
_load func
if _exists fzf; then
export FZF_DEFAULT_OPTS="--bind=ctrl-u:page-up,ctrl-d:page-down"

View file

@ -40,3 +40,21 @@ function rl() {
done
[[ -e "$l" ]] && echo "$l" || echo "~nonexistent~"
}
function tmpedit() {
if [[ "$#" -ne 1 ]]; then
echo "usage: tmpedit <file>" >&2
return 1
fi
local real="$(realpath "$1")"
if [[ ! -f "$real" ]]; then
echo "not found"
return 2
fi
if [[ ! "$real" =~ /nix/store/* ]]; then
echo "not nix"
return 3
fi
cp --remove-destination "$real" "$1"
chmod +w "$1"
$EDITOR "$1"
}