Last active
September 24, 2017 16:47
-
-
Save hugollm/fcd7d6caf2e9f54cf154d1e28efb88e4 to your computer and use it in GitHub Desktop.
bashrc script to add newlines before and after each prompt, for easier reading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--------------------------------------------- | |
# Newlines before and after each prompt line | |
#--------------------------------------------- | |
function pre_command() { | |
printf "\n" | |
} | |
function post_command() { | |
printf "\n" | |
} | |
function pre_command_hook() { | |
if [ -z "$AT_PROMPT" ]; then | |
return | |
fi | |
unset AT_PROMPT | |
pre_command | |
} | |
function post_command_hook() { | |
AT_PROMPT=1 | |
if [ -n "$FIRST_PROMPT" ]; then | |
unset FIRST_PROMPT | |
return | |
fi | |
post_command | |
} | |
FIRST_PROMPT=1 | |
trap "pre_command_hook" DEBUG | |
PROMPT_COMMAND="post_command_hook" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment