shorten functions

This commit is contained in:
James Dixon 2020-05-18 22:57:11 -04:00
parent 0b64b275a8
commit c207896ec7

View File

@ -37,16 +37,6 @@ alias al='ls -A ${LS_OPTS}'
alias sl='ls -lsSh ${LS_OPTS}'
alias sal='ls -AlsSh ${LS_OPTS}'
# cd
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias ..2='cd ../..'
alias ..3='cd ../../..'
alias ..4='cd ../../../..'
alias ..5='cd ../../../../..'
# grep
alias grep='grep ${GREP_OPTS}'
alias fgrep='fgrep ${GREP_OPTS}'
@ -74,27 +64,16 @@ alias venvac='source venv/bin/activate'
#========== FUNCTIONS ==========#
# common commands used together
cl() {
builtin cd -P "$@" && ls -alshF
}
mkcd() {
mkdir -p -- "$1" && cd "$1"
}
touchx() {
touch "$@" && chmod +x "$@"
}
# common commands improved
cll() { cd -P "$@" && ls -alshF; }
cls() { cd -P "$@" && ls; }
mkcd() { mkdir -p -- "$1" && cd "$1"; }
cdd() { [ -n "$1" ] && for i in $(seq 1 "$1"); do cd ..; done; }
touchx() { touch "$@" && chmod +x "$@"; }
# git
lazygit() {
git commit -a -m "$*" && git push
}
lg() {
lazygit "$*"
}
lazygit() { git commit -a -m "$*" && git push; }
lg() { lazygit "$*"; }
# git prompt functions
parse_git() {
@ -173,7 +152,6 @@ bkup() {
# 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\]\$ "
# ***non git prompts***
# 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\]"
@ -184,21 +162,19 @@ bkup() {
# PS1="\u@\h:\w$ "
#========== COLORS REFERENCE ==========#
# COLORS according to (ANSI/VT100 Control sequences)
# https://misc.flogisoft.com/bash/tip_colors_and_formatting for examples
# \[\033[0;30m\] BLACK \[\033[1;30m\] DARK GREY
# \[\033[0;31m\] RED \[\033[1;31m\] LIGHT RED
# \[\033[0;32m\] GREEN \[\033[1;32m\] LIGHT GREEN
# \[\033[0;33m\] BROWN \[\033[1;33m\] YELLOW
# \[\033[0;34m\] BLUE \[\033[1;34m\] LIGHT BLUE
# \[\033[0;35m\] PURPLE \[\033[1;35m\] LIGHT PURPLE
# \[\033[0;36m\] CYAN \[\033[1;36m\] LIGHT CYAN
# \[\033[0;37m\] LIGHT GREY \[\033[1;37m\] WHITE
# \[\033[0m\] RESET NORMAL
# \[\033[1m\] RESET BOLD
# \[\033[0;30m\] BLACK \[\033[1;30m\] DARK_GREY
# \[\033[0;31m\] RED \[\033[1;31m\] LIGHT_RED
# \[\033[0;32m\] GREEN \[\033[1;32m\] LIGHT_GREEN
# \[\033[0;33m\] BROWN \[\033[1;33m\] YELLOW
# \[\033[0;34m\] BLUE \[\033[1;34m\] LIGHT_BLUE
# \[\033[0;35m\] PURPLE \[\033[1;35m\] LIGHT_PURPLE
# \[\033[0;36m\] CYAN \[\033[1;36m\] LIGHT_CYAN
# \[\033[0;37m\] LIGHT_GREY \[\033[1;37m\] WHITE
# \[\033[0m\] RESET NORMAL
# \[\033[1m\] RESET BOLD
#========== BASH AUTOCOMPLETION ==========#