cleanup formatting, add spell shell options
This commit is contained in:
parent
65079bb803
commit
e897f485a4
@ -11,19 +11,21 @@ case $- in
|
|||||||
*) return;;
|
*) return;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
##* environment variables *##
|
|
||||||
# {{{
|
|
||||||
|
|
||||||
# environment variables for commands
|
# environment variables for commands
|
||||||
export PAGER="less"
|
export PAGER="less"
|
||||||
export EDITOR="/usr/bin/vim"
|
export EDITOR="/usr/bin/vim"
|
||||||
export VISUAL="/usr/bin/vim"
|
export VISUAL="/usr/bin/vim"
|
||||||
|
|
||||||
# bash history options
|
# bash history options
|
||||||
HISTSIZE= ;
|
export HISTSIZE= ;
|
||||||
HISTFILESIZE= ;
|
export HISTFILESIZE= ;
|
||||||
HISTCONTROL="ignoreboth:erasedups"
|
export HISTCONTROL="ignoreboth:erasedups"
|
||||||
HISTTIMEFORMAT="%F %T "
|
export HISTTIMEFORMAT="%F %T "
|
||||||
|
|
||||||
|
# shell options
|
||||||
|
shopt -s checkhash
|
||||||
|
shopt -s cdspell
|
||||||
|
shopt -s dirspell
|
||||||
|
|
||||||
# ls options
|
# ls options
|
||||||
ls --version &> /dev/null
|
ls --version &> /dev/null
|
||||||
@ -33,11 +35,8 @@ else
|
|||||||
LS_OPTS="-GF"
|
LS_OPTS="-GF"
|
||||||
export CLICOLOR=1
|
export CLICOLOR=1
|
||||||
fi
|
fi
|
||||||
# }}}
|
|
||||||
|
|
||||||
##* aliases *##
|
|
||||||
# {{{
|
|
||||||
|
|
||||||
|
#+* aliases *+#
|
||||||
# core utils (ls, grep, tree)
|
# core utils (ls, grep, tree)
|
||||||
alias l="ls ${LS_OPTS}"
|
alias l="ls ${LS_OPTS}"
|
||||||
alias ls="ls ${LS_OPTS}"
|
alias ls="ls ${LS_OPTS}"
|
||||||
@ -46,33 +45,21 @@ alias la="ls -Alsh ${LS_OPTS}"
|
|||||||
alias al="ls -A ${LS_OPTS}"
|
alias al="ls -A ${LS_OPTS}"
|
||||||
alias sl="ls -lsSh ${LS_OPTS}"
|
alias sl="ls -lsSh ${LS_OPTS}"
|
||||||
alias sal="ls -AlsSh ${LS_OPTS}"
|
alias sal="ls -AlsSh ${LS_OPTS}"
|
||||||
|
|
||||||
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}"
|
||||||
|
|
||||||
alias treel="tree -C | less -R"
|
alias treel="tree -C | less -R"
|
||||||
alias lsmnt="mount | column -t"
|
alias lsmnt="mount | column -t"
|
||||||
|
|
||||||
alias pathls='printf "%b\n" "${PATH//:/\\n}"'
|
alias pathls='printf "%b\n" "${PATH//:/\\n}"'
|
||||||
|
|
||||||
# (git - vim - tmux)
|
# (git - vim - tmux)
|
||||||
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 ".")"
|
||||||
|
|
||||||
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
|
||||||
alias tmka="tmux kill-server" # aka killall
|
alias tmka="tmux kill-server" # aka killall
|
||||||
|
|
||||||
# docker
|
|
||||||
alias d="docker"
|
|
||||||
alias dc="docker-compose"
|
|
||||||
|
|
||||||
# kubernetes
|
|
||||||
alias k="kubectl"
|
|
||||||
alias mink="minikube"
|
|
||||||
|
|
||||||
# python
|
# python
|
||||||
# python3 is python unless python is already python3
|
# python3 is python unless python is already python3
|
||||||
if ! command -v python &> /dev/null && command -v python3 &> /dev/null; then
|
if ! command -v python &> /dev/null && command -v python3 &> /dev/null; then
|
||||||
@ -83,16 +70,12 @@ fi
|
|||||||
alias venvac="source venv/bin/activate"
|
alias venvac="source venv/bin/activate"
|
||||||
alias mkvenv="python -m venv venv"
|
alias mkvenv="python -m venv venv"
|
||||||
|
|
||||||
|
|
||||||
# compression/archives
|
# compression/archives
|
||||||
alias untar="tar -xvf"
|
alias untar="tar -xvf"
|
||||||
alias mktar="tar -caf"
|
alias mktar="tar -caf"
|
||||||
alias tarls="tar -tvf"
|
alias tarls="tar -tvf"
|
||||||
alias ungzip="gunzip"
|
alias ungzip="gunzip"
|
||||||
# }}}
|
|
||||||
|
|
||||||
##* color variables *##
|
|
||||||
#{{{
|
|
||||||
# color vars using tput or ANSI/VT100 Control sequences
|
# color vars using tput or ANSI/VT100 Control sequences
|
||||||
# check if tput is available
|
# check if tput is available
|
||||||
if [ -x "$(command -v tput)" ]; then
|
if [ -x "$(command -v tput)" ]; then
|
||||||
@ -141,10 +124,9 @@ else # or fallback to ANSI esacpe codes
|
|||||||
reset="\[\033[0m\]"; unesc_reset="\033[0m"
|
reset="\[\033[0m\]"; unesc_reset="\033[0m"
|
||||||
bold="\[\033[1m\]"; unesc_bold="\033[1m"
|
bold="\[\033[1m\]"; unesc_bold="\033[1m"
|
||||||
fi
|
fi
|
||||||
#}}}
|
|
||||||
|
|
||||||
##* bash functions *##
|
#+* bash functions *+#
|
||||||
# {{{
|
|
||||||
# concat common commands
|
# concat common commands
|
||||||
mkcd() { mkdir -p -- "$1" && cd "$1"; }
|
mkcd() { mkdir -p -- "$1" && cd "$1"; }
|
||||||
cdd() { [ -n "$1" ] && for i in $(seq 1 "$1"); do cd ..; done; }
|
cdd() { [ -n "$1" ] && for i in $(seq 1 "$1"); do cd ..; done; }
|
||||||
@ -158,13 +140,6 @@ lg() {
|
|||||||
lazygit "$*";
|
lazygit "$*";
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim
|
|
||||||
swp_vimrc(){
|
|
||||||
mv ~/.vim/vimrc ~/.vim/vimrc.swp
|
|
||||||
mv ~/.vim/vimrc.min ~/.vim/vimrc
|
|
||||||
mv ~/.vim/vimrc.swp ~/.vim/vimrc.min
|
|
||||||
}
|
|
||||||
|
|
||||||
# tmux
|
# tmux
|
||||||
tm() {
|
tm() {
|
||||||
if [ "$#" -gt 0 ]; then
|
if [ "$#" -gt 0 ]; then
|
||||||
@ -269,13 +244,10 @@ watip() {
|
|||||||
curl ifconfig.co
|
curl ifconfig.co
|
||||||
# dig +short myip.opendns.com @resolver1.opendns.com
|
# dig +short myip.opendns.com @resolver1.opendns.com
|
||||||
}
|
}
|
||||||
#}}}
|
|
||||||
|
|
||||||
##* prompt settings (PS1) *##
|
#+* prompt settings (PS1) *+#
|
||||||
# {{{
|
|
||||||
|
|
||||||
# git prompt function
|
# git prompt function
|
||||||
# {{{
|
|
||||||
parse_git() {
|
parse_git() {
|
||||||
BRANCH="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)"
|
BRANCH="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)"
|
||||||
STATUS="$(git status 2> /dev/null)"
|
STATUS="$(git status 2> /dev/null)"
|
||||||
@ -296,7 +268,6 @@ parse_git() {
|
|||||||
printf "\001${unesc_reset}${unesc_bold}${unesc_white}\002%s" "]"
|
printf "\001${unesc_reset}${unesc_bold}${unesc_white}\002%s" "]"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# }}}
|
|
||||||
|
|
||||||
# *plain prompts*
|
# *plain prompts*
|
||||||
# PS1="\W \\$ "
|
# PS1="\W \\$ "
|
||||||
@ -312,10 +283,9 @@ PS1="${bold}${bright_blue}\w\$(parse_git)${white} \\$ ${reset}"
|
|||||||
# PS1="${bold}${white}\t ${bright_blue}\w\$(parse_git) ${white}\\$ ${reset}"
|
# PS1="${bold}${white}\t ${bright_blue}\w\$(parse_git) ${white}\\$ ${reset}"
|
||||||
# PS1="${bold}${bright_cyan}\u${bright_magenta}@${bright_yellow}\h${white}:${bright_blue}\w\$(parse_git)${white}\\$ ${reset}"
|
# PS1="${bold}${bright_cyan}\u${bright_magenta}@${bright_yellow}\h${white}:${bright_blue}\w\$(parse_git)${white}\\$ ${reset}"
|
||||||
# PS1="${bold}${bright_cyan}\u${bright_magenta}@${bright_yellow}\h${white}:${bright_blue}\w\$(parse_git)${white}\\$ ${reset}"
|
# PS1="${bold}${bright_cyan}\u${bright_magenta}@${bright_yellow}\h${white}:${bright_blue}\w\$(parse_git)${white}\\$ ${reset}"
|
||||||
# }}}
|
|
||||||
|
|
||||||
##* bash completions and integrations *##
|
##* bash completions and integrations *##
|
||||||
# {{{
|
|
||||||
# bash autocompletion
|
# bash autocompletion
|
||||||
if ! shopt -oq posix; then
|
if ! shopt -oq posix; then
|
||||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||||
@ -331,11 +301,9 @@ fi
|
|||||||
# fzf shell integration
|
# fzf shell integration
|
||||||
export FZF_DEFAULT_OPTS="--bind=ctrl-f:page-down,ctrl-b:page-up"
|
export FZF_DEFAULT_OPTS="--bind=ctrl-f:page-down,ctrl-b:page-up"
|
||||||
[ -f "~/.config/.fzf.bash" ] && source "~/.config/.fzf.bash"
|
[ -f "~/.config/.fzf.bash" ] && source "~/.config/.fzf.bash"
|
||||||
# }}}
|
|
||||||
|
|
||||||
##* paths *##
|
#+* paths *+#
|
||||||
# language version managers
|
# language version managers
|
||||||
# {{{
|
|
||||||
# ruby (rbenv)
|
# ruby (rbenv)
|
||||||
src_rbenv(){
|
src_rbenv(){
|
||||||
if command -v ruby &> /dev/null && command -v gem > /dev/null; then
|
if command -v ruby &> /dev/null && command -v gem > /dev/null; then
|
||||||
@ -388,10 +356,8 @@ fi
|
|||||||
|
|
||||||
# rust
|
# rust
|
||||||
[ -d "$HOME/.cargo" ] && appendpath "$HOME/.cargo/bin"
|
[ -d "$HOME/.cargo" ] && appendpath "$HOME/.cargo/bin"
|
||||||
#}}}
|
|
||||||
|
|
||||||
##* OS specific config *##
|
#+* OS specific config *+#
|
||||||
# {{{
|
|
||||||
case "$OSTYPE" in
|
case "$OSTYPE" in
|
||||||
darwin*)
|
darwin*)
|
||||||
# homebrew
|
# homebrew
|
||||||
@ -409,13 +375,11 @@ case "$OSTYPE" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# local bins
|
# local bins
|
||||||
[ -d "$HOME/.local/bin" ] && appendpath "$HOME/.local/bin"
|
[ -d "$HOME/.local/bin" ] && appendpath "$HOME/.local/bin"
|
||||||
[ -d "$HOME/.local/scripts" ] && appendpath "$HOME/.local/scripts"
|
[ -d "$HOME/.local/scripts" ] && appendpath "$HOME/.local/scripts"
|
||||||
|
|
||||||
# local rc
|
# local rc
|
||||||
[ -r "$HOME/.local/.bashrc" ] && source "$HOME/.local/.bashrc"
|
[ -r "$HOME/.local/.bashrc" ] && source "$HOME/.local/.bashrc"
|
||||||
#}}}
|
|
||||||
|
|
||||||
# vim:ft=sh
|
# vim:ft=sh
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user