105 lines
2.6 KiB
Bash
105 lines
2.6 KiB
Bash
|
#
|
||
|
# .bashrc - interactive shell configuration
|
||
|
#
|
||
|
|
||
|
# check for interactive
|
||
|
[[ $- = *i* ]] || return
|
||
|
|
||
|
export TTY=$(tty)
|
||
|
export GPG_TTY=$TTY
|
||
|
|
||
|
# shell opts: see bash(1)
|
||
|
shopt -s cdspell dirspell extglob histverify no_empty_cmd_completion checkwinsize
|
||
|
|
||
|
set -o notify # notify of completed background jobs immediately
|
||
|
ulimit -S -c 0 # disable core dumps
|
||
|
stty -ctlecho # turn off control character echoing
|
||
|
|
||
|
if [[ $TERM = linux ]]; then
|
||
|
setterm -regtabs 2 # set tab width of 4 (only works on TTY)
|
||
|
fi
|
||
|
|
||
|
# more for less
|
||
|
export LESS=-R # use -X to avoid sending terminal initialization
|
||
|
export LESS_TERMCAP_mb=$'\e[01;31m'
|
||
|
export LESS_TERMCAP_md=$'\e[01;31m'
|
||
|
export LESS_TERMCAP_me=$'\e[0m'
|
||
|
export LESS_TERMCAP_se=$'\e[0m'
|
||
|
export LESS_TERMCAP_so=$'\e[01;44;33m'
|
||
|
export LESS_TERMCAP_ue=$'\e[0m'
|
||
|
export LESS_TERMCAP_us=$'\e[01;32m'
|
||
|
|
||
|
# history
|
||
|
export HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd *"
|
||
|
export HISTCONTROL="ignoreboth:erasedups"
|
||
|
export HISTSIZE=1000
|
||
|
export HISTFILESIZE=2000
|
||
|
|
||
|
GIT_EXEC_PATH=/usr/lib/git:/usr/share/git/remote-helpers
|
||
|
|
||
|
source_bash_completion() {
|
||
|
local f
|
||
|
[[ $BASH_COMPLETION ]] && return 0
|
||
|
for f in /{etc,usr/share/bash-completion}/bash_completion; do
|
||
|
if [[ -r $f ]]; then
|
||
|
. "$f"
|
||
|
return 0;
|
||
|
fi
|
||
|
done
|
||
|
}
|
||
|
|
||
|
# External config
|
||
|
if [[ -r ~/.dircolors ]] && type -p dircolors >/dev/null; then
|
||
|
eval $(dircolors -b "$HOME/.dircolors")
|
||
|
fi
|
||
|
|
||
|
PS1='\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]'
|
||
|
|
||
|
source_bash_completion
|
||
|
[[ -r /usr/share/bash-completion/completions/git ]] && . /usr/share/bash-completion/completions/git
|
||
|
unset -f source_bash_completion
|
||
|
|
||
|
# git prompt
|
||
|
[[ -f /usr/share/git/git-prompt.sh ]] && . /usr/share/git/git-prompt.sh
|
||
|
|
||
|
urlencode() {
|
||
|
local i= char= url=$*
|
||
|
declare -i len=${#url}
|
||
|
|
||
|
for (( i = 0; i < len; i++ )); do
|
||
|
char=${url:i:1}
|
||
|
case "$char" in
|
||
|
[a-zA-Z0-9.~_-]) printf "$char" ;;
|
||
|
' ') printf + ;;
|
||
|
*) printf '%%%X' "'$char" ;;
|
||
|
esac
|
||
|
done
|
||
|
}
|
||
|
|
||
|
mkcd() {
|
||
|
[[ $1 ]] || return 0
|
||
|
[[ -d $1 ]] || mkdir -vp "$1"
|
||
|
[[ -d $1 ]] && builtin cd "$1"
|
||
|
}
|
||
|
|
||
|
alias ..='cd ..'
|
||
|
alias ...='cd ../..'
|
||
|
alias ....='cd ../../..'
|
||
|
alias ff='/usr/bin/find . -iname "*$@*"'
|
||
|
alias gensums='[[ -f PKGBUILD ]] && makepkg -g >> PKGBUILD'
|
||
|
alias info='info --vi-keys'
|
||
|
alias j='jobs'
|
||
|
alias lla='ls -la'
|
||
|
alias ls='ls --group-directories-first --color'
|
||
|
alias md5='md5sum'
|
||
|
alias sd='systemctl'
|
||
|
alias ls='ls --color=auto'
|
||
|
alias grep='grep --color=auto'
|
||
|
alias fgrep='fgrep --color=auto'
|
||
|
alias egrep='egrep --color=auto'
|
||
|
alias ll='ls -alF'
|
||
|
alias la='ls -A'
|
||
|
alias l='ls -CF'
|
||
|
|
||
|
[[ -r "$HOME/.bashrc.local" ]] && . "$HOME/basrc.local"
|