From 350a07b0a8525645671a029621cc873b2a8d1957 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 9 Feb 2016 14:16:10 +0100 Subject: Fixed oh-my-zsh --- .gitmodules | 3 --- functions/_boom | 29 ----------------------- functions/_brew | 65 --------------------------------------------------- functions/_c | 5 ---- functions/_git-rm | 7 ------ functions/c | 24 ------------------- functions/extract | 27 --------------------- functions/gf | 4 ---- zsh/config.zsh | 4 ++-- zsh/fpath.zsh | 2 +- zsh/functions/_boom | 29 +++++++++++++++++++++++ zsh/functions/_brew | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ zsh/functions/_c | 5 ++++ zsh/functions/_git-rm | 7 ++++++ zsh/functions/c | 24 +++++++++++++++++++ zsh/functions/extract | 27 +++++++++++++++++++++ zsh/functions/gf | 4 ++++ zsh/oh-my-zsh | 1 - zsh/zshrc.symlink | 51 ++++++++++++++-------------------------- 19 files changed, 181 insertions(+), 202 deletions(-) delete mode 100644 functions/_boom delete mode 100644 functions/_brew delete mode 100644 functions/_c delete mode 100644 functions/_git-rm delete mode 100644 functions/c delete mode 100644 functions/extract delete mode 100644 functions/gf create mode 100644 zsh/functions/_boom create mode 100644 zsh/functions/_brew create mode 100644 zsh/functions/_c create mode 100644 zsh/functions/_git-rm create mode 100644 zsh/functions/c create mode 100644 zsh/functions/extract create mode 100644 zsh/functions/gf delete mode 160000 zsh/oh-my-zsh diff --git a/.gitmodules b/.gitmodules index d4d7847..7daa9fc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,6 @@ [submodule "bin/a5999026fc2abcac4cec"] path = bin/a5999026fc2abcac4cec url = https://gist.github.com/a5999026fc2abcac4cec.git -[submodule "zsh/oh-my-zsh"] - path = zsh/oh-my-zsh - url = https://github.com/robbyrussell/oh-my-zsh [submodule "fonts"] path = fonts url = https://github.com/powerline/fonts diff --git a/functions/_boom b/functions/_boom deleted file mode 100644 index 74e5d4e..0000000 --- a/functions/_boom +++ /dev/null @@ -1,29 +0,0 @@ -#compdef boom - -local state line cmds ret=1 - -_arguments -C '1: :->cmds' '*: :->args' - -case $state in - cmds) - local -a cmds - cmds=( - 'all:show all items in all lists' - 'edit:edit the boom JSON file in $EDITOR' - 'help:help text' - ) - _describe -t commands 'boom command' cmds && ret=0 - _values 'lists' $(boom | awk '{print $1}') - ;; - args) - case $line[1] in - (boom|all|edit|help) - ;; - *) - _values 'items' `boom $line[1] | awk '{print $1}' | sed -e 's/://'` 2>/dev/null && ret=0 - ;; - esac - ;; -esac - -return ret diff --git a/functions/_brew b/functions/_brew deleted file mode 100644 index 8ba6889..0000000 --- a/functions/_brew +++ /dev/null @@ -1,65 +0,0 @@ -#compdef brew - -# Brew ZSH completion function -# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions) -# and rename it _brew -# -# altered from _fink - -_brew_all_formulae() { - formulae=(`brew search`) -} - -_brew_installed_formulae() { - installed_formulae=(`brew list`) -} - -local -a _1st_arguments -_1st_arguments=( - 'install:install a formula' - 'remove:remove a formula' - 'search:search for a formula (/regex/ or string)' - 'list:list files in a formula or not-installed formulae' - 'link:link a formula' - 'unlink:unlink a formula' - 'home:visit the homepage of a formula or the brew project' - 'info:information about a formula' - 'prune:remove dead links' - 'update:freshen up links' - 'log:git commit log for a formula' - 'create:create a new formula' - 'edit:edit a formula' -) - -local expl -local -a formula installed_formulae - -_arguments \ - '(-v --verbose)'{-v,--verbose}'[verbose]' \ - '(--version)--version[version information]' \ - '(--prefix)--prefix[where brew lives on this system]' \ - '(--cache)--cache[brew cache]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "brew subcommand" _1st_arguments - return -fi - -case "$words[1]" in - list) - _arguments \ - '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ - '1: :->forms' && return 0 - - if [[ "$state" == forms ]]; then - _brew_installed_formulae - _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae - fi ;; - install|home|log|info) - _brew_all_formulae - _wanted formulae expl 'all formulae' compadd -a formulae ;; - remove|edit|xo) - _brew_installed_formulae - _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; -esac diff --git a/functions/_c b/functions/_c deleted file mode 100644 index 39d8cb8..0000000 --- a/functions/_c +++ /dev/null @@ -1,5 +0,0 @@ -#compdef c -_files -W $PROJECTS -/ -_files -W $GOPATH/src/github.com -/ - -# See further documentation in `functions/c`. diff --git a/functions/_git-rm b/functions/_git-rm deleted file mode 100644 index a10baf9..0000000 --- a/functions/_git-rm +++ /dev/null @@ -1,7 +0,0 @@ -#compdef git-rm -_arguments -S -A '-*' \ - '-f[override the up-to-date check]' \ - "-n[don't actually remove the files, just show if they exist in the index]" \ - '-r[allow recursive removal when a leading directory-name is given]' \ - '--cached[only remove files from the index]' && ret=0 -_files diff --git a/functions/c b/functions/c deleted file mode 100644 index 486a3c6..0000000 --- a/functions/c +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/zsh -# -# This lets you quickly jump into a project directory. -# -# Type: -# -# c -# -# ...to autocomplete on all of your projects in the directories specified in -# `functions/_c`. Typically I'm using it like: -# -# c holm/bo -# -# ...to quickly jump into holman/boom, for example. -# -# This also accounts for how Go structures its projects. For example, it will -# autocomplete both on $PROJECTS, and also assume you want to autocomplete on -# your Go projects in $GOPATH/src. - -if [ ! -z "$1" ] && [ -s "$GOPATH/src/github.com/$1" ]; then - cd "$GOPATH/src/github.com/$1" -else - cd "$PROJECTS/$1" -fi diff --git a/functions/extract b/functions/extract deleted file mode 100644 index 018d569..0000000 --- a/functions/extract +++ /dev/null @@ -1,27 +0,0 @@ -# credit: http://nparikh.org/notes/zshrc.txt -# Usage: extract -# Description: extracts archived files / mounts disk images -# Note: .dmg/hdiutil is Mac OS X-specific. -extract () { - if [ -f $1 ]; then - case $1 in - *.tar.bz2) tar -jxvf $1 ;; - *.tar.gz) tar -zxvf $1 ;; - *.bz2) bunzip2 $1 ;; - *.dmg) hdiutil mount $1 ;; - *.gz) gunzip $1 ;; - *.tar) tar -xvf $1 ;; - *.tbz2) tar -jxvf $1 ;; - *.tgz) tar -zxvf $1 ;; - *.zip) unzip $1 ;; - *.ZIP) unzip $1 ;; - *.pax) cat $1 | pax -r ;; - *.pax.Z) uncompress $1 --stdout | pax -r ;; - *.Z) uncompress $1 ;; - *) echo "'$1' cannot be extracted/mounted via extract()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - diff --git a/functions/gf b/functions/gf deleted file mode 100644 index 0de3e89..0000000 --- a/functions/gf +++ /dev/null @@ -1,4 +0,0 @@ -gf() { - local branch=$1 - git checkout -b $branch origin/$branch -} \ No newline at end of file diff --git a/zsh/config.zsh b/zsh/config.zsh index bdf8f98..25fae5f 100644 --- a/zsh/config.zsh +++ b/zsh/config.zsh @@ -7,9 +7,9 @@ fi export LSCOLORS="exfxcxdxbxegedabagacad" export CLICOLOR=true -fpath=($ZSH/functions $fpath) +fpath=($DOTFILES/zsh/functions $fpath) -autoload -U $ZSH/functions/*(:t) +autoload -U $DOTFILES/zsh/functions/*(:t) HISTFILE=~/.zsh_history HISTSIZE=10000 diff --git a/zsh/fpath.zsh b/zsh/fpath.zsh index eaff4f4..b450c26 100644 --- a/zsh/fpath.zsh +++ b/zsh/fpath.zsh @@ -1,2 +1,2 @@ #add each topic folder to fpath so that they can add functions and completion scripts -for topic_folder ($ZSH/*) if [ -d $topic_folder ]; then fpath=($topic_folder $fpath); fi; +for topic_folder ($DOTFILES/zsh/*) if [ -d $topic_folder ]; then fpath=($topic_folder $fpath); fi; diff --git a/zsh/functions/_boom b/zsh/functions/_boom new file mode 100644 index 0000000..74e5d4e --- /dev/null +++ b/zsh/functions/_boom @@ -0,0 +1,29 @@ +#compdef boom + +local state line cmds ret=1 + +_arguments -C '1: :->cmds' '*: :->args' + +case $state in + cmds) + local -a cmds + cmds=( + 'all:show all items in all lists' + 'edit:edit the boom JSON file in $EDITOR' + 'help:help text' + ) + _describe -t commands 'boom command' cmds && ret=0 + _values 'lists' $(boom | awk '{print $1}') + ;; + args) + case $line[1] in + (boom|all|edit|help) + ;; + *) + _values 'items' `boom $line[1] | awk '{print $1}' | sed -e 's/://'` 2>/dev/null && ret=0 + ;; + esac + ;; +esac + +return ret diff --git a/zsh/functions/_brew b/zsh/functions/_brew new file mode 100644 index 0000000..8ba6889 --- /dev/null +++ b/zsh/functions/_brew @@ -0,0 +1,65 @@ +#compdef brew + +# Brew ZSH completion function +# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions) +# and rename it _brew +# +# altered from _fink + +_brew_all_formulae() { + formulae=(`brew search`) +} + +_brew_installed_formulae() { + installed_formulae=(`brew list`) +} + +local -a _1st_arguments +_1st_arguments=( + 'install:install a formula' + 'remove:remove a formula' + 'search:search for a formula (/regex/ or string)' + 'list:list files in a formula or not-installed formulae' + 'link:link a formula' + 'unlink:unlink a formula' + 'home:visit the homepage of a formula or the brew project' + 'info:information about a formula' + 'prune:remove dead links' + 'update:freshen up links' + 'log:git commit log for a formula' + 'create:create a new formula' + 'edit:edit a formula' +) + +local expl +local -a formula installed_formulae + +_arguments \ + '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(--version)--version[version information]' \ + '(--prefix)--prefix[where brew lives on this system]' \ + '(--cache)--cache[brew cache]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "brew subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + _arguments \ + '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ + '1: :->forms' && return 0 + + if [[ "$state" == forms ]]; then + _brew_installed_formulae + _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae + fi ;; + install|home|log|info) + _brew_all_formulae + _wanted formulae expl 'all formulae' compadd -a formulae ;; + remove|edit|xo) + _brew_installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; +esac diff --git a/zsh/functions/_c b/zsh/functions/_c new file mode 100644 index 0000000..39d8cb8 --- /dev/null +++ b/zsh/functions/_c @@ -0,0 +1,5 @@ +#compdef c +_files -W $PROJECTS -/ +_files -W $GOPATH/src/github.com -/ + +# See further documentation in `functions/c`. diff --git a/zsh/functions/_git-rm b/zsh/functions/_git-rm new file mode 100644 index 0000000..a10baf9 --- /dev/null +++ b/zsh/functions/_git-rm @@ -0,0 +1,7 @@ +#compdef git-rm +_arguments -S -A '-*' \ + '-f[override the up-to-date check]' \ + "-n[don't actually remove the files, just show if they exist in the index]" \ + '-r[allow recursive removal when a leading directory-name is given]' \ + '--cached[only remove files from the index]' && ret=0 +_files diff --git a/zsh/functions/c b/zsh/functions/c new file mode 100644 index 0000000..486a3c6 --- /dev/null +++ b/zsh/functions/c @@ -0,0 +1,24 @@ +#!/bin/zsh +# +# This lets you quickly jump into a project directory. +# +# Type: +# +# c +# +# ...to autocomplete on all of your projects in the directories specified in +# `functions/_c`. Typically I'm using it like: +# +# c holm/bo +# +# ...to quickly jump into holman/boom, for example. +# +# This also accounts for how Go structures its projects. For example, it will +# autocomplete both on $PROJECTS, and also assume you want to autocomplete on +# your Go projects in $GOPATH/src. + +if [ ! -z "$1" ] && [ -s "$GOPATH/src/github.com/$1" ]; then + cd "$GOPATH/src/github.com/$1" +else + cd "$PROJECTS/$1" +fi diff --git a/zsh/functions/extract b/zsh/functions/extract new file mode 100644 index 0000000..018d569 --- /dev/null +++ b/zsh/functions/extract @@ -0,0 +1,27 @@ +# credit: http://nparikh.org/notes/zshrc.txt +# Usage: extract +# Description: extracts archived files / mounts disk images +# Note: .dmg/hdiutil is Mac OS X-specific. +extract () { + if [ -f $1 ]; then + case $1 in + *.tar.bz2) tar -jxvf $1 ;; + *.tar.gz) tar -zxvf $1 ;; + *.bz2) bunzip2 $1 ;; + *.dmg) hdiutil mount $1 ;; + *.gz) gunzip $1 ;; + *.tar) tar -xvf $1 ;; + *.tbz2) tar -jxvf $1 ;; + *.tgz) tar -zxvf $1 ;; + *.zip) unzip $1 ;; + *.ZIP) unzip $1 ;; + *.pax) cat $1 | pax -r ;; + *.pax.Z) uncompress $1 --stdout | pax -r ;; + *.Z) uncompress $1 ;; + *) echo "'$1' cannot be extracted/mounted via extract()" ;; + esac + else + echo "'$1' is not a valid file" + fi +} + diff --git a/zsh/functions/gf b/zsh/functions/gf new file mode 100644 index 0000000..0de3e89 --- /dev/null +++ b/zsh/functions/gf @@ -0,0 +1,4 @@ +gf() { + local branch=$1 + git checkout -b $branch origin/$branch +} \ No newline at end of file diff --git a/zsh/oh-my-zsh b/zsh/oh-my-zsh deleted file mode 160000 index 15d52fd..0000000 --- a/zsh/oh-my-zsh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 15d52fd4fbabda6c3c9fad80cb4378478d86a40b diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink index 87c5ace..9e1d5d2 100644 --- a/zsh/zshrc.symlink +++ b/zsh/zshrc.symlink @@ -1,44 +1,27 @@ -# shortcut to this dotfiles path is $ZSH -export ZSH=$HOME/dotfiles - -# your project folder that we can `c [tab]` to -export PROJECTS=~/VersionControl - -# Stash your environment variables in ~/.localrc. This means they'll stay out -# of your main dotfiles repository (which may be public, like this one), but -# you'll have access to them in your scripts. -if [[ -a ~/.localrc ]] -then - source ~/.localrc +export DOTFILES=$HOME/dotfiles +export ZSH=$HOME/.oh-my-zsh +export PROJECTS=$HOME/VersionControl + +if [[ -a ~/.localrc ]]; then + source ~/.localrc fi -# all of our zsh files -typeset -U config_files -config_files=($ZSH/**/*.zsh) +for config_file ($DOTFILES/**/*.zsh) source $config_file -# load the path files -for file in ${(M)config_files:#*/path.zsh} -do - source $file -done +ZSH_THEME="agnoster" +plugins=(git) +source $ZSH/oh-my-zsh.sh -# load everything but the path and completion files -for file in ${${config_files:#*/path.zsh}:#*/completion.zsh} -do - source $file -done +source $HOME/.profile + +unsetopt ignoreeof -# initialize autocomplete here, otherwise functions won't be loaded autoload -U compinit compinit -# load every completion after autocomplete loads -for file in ${(M)config_files:#*/completion.zsh} -do - source $file +for config_file ($DOTFILES/**/completion.zsh); do + if test -f $config_file; then + source $config_file + fi done -unset config_files - -### Oh-my-zsh -ZSH_THEME="agnoster" -- cgit v1.2.3