From: Simon Ruderich Date: Wed, 29 Aug 2012 16:20:42 +0000 (+0200) Subject: zsh/rc: Create program functions only if the programs are installed. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=73ed8a1af74805e72a81c329fb9fac35b154d600;p=config%2Fdotfiles.git zsh/rc: Create program functions only if the programs are installed. --- diff --git a/zsh/rc b/zsh/rc index ca12596..e34d905 100644 --- a/zsh/rc +++ b/zsh/rc @@ -655,17 +655,17 @@ fi # Display all branches (except stash) in gitk but only 200 commits as this is # much faster. Also put in the background and disown. Thanks to drizzd in #git # on Freenode (2010-04-03 17:55 CEST). -gitk() { +(( $+commands[gitk] )) && gitk() { command gitk --max-count=200 --branches --remotes --tags "$@" & disown %command } # Same for tig (except the disown part as it's no GUI program). -tig() { +(( $+commands[tig] )) && tig() { command tig --max-count=200 --branches --remotes --tags "$@" } # Pipe output through less. -tree() { +(( $+commands[tree] )) && tree() { command tree -C "$@" | less }