Move all aliases to bash aliases. Make a bash_prompt file for prompt styling. Update README

This commit is contained in:
Leo 2026-01-27 15:41:57 +02:00
parent d79b804e93
commit 9de44888ba
3 changed files with 60 additions and 13 deletions

View file

@ -1,21 +1,38 @@
alias gm="git checkout master && git pull"
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# ls aliases
alias count="ls -l | wc -l"
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias c="clear"
function gcam() { git commit -a -m "$1"; }
function dt() {
nohup "$@" </dev/null >/dev/null 2>&1 &
disown
}
function csa(){ cd $1 && ls -a; }
function cs(){ cd $1 && ls; }
function mkcdir ()
{
mkdir "$1" &&
cd "$1"
}
# Git aliases
function gcam() { git commit -a -m "$1"; }
function dt() { nohup "$@" </dev/null >/dev/null 2>&1 & disown; }
alias gm="git checkout main && git pull"
function mkcdir () { mkdir "$1" && cd "$1"; }
alias scripts="jq .scripts package.json"
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'

28
.bash_prompt Normal file
View file

@ -0,0 +1,28 @@
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
function parse_git_branch() {
# git branch --show-current 2>/dev/null | sed 's/^/ (/' | sed 's/$/)/'
local branch
branch=$(git branch --show-current 2>/dev/null)
#[[ -n "$branch" ]] && printf ' \033[44;30m %s \033[0;34m\ue0b0\033[0m' "$branch"
if [[ -n "$branch" ]]; then
printf '\033[44;33m'$'\ue0b0''\033[44;30m %s \033[0;34m'$'\ue0b0''\033[0m' "$branch"
else
printf '\033[0;33m'$'\ue0b0''\033[0m'
fi
}
if [ "$color_prompt" = yes ]; then
PS1='\[\033[43;30m\] \w \[$(parse_git_branch)\] '
else
PS1='\w\$ '
fi
unset color_prompt
printf '\033[3 q'

View file

@ -27,6 +27,8 @@ if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
Also a .bash_prompt file is included that can be included in the same way as the bash_aliases. It provides styling for the prompt
## Tmux uses the tpm for plugins
https://github.com/tmux-plugins/tpm