Created
March 5, 2012 04:30
-
-
Save arturopie/1976632 to your computer and use it in GitHub Desktop.
some bash/zsh useful functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add an "alert" alias for long running commands. Use like so: | |
# sleep 10; alert | |
alias alert='notify-send --urgency=low --hint int:transient:1 -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' | |
# to use no fast-forward by deafult | |
function git() { | |
if [[ $@ == merge* ]]; then | |
if [[ $@ == *--no-ff* ]]; then | |
command git "$@" | |
return | |
fi | |
if [[ $@ == *--ff* ]]; then | |
command git "$@" | |
else | |
command git "$@" --no-ff | |
fi | |
else | |
command git "$@" | |
fi | |
} | |
# to avoid locking the terminal when opining emacs, emacsclient, or evince | |
function emacs() { | |
if [[ $@ == *-nw* ]]; then | |
command emacs "$@" | |
else | |
command emacs "$@" & | |
fi | |
} | |
function emacsclient() { | |
if [[ $@ == *-nw* ]]; then | |
command emacsclient "$@" | |
else | |
command emacsclient "$@" & | |
fi | |
} | |
function evince() { | |
command evince "$@" & | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment