g alias for git
With arguments, g acts like git. Without arguments, it runs `git status`. * Source functions/* after loading ZSH completion so `compdef` is available to g alias
This commit is contained in:
parent
1f4e6d1370
commit
89b60fcb49
3 changed files with 16 additions and 5 deletions
1
aliases
1
aliases
|
@ -14,7 +14,6 @@ alias e="$EDITOR"
|
||||||
alias v="$VISUAL"
|
alias v="$VISUAL"
|
||||||
|
|
||||||
# git
|
# git
|
||||||
alias g="git"
|
|
||||||
alias gci="git pull --rebase && rake && git push"
|
alias gci="git pull --rebase && rake && git push"
|
||||||
|
|
||||||
# Bundler
|
# Bundler
|
||||||
|
|
12
zsh/functions/g
Normal file
12
zsh/functions/g
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# No arguments: `git status`
|
||||||
|
# With arguments: acts like `git`
|
||||||
|
g() {
|
||||||
|
if [[ $# > 0 ]]; then
|
||||||
|
git $@
|
||||||
|
else
|
||||||
|
git status
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Complete g like git
|
||||||
|
compdef g=git
|
8
zshrc
8
zshrc
|
@ -1,14 +1,14 @@
|
||||||
# load our own completion functions
|
# load our own completion functions
|
||||||
fpath=(~/.zsh/completion $fpath)
|
fpath=(~/.zsh/completion $fpath)
|
||||||
|
|
||||||
for function in ~/.zsh/functions/*; do
|
|
||||||
source $function
|
|
||||||
done
|
|
||||||
|
|
||||||
# completion
|
# completion
|
||||||
autoload -U compinit
|
autoload -U compinit
|
||||||
compinit
|
compinit
|
||||||
|
|
||||||
|
for function in ~/.zsh/functions/*; do
|
||||||
|
source $function
|
||||||
|
done
|
||||||
|
|
||||||
# automatically enter directories without cd
|
# automatically enter directories without cd
|
||||||
setopt auto_cd
|
setopt auto_cd
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue