dotfiles/.bash_extra
Michael Grote 48073cefe5 add less options
Signed-off-by: Michael Grote <michael.grote@dataport.de>
2024-10-01 13:34:44 +02:00

62 lines
1.8 KiB
Bash

#!/bin/bash
# deaktiviere alias von ll, wird von mir explizit gesetzt
unalias ll 2>/dev/null
# source extra files
source "${HOME}/repos/dotfiles/.bash_aliases"
source "${HOME}/repos/dotfiles/.bash_functions"
source "${HOME}/repos/dotfiles/.bash_ps1"
### PATH
# add my scripts to PATH
PATH=$PATH:"${HOME}/repos/dotfiles/scripts"
## check interactive shell https://unix.stackexchange.com/questions/26676/how-to-check-if-a-shell-is-login-interactive-batch
if [[ $- == *i* ]] ; then
### root alias
alias root='sudo -H -u root /usr/bin/sudo2uls'
if [ "$HOSTNAME" = lzeorpt001 ]; then
### git-bash
source /usr/share/git-core/contrib/completion/git-prompt.sh
### keychain
export GPG_TTY=$(tty)
# git commit usw.
export EDITOR="/usr/bin/vim"
fi
### tmux auto attach
if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
tmux attach -t default || tmux new -s default
fi
if [ "$HOSTNAME" == "lzeorpt001" ] || [ "$HOSTNAME" == "lbdlspa001" ]; then
eval $(keychain -q --eval --timeout 60 --agents ssh,gpg)
fi
fi
### 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
# bash History Zeitstempel am Anfang der Zeile
export HISTTIMEFORMAT='[%F_%T] '
# https://askubuntu.com/questions/15926/how-to-avoid-duplicate-entries-in-bash-history
export HISTCONTROL=ignoreboth:erasedups
# typo bei cd entfernen
shopt -s cdspell
export LESS='eFRX'