diff --git a/git/completion.sh b/git/completion.sh new file mode 100644 index 0000000..147c1c7 --- /dev/null +++ b/git/completion.sh @@ -0,0 +1,5 @@ +completion=/usr/local/etc/bash_completion.d/git-completion.bash + +if test -f $completion; then + source $completion +fi diff --git a/git/git.zsh b/git/git.zsh index 20fab52..6a368ab 100644 --- a/git/git.zsh +++ b/git/git.zsh @@ -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 } diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 289752f..61092fd 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,3 +1,6 @@ +# reload zsh config +alias reload!='source ~/.zshrc' + # Filesystem aliases alias ..='cd ..' alias ...='cd ../..' diff --git a/zsh/config.zsh b/zsh/config.zsh index cefc890..03d5ba2 100644 --- a/zsh/config.zsh +++ b/zsh/config.zsh @@ -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) diff --git a/zsh/functions/_c b/zsh/functions/_c new file mode 100644 index 0000000..9c35f9a --- /dev/null +++ b/zsh/functions/_c @@ -0,0 +1,2 @@ +#compdef c +_files -W $PROJECTS -/ diff --git a/zsh/functions/c b/zsh/functions/c new file mode 100644 index 0000000..13121f7 --- /dev/null +++ b/zsh/functions/c @@ -0,0 +1 @@ +cd $PROJECTS/$1 diff --git a/zsh/functions/last_modified b/zsh/functions/last_modified new file mode 100644 index 0000000..bd996e4 --- /dev/null +++ b/zsh/functions/last_modified @@ -0,0 +1 @@ +ls -t $* 2> /dev/null | head -n 1 diff --git a/zsh/functions/verbose_completion b/zsh/functions/verbose_completion new file mode 100644 index 0000000..8ea1224 --- /dev/null +++ b/zsh/functions/verbose_completion @@ -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 '' diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index 46dad48..53dd035 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -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'