Files
dotfiles/shell/bash/bashrc
2025-03-09 21:01:58 +03:00

26 lines
920 B
Bash

source ~/.dotfiles/git/git-prompt.sh
source ~/.dotfiles/shell/alias.sh
PROMPT_COMMAND='PS1_CMD1=$(__git_ps1 " [%s]")'; PS1='\[\e[38;5;117m\]\u\[\e[0m\] \w${PS1_CMD1}\$ '
PATH="$PATH:~/go/bin"
#
# tmux history preservation
#
# Avoid duplicates
HISTCONTROL=ignoredups:erasedups # Ubuntu default is ignoreboth
# When the shell exits, append to the history file instead of overwriting it
shopt -s histappend # In Ubuntu this is already set by default
# After each command, append to the history file and reread it
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
#
# tmux autostart
#
# [[ $- == *i* ]] is to check if the current seession is interactive - https://superuser.com/a/1777888/136716
if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ $- == *i* ]] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
exec tmux new-session -As0
fi