diff --git a/.bash_extra b/.bash_extra index 75194ea..fa7773b 100644 --- a/.bash_extra +++ b/.bash_extra @@ -1,12 +1,18 @@ #!/bin/bash +# source extra files source .bash_aliases source .bash_functions +source .bash_ps1 + +### PATH +# add my scripts to PATH +PATH=$PATH:/home/mg/dotfiles/scripts ### tmux auto attach - # Check if the user ID is not 0 (root) if [ "$EUID" -ne 0 ]; then + # then auto attach if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then tmux attach -t default || tmux new -s default fi @@ -16,33 +22,6 @@ fi eval "$(keychain -q --eval --timeout 60 --agents ssh,gpg)" export GPG_TTY=$(tty) -### PATH -# add my scripts to PATH -PATH=$PATH:/home/mg/dotfiles/scripts - -### PS1 -# Farben -BLUE='\[\e[34m\]' -GREEN='\[\e[32m\]' -RED='\[\e[31m\]' -YELLOW='\[\e[33m\]' -WHITE='\[\e[97m\]' -BLACK='\[\e[30m\]' -RESET='\[\e[0m\]' -ORANGE='\[\e[0;33m\]' -# git-symbole: * unstaged, + staged, $ stashed, % untracked -export GIT_PS1_SHOWUNTRACKEDFILES=1 -export GIT_PS1_SHOWDIRTYSTATE=1 -export GIT_PS1_SHOWSTASHSTATE=1 -export GIT_PS1_SHOWCONFLICTSTATE="yes" -export PS1="\n${BLUE}\u${GREEN}@${ORANGE}\$(cat /etc/hostname) ${GREEN}\$(dirs +0 | sed -E -e "s#/#${RED}/${RESET}${GREEN}#g")${YELLOW}\$(__git_ps1)${RESET}\n> " -# https://unix.stackexchange.com/questions/105958/terminal-prompt-not-wrapping-correctly -# alle Farben sind mit \[\] escaped, sonst kann die shell die länge nicht richtig ausrechnen -# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh -# https://gist.github.com/justintv/168835 -# https://misc.flogisoft.com/bash/tip_colors_and_formatting -# Zeige letzte Exit-Code: https://stackoverflow.com/questions/16715103/bash-prompt-with-the-last-exit-code - ### Praktische Dinge # Deaktiviere FlowControl # https://unix.stackexchange.com/questions/332791/how-to-permanently-disable-ctrl-s-in-terminal @@ -70,6 +49,5 @@ shopt -s cdspell # less mit maus scrollen export LESS='--mouse --wheel-lines=3 eFRX' -# deaktiviere alias von ll -# weiter unten ist die FUnktion ll definiert die entweder exa oder ls ausführt +# deaktiviere alias von ll, wird von mir explizit gesetzt unalias ll 2>/dev/null diff --git a/.bash_ps1 b/.bash_ps1 new file mode 100644 index 0000000..4b5ceea --- /dev/null +++ b/.bash_ps1 @@ -0,0 +1,21 @@ +# Farben +BLUE='\[\e[34m\]' +GREEN='\[\e[32m\]' +RED='\[\e[31m\]' +YELLOW='\[\e[33m\]' +WHITE='\[\e[97m\]' +BLACK='\[\e[30m\]' +RESET='\[\e[0m\]' +ORANGE='\[\e[0;33m\]' +# git-symbole: * unstaged, + staged, $ stashed, % untracked +export GIT_PS1_SHOWUNTRACKEDFILES=1 +export GIT_PS1_SHOWDIRTYSTATE=1 +export GIT_PS1_SHOWSTASHSTATE=1 +export GIT_PS1_SHOWCONFLICTSTATE="yes" +export PS1="\n${BLUE}\u${GREEN}@${ORANGE}\$(cat /etc/hostname) ${GREEN}\$(dirs +0 | sed -E -e "s#/#${RED}/${RESET}${GREEN}#g")${YELLOW}\$(__git_ps1)${RESET}\n> " +# https://unix.stackexchange.com/questions/105958/terminal-prompt-not-wrapping-correctly +# alle Farben sind mit \[\] escaped, sonst kann die shell die länge nicht richtig ausrechnen +# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh +# https://gist.github.com/justintv/168835 +# https://misc.flogisoft.com/bash/tip_colors_and_formatting +# Zeige letzte Exit-Code: https://stackoverflow.com/questions/16715103/bash-prompt-with-the-last-exit-code