dotfiles/.bash_aliases

31 lines
837 B
Bash
Raw Normal View History

# ls aliases
2020-03-08 18:58:52 +00:00
export LS_OPTIONS='--human-readable --si --group-directories-first --file-type --dereference-command-line'
eval "$(dircolors)"
alias ls='ls --color=auto'
alias ll='ls $LS_OPTIONS -l --all'
alias l='ls $LS_OPTIONS --color=always --almost-all'
which bat >/dev/null || alias bat=batcat
b() {
test -d "${1:-.}" && l "$@" || bat "$@"
}
alias v=nvim
2021-12-11 01:31:06 +00:00
# Some aliases to avoid making mistakes:
2020-03-08 18:58:52 +00:00
alias rm='rm -I'
alias cp='cp -i'
alias mv='mv -i'
2020-03-08 18:58:52 +00:00
# Fancy prompt
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]"
2020-03-08 18:58:52 +00:00
PS1="$PS1 \`if [ \$? = 0 ]; then echo -e '\[\033[01;32m\]:)';"
PS1="$PS1 else echo -e '\[\033[01;31m\]' \$?; fi\`\[\033[00m\]"
src() { test -f "$1" && source "$1"; }
src /usr/share/git/completion/git-prompt.sh && PS1="$PS1\$(__git_ps1 \" (%s)\")"
src $HOME/.config/shell/functions
PS1="$PS1 \$ "