Skip to content

Instantly share code, notes, and snippets.

@chattr
Created April 25, 2024 10:54
Show Gist options
  • Save chattr/2a2251e5fb2679768039c843138bbaca to your computer and use it in GitHub Desktop.
Save chattr/2a2251e5fb2679768039c843138bbaca to your computer and use it in GitHub Desktop.
Useful shell functions
# VSCode diff with ephemeral working directory and files
diffy() (
# shellcheck disable=SC2317
cleanup() {
rm -rf "${HOME}/sandbox"
}
trap cleanup EXIT
trap cleanup TERM
[ ! -d "${HOME}/sandbox" ] && mkdir "${HOME}/sandbox"
touch "${HOME}/sandbox/"{a,b}
code --wait --diff "${HOME}/sandbox/"{a,b}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment