formatting
This commit is contained in:
parent
af446e2f84
commit
b65b3c7964
46
bash/bashrc
46
bash/bashrc
@ -5,15 +5,18 @@ case $- in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
#========== HISTORY OPTIONS ==========#
|
#========== HISTORY OPTIONS ==========#
|
||||||
|
|
||||||
HISTSIZE= ;
|
HISTSIZE= ;
|
||||||
HISTFILESIZE=
|
HISTFILESIZE=
|
||||||
HISTCONTROL="ignoreboth:erasedups"
|
HISTCONTROL="ignoreboth:erasedups"
|
||||||
HISTTIMEFORMAT="%F %T "
|
HISTTIMEFORMAT="%F %T "
|
||||||
|
|
||||||
#========== SHELL OPTIONS ==========#
|
#========== SHELL OPTIONS ==========#
|
||||||
|
|
||||||
shopt -s checkhash checkjobs checkwinsize cmdhist direxpand dirspell extglob globstar histappend
|
shopt -s checkhash checkjobs checkwinsize cmdhist direxpand dirspell extglob globstar histappend
|
||||||
|
|
||||||
#========== PROGRAM VARIABLES ==========#
|
#========== PROGRAM VARIABLES ==========#
|
||||||
|
|
||||||
export EDITOR="/usr/bin/vim"
|
export EDITOR="/usr/bin/vim"
|
||||||
export VISUAL="/usr/bin/vim"
|
export VISUAL="/usr/bin/vim"
|
||||||
export PAGER="less"
|
export PAGER="less"
|
||||||
@ -21,7 +24,6 @@ export PAGER="less"
|
|||||||
#========== ALIASES ==========#
|
#========== ALIASES ==========#
|
||||||
|
|
||||||
# common options
|
# common options
|
||||||
|
|
||||||
LS_OPTS="-F --color=auto"
|
LS_OPTS="-F --color=auto"
|
||||||
GREP_OPTS="--color=auto"
|
GREP_OPTS="--color=auto"
|
||||||
|
|
||||||
@ -36,7 +38,6 @@ alias sl='ls -lsSh ${LS_OPTS}'
|
|||||||
alias sal='ls -AlsSh ${LS_OPTS}'
|
alias sal='ls -AlsSh ${LS_OPTS}'
|
||||||
|
|
||||||
# cd
|
# cd
|
||||||
|
|
||||||
alias cd..='cd ..'
|
alias cd..='cd ..'
|
||||||
alias ..='cd ..'
|
alias ..='cd ..'
|
||||||
alias ...='cd ../..'
|
alias ...='cd ../..'
|
||||||
@ -47,26 +48,22 @@ alias ..4='cd ../../../..'
|
|||||||
alias ..5='cd ../../../../..'
|
alias ..5='cd ../../../../..'
|
||||||
|
|
||||||
# grep
|
# grep
|
||||||
|
|
||||||
alias grep='grep ${GREP_OPTS}'
|
alias grep='grep ${GREP_OPTS}'
|
||||||
alias fgrep='fgrep ${GREP_OPTS}'
|
alias fgrep='fgrep ${GREP_OPTS}'
|
||||||
alias egrep='egrep ${GREP_OPTS}'
|
alias egrep='egrep ${GREP_OPTS}'
|
||||||
|
|
||||||
# utility aliases
|
# utility aliases
|
||||||
|
|
||||||
alias tree='tree -C'
|
alias tree='tree -C'
|
||||||
alias treel='tree -C | less -R'
|
alias treel='tree -C | less -R'
|
||||||
alias df='df -h'
|
alias df='df -h'
|
||||||
alias lsmnt='mount | column -t'
|
alias lsmnt='mount | column -t'
|
||||||
alias mkdir='mkdir -pv'
|
alias mkdir='mkdir -p'
|
||||||
|
|
||||||
# git
|
# git
|
||||||
|
|
||||||
alias g=git
|
alias g=git
|
||||||
alias groot='cd $(git rev-parse --show-toplevel 2> /dev/null || echo -n ".")'
|
alias groot='cd $(git rev-parse --show-toplevel 2> /dev/null || echo -n ".")'
|
||||||
|
|
||||||
# tmux
|
# tmux
|
||||||
|
|
||||||
alias tmls='tmux ls'
|
alias tmls='tmux ls'
|
||||||
alias tmlsc='tmux lsc'
|
alias tmlsc='tmux lsc'
|
||||||
alias tmks='tmux kill-session -t' # kill one session
|
alias tmks='tmux kill-session -t' # kill one session
|
||||||
@ -78,7 +75,6 @@ alias venvac='source venv/bin/activate'
|
|||||||
#========== FUNCTIONS ==========#
|
#========== FUNCTIONS ==========#
|
||||||
|
|
||||||
# common commands used together
|
# common commands used together
|
||||||
|
|
||||||
cl() {
|
cl() {
|
||||||
builtin cd -P "$@" && ls -alshF
|
builtin cd -P "$@" && ls -alshF
|
||||||
}
|
}
|
||||||
@ -92,7 +88,6 @@ touchx() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# git
|
# git
|
||||||
|
|
||||||
lazygit() {
|
lazygit() {
|
||||||
git commit -a -m "$*" && git push
|
git commit -a -m "$*" && git push
|
||||||
}
|
}
|
||||||
@ -102,7 +97,6 @@ lg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# git prompt functions
|
# git prompt functions
|
||||||
|
|
||||||
parse_git() {
|
parse_git() {
|
||||||
# ways to get branches
|
# ways to get branches
|
||||||
# git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
|
# git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
|
||||||
@ -130,7 +124,6 @@ parse_git() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# tmux
|
# tmux
|
||||||
|
|
||||||
tm() {
|
tm() {
|
||||||
if [ "$#" -gt 0 ]; then
|
if [ "$#" -gt 0 ]; then
|
||||||
tmux new-session -As "$1"
|
tmux new-session -As "$1"
|
||||||
@ -151,7 +144,6 @@ tma() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# paths and files
|
# paths and files
|
||||||
|
|
||||||
pathappend() {
|
pathappend() {
|
||||||
# https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
|
# https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
|
||||||
for ARG; do
|
for ARG; do
|
||||||
@ -173,33 +165,26 @@ bkup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#========== PROMPTS ==========#
|
#========== PROMPTS ==========#
|
||||||
# git prompts
|
|
||||||
|
# ***git prompts***
|
||||||
|
|
||||||
# PS1="\[\033[1;34m\]\w\[\033[0m\]\$(parse_git) \[\033[1;36m\]\$\[\033[0m\] "
|
# PS1="\[\033[1;34m\]\w\[\033[0m\]\$(parse_git) \[\033[1;36m\]\$\[\033[0m\] "
|
||||||
# PS1="\[\033[1;35m\]\u\[\033[1;33m\]@\[\033[1;36m\]\h\[\033[0m\]:\[\033[1;37:\[\033[1;34m\]\w\[\033[0m\]\$(parse_git)\[\033[0m\]\[\033[1;33m\]$ \[\033[0m\]"
|
# PS1="\[\033[1;35m\]\u\[\033[1;33m\]@\[\033[1;36m\]\h\[\033[0m\]:\[\033[1;37:\[\033[1;34m\]\w\[\033[0m\]\$(parse_git)\[\033[0m\]\[\033[1;33m\]$ \[\033[0m\]"
|
||||||
# PS1="\[\033[1;36m\]\u \[\033[1;37m\]at \[\033[1;33m\]\h \[\033[1;37m\]in \[\033[1;34m\]\w \[\033[1;37m\]on \[\033[1;37m\]\$(parse_git)\n\[\033[1;37m\]\$ "
|
# PS1="\[\033[1;36m\]\u \[\033[1;37m\]at \[\033[1;33m\]\h \[\033[1;37m\]in \[\033[1;34m\]\w \[\033[1;37m\]on \[\033[1;37m\]\$(parse_git)\n\[\033[1;37m\]\$ "
|
||||||
|
|
||||||
PS1="\[\033[1;34m\]\W\[\033[0m\]\$(parse_git) \[\033[1;35m\]\$\[\033[0m\] "
|
# ***non git prompts***
|
||||||
# PS1="\[\033[1;35m\]\u\[\033[1;33m\]@\[\033[1;36m\]\h\[\033[0m\]:\[\033[1;37:\[\033[1;34m\]\W\[\033[0m\]\$(parse_git)\[\033[0m\]\[\033[1;33m\]$ \[\033[0m\]"
|
|
||||||
|
|
||||||
# non git prompts
|
|
||||||
# PS1="\[\033[1;34m\]\w \[\033[1;33m\]\$ \[\033[0m\]"
|
# PS1="\[\033[1;34m\]\w \[\033[1;33m\]\$ \[\033[0m\]"
|
||||||
# PS1="\[\033[1;35m\]\u\[\033[1;33m\]@\[\033[1;36m\]\h\[\033[0m\]:\[\033[1;37:\[\033[1;34m\]\w\[\033[0m\]\[\033[1;33m\]$ \[\033[0m\]"
|
# PS1="\[\033[1;35m\]\u\[\033[1;33m\]@\[\033[1;36m\]\h\[\033[0m\]:\[\033[1;37:\[\033[1;34m\]\w\[\033[0m\]\[\033[1;33m\]$ \[\033[0m\]"
|
||||||
|
|
||||||
# non color prompts
|
# ***non-color prompts***
|
||||||
|
|
||||||
# PS1="\w \$ "
|
# PS1="\w \$ "
|
||||||
# PS1="[\u@\h:\w]$ "
|
# PS1="[\u@\h:\w]$ "
|
||||||
# PS1="\u@\h:\w$ "
|
# PS1="\u@\h:\w$ "
|
||||||
|
|
||||||
#========== BASH AUTOCOMPLETION ==========#
|
|
||||||
if ! shopt -oq posix; then
|
|
||||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
|
||||||
. /usr/share/bash-completion/bash_completion
|
|
||||||
elif [ -f /etc/bash_completion ]; then
|
|
||||||
. /etc/bash_completion
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#========== COLORS REFERENCE ==========#
|
#========== COLORS REFERENCE ==========#
|
||||||
|
|
||||||
# COLORS according to (ANSI/VT100 Control sequences)
|
# COLORS according to (ANSI/VT100 Control sequences)
|
||||||
# https://misc.flogisoft.com/bash/tip_colors_and_formatting for examples
|
# https://misc.flogisoft.com/bash/tip_colors_and_formatting for examples
|
||||||
|
|
||||||
@ -215,3 +200,12 @@ fi
|
|||||||
# \[\033[0m\] RESET NORMAL
|
# \[\033[0m\] RESET NORMAL
|
||||||
# \[\033[1m\] RESET BOLD
|
# \[\033[1m\] RESET BOLD
|
||||||
|
|
||||||
|
#========== BASH AUTOCOMPLETION ==========#
|
||||||
|
|
||||||
|
if ! shopt -oq posix; then
|
||||||
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||||
|
. /usr/share/bash-completion/bash_completion
|
||||||
|
elif [ -f /etc/bash_completion ]; then
|
||||||
|
. /etc/bash_completion
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user