Skip to content

Instantly share code, notes, and snippets.

@NoelDeMartin
Last active March 9, 2022 09:43
Show Gist options
  • Save NoelDeMartin/06878d927fc02fdf3cd51d1e37f7d4d2 to your computer and use it in GitHub Desktop.
Save NoelDeMartin/06878d927fc02fdf3cd51d1e37f7d4d2 to your computer and use it in GitHub Desktop.
Bash settings
# VSCode opens terminals in the project root, so this will make sure that
# you're using the correct version of npm and node
if [ -f .nvmrc ]; then
nvm install &> /dev/null
fi
# Change default prompt
PROMPT_COMMAND=__prompt_command
__prompt_command() {
local exitcode=$?
local command=`history | tail -1 | cut -c 8-`
if [[ $exitcode == 0 ]] || \
# 130 - Ignore manual interruption
[[ $exitcode == 130 ]] || \
# 141 - Ignore exiting `git log` command (aliased as "gl")
[[ $exitcode == 141 && $command == "gl" ]]
then
PS1="🤖 "
else
PS1="💥 "
fi
}
@NoelDeMartin
Copy link
Author

NoelDeMartin commented Mar 9, 2022

I moved this to a repo with other settings I use: https://github.com/NoelDeMartin/env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment