Added some completion scripts and updated some zsh config

This commit is contained in:
Nick Nisi
2012-07-03 09:42:18 -05:00
parent e23ce75e4e
commit 7ef38eba7c
9 changed files with 25 additions and 4 deletions

5
git/completion.sh Normal file
View File

@@ -0,0 +1,5 @@
completion=/usr/local/etc/bash_completion.d/git-completion.bash
if test -f $completion; then
source $completion
fi

View File

@@ -15,9 +15,10 @@ alias grn='git_rename'
alias glog="git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
alias sub-pull='git submodule foreach git pull origin master'
# a simple git rename file function
# git does not track case-sensitive changes to a filename.
function git_rename() {
function git-rename() {
git mv $1 "${2}-"
git mv "${2}-" $2
}

View File

@@ -1,3 +1,6 @@
# reload zsh config
alias reload!='source ~/.zshrc'
# Filesystem aliases
alias ..='cd ..'
alias ...='cd ../..'

View File

@@ -27,3 +27,6 @@ bindkey '^[[5C' end-of-line
bindkey '^[[3~' delete-char
bindkey '^[^N' newtab
bindkey '^?' backward-delete-char
fpath=($ZSH/zsh/functions $fpath)
autoload -U $ZSH/zsh/functions/*(:t)

2
zsh/functions/_c Normal file
View File

@@ -0,0 +1,2 @@
#compdef c
_files -W $PROJECTS -/

1
zsh/functions/c Normal file
View File

@@ -0,0 +1 @@
cd $PROJECTS/$1

View File

@@ -0,0 +1 @@
ls -t $* 2> /dev/null | head -n 1

View File

@@ -0,0 +1,5 @@
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' group-name ''

View File

@@ -1,5 +1,7 @@
export ZSH=$HOME/.dotfiles
export PROJECTS=~/projects
if [[ -d ~/gitprojects ]]; then
export PROJECTS=~/gitprojects
else
@@ -13,14 +15,12 @@ if [[ -a ~/.localrc ]]; then
source ~/.localrc
fi
# reload zsh config
alias reload!='source ~/.zshrc'
# initialize autocomplete
autoload -U compinit
compinit
# for config ($ZSH/**/completion.sh) source $config
for config ($ZSH/**/completion.sh) source $config
export EDITOR='vim'