Fix completion for alias functions

This commit is contained in:
Henrik Lissner 2015-12-09 01:12:30 -05:00
parent 8edeca8eaa
commit acde04b61f
3 changed files with 8 additions and 3 deletions

View file

@ -15,9 +15,10 @@ alias ln="ln -v" # Verbose ln
alias wget='wget -c' # Resume dl if possible alias wget='wget -c' # Resume dl if possible
alias rsyncd='rsync -va --delete' # Hard sync two directories alias rsyncd='rsync -va --delete' # Hard sync two directories
alias mkdir='mkdir -p' alias mkdir='mkdir -p'
mkd() { mkdir "$1" && cd "$1"; }
zman() { PAGER="less -g -s '+/^ "$1"'" man zshall; }
alias gurl='curl --compressed' alias gurl='curl --compressed'
zman() { PAGER="less -g -s '+/^ "$1"'" man zshall; }
take() { mkdir "$1" && cd "$1"; }
compdef take=mkdir
alias ip="dig +short myip.opendns.com @resolver1.opendns.com" alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en0" alias localip="ipconfig getifaddr en0"
@ -96,6 +97,7 @@ alias exe='exercism'
# GIT # GIT
is-callable 'hub' && alias git='hub' is-callable 'hub' && alias git='hub'
g() { [ $# -eq 0 ] && git status --short || git $* } g() { [ $# -eq 0 ] && git status --short || git $* }
compdef _git g=git
alias gi='git init' alias gi='git init'
alias gs='git status' alias gs='git status'
@ -163,3 +165,4 @@ alias p='pbpaste'
# By default, open cwd # By default, open cwd
o() { open ${@:-.}; } o() { open ${@:-.}; }
compdef o=open

View file

@ -5,6 +5,7 @@
autoload -Uz compinit && compinit -i autoload -Uz compinit && compinit -i
## Options ## Options
setopt COMPLETE_ALIASES # Complete from both ends of a word.
setopt COMPLETE_IN_WORD # Complete from both ends of a word. setopt COMPLETE_IN_WORD # Complete from both ends of a word.
setopt ALWAYS_TO_END # Move cursor to the end of a completed word. setopt ALWAYS_TO_END # Move cursor to the end of a completed word.
setopt PATH_DIRS # Perform path search even on command names with slashes. setopt PATH_DIRS # Perform path search even on command names with slashes.

3
zshrc
View file

@ -5,7 +5,6 @@
DOTFILES=$HOME/.dotfiles DOTFILES=$HOME/.dotfiles
source $DOTFILES/zsh/functions.zsh source $DOTFILES/zsh/functions.zsh
source $DOTFILES/zsh/aliases.zsh
# if not running through emacs' shell-command # if not running through emacs' shell-command
if [ ! $TERM = dumb ]; then if [ ! $TERM = dumb ]; then
@ -36,6 +35,8 @@ if [ ! $TERM = dumb ]; then
cache fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install cache fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install
fi fi
source $DOTFILES/zsh/aliases.zsh
cache rbenv init - --no-rehash cache rbenv init - --no-rehash
cache pyenv init - --no-rehash cache pyenv init - --no-rehash