#!/bin/bash source .bash_aliases source .bash_functions ### tmux auto attach # Check if the user ID is not 0 (root) if [ "$EUID" -ne 0 ]; then if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then tmux attach -t default || tmux new -s default fi fi ### keychain 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 stty -ixon # farben fur manpages # https://opensource.com/article/18/5/bash-tricks export LESS_TERMCAP_mb=$'\E[01;31m' export LESS_TERMCAP_md=$'\E[01;33m' export LESS_TERMCAP_me=$'\E[0m' export LESS_TERMCAP_se=$'\E[0m' export LESS_TERMCAP_so=$'\E[01;42;30m' export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_us=$'\E[01;36m' # bash history bei mehreren Session shopt -s histappend # bach History Zeitstempel am Anfang der Zeile export HISTTIMEFORMAT='[%F_%T] ' # typo bei cd entfernen 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 unalias ll 2>/dev/null