├── .gitignore ├── LICENSE ├── README.md ├── cache └── .empty ├── func ├── abspath ├── ask ├── calc ├── cat-sort-unique ├── cdsrc ├── extract ├── fancy-ctrl-z ├── find-replace-all ├── find-replace-recursive ├── history ├── kill-zombies ├── loop ├── lsg ├── mkzwc ├── pk ├── precmd ├── preexec ├── psg ├── qmv-defaults ├── rationalize-dot ├── redo ├── ssh-background ├── ssl-cert-create ├── take ├── tar-ssh-from ├── tar-ssh-to ├── title ├── wclr ├── what-is-my-ip ├── zeesh ├── zeesh-plugin ├── zeesh-plugin-desc ├── zeesh-plugin-enable ├── zeesh-plugin-enabled ├── zeesh-plugin-list ├── zeesh-plugin-new ├── zeesh-plugin-valid └── zeesh-prefs ├── local └── .empty ├── plugins ├── ai │ ├── init │ ├── install │ └── plugin ├── audio │ └── plugin ├── auto-fu │ ├── install │ └── plugin ├── autocomplete │ ├── comp │ │ ├── _ack │ │ ├── _brew │ │ ├── _cake │ │ ├── _cdsrc │ │ ├── _coffee │ │ ├── _gcc-config │ │ ├── _gem │ │ ├── _heroku │ │ ├── _hoodoo │ │ ├── _managepy │ │ ├── _mvn │ │ ├── _node │ │ ├── _pip │ │ ├── _rvm │ │ ├── _sake │ │ ├── _ssh-copy-id │ │ └── _vagrant │ └── plugin ├── autoenv │ └── plugin ├── bebop │ └── plugin ├── clojure │ ├── bin │ │ └── ng-server │ ├── lib │ │ └── server-2.3.1.jar │ └── plugin ├── color-switch │ ├── func │ │ ├── color-switch │ │ └── color-switch-themes │ ├── plugin │ └── themes │ │ ├── desert.theme │ │ ├── eterm.theme │ │ ├── gnome.theme │ │ ├── kind-of-blue.theme │ │ └── warm.theme ├── colors │ └── plugin ├── cygwin │ ├── func │ │ ├── cyg-pkill │ │ ├── cyg-uptime │ │ ├── foobar │ │ ├── precmd │ │ └── preexec │ └── plugin ├── disable-xoff │ └── plugin ├── django │ └── plugin ├── freebsd │ ├── func │ │ └── list_syctls │ └── plugin ├── git │ ├── commands │ │ ├── git-alias │ │ ├── git-branch-by-time │ │ ├── git-changelog │ │ ├── git-changes │ │ ├── git-churn │ │ ├── git-clone-subdir │ │ ├── git-divergence │ │ ├── git-effort │ │ ├── git-ignore │ │ ├── git-info │ │ ├── git-log-fuzzy-file-search │ │ ├── git-promote │ │ ├── git-quick-commit │ │ ├── git-rename-tag │ │ ├── git-repl │ │ ├── git-resolve │ │ ├── git-summary │ │ └── git-unmerged │ ├── comp │ │ └── _hub │ └── plugin ├── go │ └── plugin ├── haskell │ └── plugin ├── history-substring-search │ ├── install │ └── plugin ├── ipython │ └── plugin ├── iterm2 │ └── plugin ├── javascript │ ├── npm.sh │ └── plugin ├── kubernetes │ └── plugin ├── linux │ ├── func │ │ └── ogrep │ └── plugin ├── login-info │ └── plugin ├── lolz │ └── plugin ├── mercurial │ ├── func │ │ └── hgc │ └── plugin ├── nvm │ ├── install │ └── plugin ├── osx │ ├── func │ │ ├── addgroup │ │ ├── adduser │ │ ├── cdf │ │ ├── dashboard-disable │ │ ├── dashboard-enable │ │ ├── font-smoothing │ │ ├── grep-fs-open │ │ ├── hide-in-dock │ │ ├── invisible │ │ ├── isightcap │ │ ├── list-sysctls │ │ ├── mds-disable │ │ ├── mds-enable │ │ ├── ogrep │ │ ├── pman │ │ ├── pwdf │ │ ├── quit │ │ ├── relaunch │ │ ├── screencap │ │ ├── set-hostname │ │ ├── show-all-files │ │ ├── spotlight-disable │ │ ├── spotlight-enable │ │ ├── switch_users │ │ ├── tab │ │ └── zap │ ├── lib │ │ └── make_app │ └── plugin ├── pianobar │ ├── func │ │ └── pianobar-wrapper │ └── plugin ├── python │ ├── comp │ │ └── _cdsp │ ├── func │ │ ├── b64decode │ │ ├── b64encode │ │ ├── cdsp │ │ ├── hexdecode │ │ ├── python-bootstrap │ │ └── urlencode │ └── plugin ├── rails │ └── plugin ├── remote-mvim │ ├── default.prefs │ ├── func │ │ └── remote-mvim │ └── plugin ├── screen │ ├── func │ │ ├── screen-clean │ │ └── screen-kill │ └── plugin ├── share │ ├── func │ │ └── share │ ├── local.conf.example │ └── plugin ├── spaceship │ ├── init │ ├── install │ └── plugin ├── starship │ ├── init │ ├── install │ └── plugin ├── syntax-highlighting │ ├── install │ └── plugin ├── term │ └── plugin ├── theme │ ├── bin │ │ └── emoticon │ ├── bogart.zsh │ ├── colors │ │ ├── green.zsh │ │ ├── magenta.zsh │ │ ├── solace.zsh │ │ └── zen.zsh │ ├── emotifail.zsh │ ├── excess.zsh │ ├── func │ │ └── theme │ ├── hardcore.zsh │ ├── plugin │ ├── pure.zsh │ ├── slim.zsh │ ├── socialist.zsh │ ├── solace.zsh │ ├── vi-statusline-legacy.zsh │ ├── vi-statusline.zsh │ └── zen.zsh ├── upgrade │ ├── do_upgrade.zsh │ └── plugin ├── upstart │ ├── comp │ │ ├── _log │ │ ├── _restart │ │ ├── _start │ │ └── _stop │ ├── func │ │ ├── log │ │ ├── reload │ │ ├── restart │ │ ├── start │ │ └── stop │ ├── init │ │ ├── cassandra │ │ │ ├── start │ │ │ └── stop │ │ ├── couchdb │ │ │ ├── log │ │ │ ├── start │ │ │ └── stop │ │ ├── dnsmasq │ │ │ ├── log │ │ │ ├── start │ │ │ └── stop │ │ ├── memcached │ │ │ ├── log │ │ │ └── start │ │ ├── mongodb │ │ │ ├── log │ │ │ └── start │ │ ├── mysql │ │ │ ├── log │ │ │ ├── start │ │ │ └── stop │ │ ├── nginx │ │ │ ├── log │ │ │ ├── reload │ │ │ ├── start │ │ │ └── stop │ │ ├── php54 │ │ │ ├── log │ │ │ ├── start │ │ │ └── stop │ │ ├── postgresql │ │ │ ├── log │ │ │ ├── start │ │ │ └── stop │ │ ├── redis │ │ │ ├── log │ │ │ ├── start │ │ │ └── stop │ │ └── riak │ │ │ ├── log │ │ │ ├── start │ │ │ └── stop │ └── plugin ├── uwsgi │ ├── default.prefs │ ├── func │ │ └── uwsgi-wrapper │ └── plugin ├── vcs-info │ ├── plugin │ └── style.zsh ├── vi-mode │ ├── func │ │ ├── gvim-wrapper │ │ └── mvim-wrapper │ ├── old.zsh │ └── plugin ├── vi-visual-mode │ ├── install │ └── plugin ├── virtualbox │ ├── comp │ │ └── _vbox-manage │ ├── default.prefs │ ├── func │ │ ├── vbox-manage │ │ ├── vbox-running │ │ ├── vbox-snapshots │ │ └── vbox-vms │ └── plugin ├── virtualenv │ ├── comp │ │ └── _cdv │ ├── func │ │ ├── cdv │ │ ├── ve-activate │ │ ├── ve-deactivate │ │ ├── ve-list │ │ └── ve-newenv │ └── plugin ├── yarn │ ├── install │ └── plugin └── z │ ├── install │ └── plugin ├── scripts └── install.sh └── zeesh.zsh /.gitignore: -------------------------------------------------------------------------------- 1 | local/ 2 | after.zsh 3 | local.zsh 4 | plugins/*/lib 5 | plugins/git/hub 6 | cache/ 7 | *.zwc 8 | *.zwc.old 9 | plugins/kubernetes/comp.zsh 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2014 Zach Kelling 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zeesh! 2 | __ 3 | __ / / 4 | ____ ____ ___ ____/ /_ / / 5 | /_ / / __/ __// __/ __ \ /_/ 6 | / /_/ __/ __/_\ \ / / /__ 7 | /___/___/___/____/_/ /_/__/ 8 | 9 | Zeesh is a cross-platform [Zsh][zsh] framework. It's similar to, but incompatible 10 | with, [oh-my-zsh][oh-my-zsh]. It has a modular plugin architecture making it 11 | easy to extend. It has a rich set of defaults, but is designed to be as 12 | lightweight as possible. 13 | 14 | ## Installation 15 | Clone to `~/.zsh` or use the install script: 16 | 17 | ```sh 18 | curl https://raw.github.com/zeekay/zeesh/master/scripts/install.sh | sh 19 | ``` 20 | 21 | ## Configuration 22 | Specify the plugins you want to use in the `zeesh_plugins` array and source 23 | `~/.zsh/zeesh.zsh`: 24 | 25 | ```sh 26 | zeesh_plugins=( 27 | autocomplete 28 | osx 29 | git 30 | javascript 31 | yarn 32 | vcs-info 33 | syntax-highlighting 34 | history-substring-search 35 | theme 36 | vi-mode 37 | vi-visual-mode 38 | ) 39 | 40 | source ~/.zsh/zeesh.zsh 41 | ``` 42 | 43 | You can enable various features using the available plugins. For a list of available plugins: 44 | 45 | ```sh 46 | ls ~/.zsh/plugins 47 | ``` 48 | 49 | [oh-my-zsh]: https://github.com/robbyrussell/oh-my-zsh 50 | [zsh]: http://www.zsh.org 51 | -------------------------------------------------------------------------------- /cache/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeekay/zeesh/5deaf7b144c238ec9d2d14f0cb5073cbbc5bf292/cache/.empty -------------------------------------------------------------------------------- /func/abspath: -------------------------------------------------------------------------------- 1 | abspath() { 2 | case "${1}" in 3 | [./]*) 4 | local ABSPATH="$(cd ${1%/*}; pwd)/${1##*/}" 5 | echo "${ABSPATH/\/\///}" 6 | ;; 7 | *) 8 | echo "${PWD}/${1}" 9 | ;; 10 | esac 11 | } 12 | 13 | # vim: ft=zsh 14 | -------------------------------------------------------------------------------- /func/ask: -------------------------------------------------------------------------------- 1 | ask(){ 2 | echo -n "$1 \c" 3 | read ans 4 | if [[ $ans[1]:l == 'y' ]]; then 5 | return 0 6 | else 7 | return 1 8 | fi 9 | } 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /func/calc: -------------------------------------------------------------------------------- 1 | calc() { 2 | zmodload zsh/mathfunc 3 | echo $(( $@ )) 4 | } 5 | 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /func/cat-sort-unique: -------------------------------------------------------------------------------- 1 | cat-sort-unique() { 2 | cat $1 | sort | uniq -c | sort -n 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /func/cdsrc: -------------------------------------------------------------------------------- 1 | # switch to src dir 2 | cdsrc() { 3 | if [ $VIRTUAL_ENV ]; then 4 | srcdir=$VIRTUAL_ENV/src 5 | else 6 | srcdir=/usr/local/src 7 | fi 8 | if [ $1 ] && [ "$1" = "--location" ]; then 9 | echo $srcdir 10 | else 11 | cd $srcdir/$1 12 | fi 13 | } 14 | 15 | # vim: ft=zsh 16 | -------------------------------------------------------------------------------- /func/extract: -------------------------------------------------------------------------------- 1 | # Extract archives 2 | extract() { 3 | if [ -f $1 ] ; then 4 | case $1 in 5 | *.tar.bz2) tar xjf $1 ;; 6 | *.tar.gz) tar xzf $1 ;; 7 | *.bz2) bunzip2 $1 ;; 8 | *.rar) rar x $1 ;; 9 | *.gz) gunzip $1 ;; 10 | *.tar) tar xf $1 ;; 11 | *.tbz2) tar xjf $1 ;; 12 | *.tgz) tar xzf $1 ;; 13 | *.zip) unzip $1 ;; 14 | *.Z) uncompress $1 ;; 15 | *.7z) 7z x $1 ;; 16 | *) echo "'$1' cannot be extracted via extract()" ;; 17 | esac 18 | else 19 | echo "'$1' is not a valid file" 20 | fi 21 | } 22 | 23 | # vim: ft=zsh 24 | -------------------------------------------------------------------------------- /func/fancy-ctrl-z: -------------------------------------------------------------------------------- 1 | fancy-ctrl-z() { 2 | if [[ $#BUFFER -eq 0 ]]; then 3 | echo '' 4 | bg 5 | zle redisplay 6 | else 7 | zle push-input 8 | fi 9 | } 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /func/find-replace-all: -------------------------------------------------------------------------------- 1 | find-replace-recursive -------------------------------------------------------------------------------- /func/find-replace-recursive: -------------------------------------------------------------------------------- 1 | # Find and replace text in files recursively. 2 | # 3 | # A couple of notes: 4 | # 1. LC_ALL causes this pattern to ignore unicode characters -- but that's fine 5 | # in the general case I care about. This is an issue on macOS because it 6 | # employs multibyte-on-demand UTF-8 encoding. More info here: 7 | # http://stackoverflow.com/a/23584470/641766 8 | # 2. sed -i.bak is a trick to make sed in-place work on both linux and mac. 9 | # More info: http://stackoverflow.com/a/22084103/641766 10 | find-replace-recursive() { 11 | local pattern="$1" 12 | local numproc 13 | 14 | # Override order: FIND_REPLACE_NUM_PROC > NUM_PROC > auto-detect > default (4) 15 | if [ -n "$FIND_REPLACE_NUM_PROC" ]; then 16 | numproc="$FIND_REPLACE_NUM_PROC" 17 | elif [ -n "$NUM_PROC" ]; then 18 | numproc="$NUM_PROC" 19 | elif command -v nproc >/dev/null 2>&1; then 20 | numproc=$(nproc) 21 | elif [ "$(uname)" = "Darwin" ]; then 22 | numproc=$(sysctl -n hw.ncpu) 23 | else 24 | numproc=4 25 | fi 26 | 27 | # Validate pattern 28 | local err 29 | err=$(echo | sed -e "$pattern" 2>&1 | tail -n 1) 30 | [ -n "$err" ] && { echo "invalid pattern: ${err:3}"; return; } 31 | [ -z "$pattern" ] && { echo "usage: find-replace-recursive s/find/replace/g"; return; } 32 | 33 | # Find text files, ignoring hidden paths and common binary/build dirs, 34 | # then perform in-place replacement using multiple processes. 35 | LC_ALL=C find . -type f \ 36 | ! -path '*/.*' \ 37 | ! -path '*/node_modules/*' \ 38 | ! -path '*/out/*' \ 39 | ! -path '*/dist/*' \ 40 | ! -path '*/build/*' \ 41 | -exec grep -Iq . {} \; -print0 | \ 42 | xargs -0 -P "$numproc" sed -i.sedbak "$pattern" 43 | 44 | # Remove sed backup files 45 | find . -name '*.sedbak' -print0 | xargs -0 -P "$numproc" rm -f 46 | find . -name '.*.sedbak' -print0 | xargs -0 -P "$numproc" rm -f 47 | } 48 | -------------------------------------------------------------------------------- /func/history: -------------------------------------------------------------------------------- 1 | history() { 2 | if [ $1 ]; then 3 | if [[ "$1" == "-a" ]]; then 4 | fc -l 1 5 | else 6 | fc -l 1 | grep $1 7 | fi 8 | else 9 | fc -l -20 10 | fi 11 | } 12 | 13 | # vim: ft=zsh 14 | -------------------------------------------------------------------------------- /func/kill-zombies: -------------------------------------------------------------------------------- 1 | # You cannot kill zombies, as they are already dead. But if you have too many 2 | # zombies then kill parent process or restart service. 3 | kill-zombies() { 4 | kill -HUP `ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}'` 5 | } 6 | 7 | # vim: ft=zsh 8 | -------------------------------------------------------------------------------- /func/loop: -------------------------------------------------------------------------------- 1 | # shorthand for loop, usage: loop 2 | loop() { 3 | for i in {1..$2}; do 4 | echo $1 | sh 5 | done 6 | } 7 | 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /func/lsg: -------------------------------------------------------------------------------- 1 | lsg() { 2 | if [ $1 ]; then 3 | args=($@) 4 | search=$args[-1] 5 | args[-1]=() 6 | [ $args ] || args="-la" 7 | ls $args | grep -i --color=auto $search 8 | unset args search 9 | fi 10 | } 11 | 12 | # vim: ft=zsh 13 | -------------------------------------------------------------------------------- /func/mkzwc: -------------------------------------------------------------------------------- 1 | autoload -U zrecompile 2 | 3 | zrecompile -p \ 4 | -R ~/.zshrc -- \ 5 | -M ~/.zsh/cache/zcompdump -- \ 6 | -R ~/.zsh/zeesh.zsh -- 7 | 8 | zrecompile -p ~/.zsh/plugins/autocomplete/comp.zwc ~/.zsh/plugins/autocomplete/comp/_* 9 | zrecompile -p ~/.zsh/func.zwc ~/.zsh/func/* 10 | 11 | for a in ~/.zsh/plugins/*/plugin; do 12 | zrecompile -p -R $a -- 13 | done 14 | 15 | for a in ~/.zsh/plugins/*/func; do 16 | zrecompile -p $a.zwc $a/* 17 | done 18 | 19 | for a in ~/.zsh/plugins/*/comp; do 20 | zrecompile -p $a.zwc $a/* 21 | done 22 | 23 | # vim: ft=zsh 24 | -------------------------------------------------------------------------------- /func/pk: -------------------------------------------------------------------------------- 1 | # kill matching processes 2 | pk() { 3 | if [ $1 ]; then 4 | if [[ "`whoami`" == "root" ]]; then 5 | opts="uax" 6 | else 7 | opts="ux" 8 | fi 9 | 10 | pids=("${(f)$(ps $opts | grep --color=never $1 | grep -v grep)}") 11 | if [ "$pids" ]; then 12 | echo "killed:" 13 | ps $opts | head -n 1 14 | for pid in $pids 15 | do 16 | echo $pid | grep $1 --color=auto | grep -v grep 17 | pid=("${(s: :)pid}") 18 | kill -9 $pid[2] 19 | done 20 | else 21 | echo "No matches" 22 | fi 23 | unset opts pids 24 | fi 25 | } 26 | 27 | # vim: ft=zsh 28 | -------------------------------------------------------------------------------- /func/precmd: -------------------------------------------------------------------------------- 1 | # precmd is called just before the prompt is printed 2 | precmd() { 3 | title "%n@%m:%~" 4 | } 5 | 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /func/preexec: -------------------------------------------------------------------------------- 1 | preexec() { 2 | emulate -L zsh 3 | setopt extended_glob 4 | # cmd name only, or if this is sudo or ssh, the next cmd 5 | local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} 6 | title "%n@%m:%~ [%100>...>$2%<<]" 7 | } 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /func/psg: -------------------------------------------------------------------------------- 1 | psg() { 2 | if [ $1 ]; then 3 | args=($@) 4 | search=$args[-1] 5 | args[-1]=() 6 | ps $args | head -n 1 7 | ps $args | grep -i --color=auto "$search" | grep -v grep 8 | else 9 | fi 10 | } 11 | 12 | # vim: ft=zsh 13 | -------------------------------------------------------------------------------- /func/qmv-defaults: -------------------------------------------------------------------------------- 1 | qmv-defaults(){ 2 | if [ $# -eq 0 ]; then 3 | \qmv -fdo 4 | else 5 | \qmv $@ 6 | fi 7 | } 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /func/rationalize-dot: -------------------------------------------------------------------------------- 1 | rationalize-dot() { 2 | if [[ $LBUFFER = *.. ]]; then 3 | LBUFFER+=/.. 4 | else 5 | LBUFFER+=. 6 | fi 7 | } 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /func/redo: -------------------------------------------------------------------------------- 1 | redo() { 2 | sudo $(fc -l -n -1) 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /func/ssh-background: -------------------------------------------------------------------------------- 1 | ssh-background() { 2 | if [ $1 ]; then 3 | if [ ! "`screen -ls | grep ssh-control-master-$1`" ]; then 4 | screen -d -m -S ssh-control-master-$1 ssh $1 sleep 365d 5 | fi 6 | fi 7 | } 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /func/ssl-cert-create: -------------------------------------------------------------------------------- 1 | ssl-cert-create() { 2 | prefix=${1:-ssl} 3 | openssl genrsa -out $prefix.key 1024 4 | openssl req -new -key ssl.key -out $prefix.csr 5 | openssl x509 -req -days 9999 -in $prefix.csr -signkey $prefix.key -out $prefix.crt 6 | } 7 | 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /func/take: -------------------------------------------------------------------------------- 1 | take() { 2 | mkdir -p "$@" && cd "$@" 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /func/tar-ssh-from: -------------------------------------------------------------------------------- 1 | tar-ssh-from() { 2 | ssh $1 "tar czf - $2" | tar xzvf - -C $3 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /func/tar-ssh-to: -------------------------------------------------------------------------------- 1 | tar-ssh-to() { 2 | tar czf - $1 | ssh $2 tar xzf - -C $3 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /func/title: -------------------------------------------------------------------------------- 1 | # sets window title 2 | title() { 3 | if [[ "$TERM" == screen* ]]; then 4 | print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars 5 | elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then 6 | print -Pn "\e]2;$1:q\a" #set window name 7 | print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) 8 | fi 9 | } 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /func/wclr: -------------------------------------------------------------------------------- 1 | wclr() { 2 | print "total lines:" 3 | if [ $1 ]; then 4 | find $1 -not -type d | xargs wc -l | cut -c 1-8 | awk '{total += $1} END {print total}' - 5 | else 6 | find ./ -not -type d | xargs wc -l | cut -c 1-8 | awk '{total += $1} END {print total}' - 7 | fi 8 | } 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /func/what-is-my-ip: -------------------------------------------------------------------------------- 1 | what-is-my-ip() { 2 | echo ${(j::)$(curl -s 'http://checkip.dyndns.org' | grep -o '[0-9.]')} 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /func/zeesh-plugin: -------------------------------------------------------------------------------- 1 | # zeesh plugin controller 2 | zeesh-plugin() { 3 | if [ $2 ] && [[ -d ~/.zsh/plugins/$2 ]]; then 4 | case $1 in 5 | desc|description) 6 | zeesh-plugin-desc $2 7 | ;; 8 | enable) 9 | echo ":: zeesh plugin $2 enabled" 10 | source ~/.zsh/plugins/$2/plugin.zsh 11 | ;; 12 | prefs) 13 | zeesh-prefs $2 $@[3,-1] 14 | ;; 15 | esac 16 | else 17 | case $1 in 18 | create|new) 19 | if [ $2 ]; then 20 | zeesh-plugin-new $2 21 | else 22 | echo "please specify a name for your new plugin" 23 | fi 24 | ;; 25 | list|ls) 26 | echo ":: zeesh plugin :: available plugins" 27 | /bin/ls ~/.zsh/plugins 28 | ;; 29 | *) 30 | echo "not a valid command" 31 | ;; 32 | esac 33 | fi 34 | } 35 | 36 | # vim: ft=zsh 37 | -------------------------------------------------------------------------------- /func/zeesh-plugin-desc: -------------------------------------------------------------------------------- 1 | zeesh-plugin-desc() { 2 | if [[ -f ~/.zsh/plugins/$1/plugin.zsh ]]; then 3 | cat ~/.zsh/plugins/$1/plugin.zsh | awk 'BEGIN {x=0} { 4 | if ($0~"##desc"){x=1} 5 | if (x==1) {print $0 | "cut -c 3-"} 6 | if ($0~"##csed") {x=0} 7 | }' | egrep -v 'desc|csed' 8 | fi 9 | } 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /func/zeesh-plugin-enable: -------------------------------------------------------------------------------- 1 | zeesh-plugin-enable() { 2 | if [ $1 ]; then 3 | plugin=$1 4 | plugin_dir="$HOME/.zsh/plugins/$plugin" 5 | source "$plugin_dir/plugin" 6 | else 7 | # Source each plugin in zeesh_plugins 8 | for plugin in $zeesh_plugins; do 9 | plugin_dir=$HOME/.zsh/plugins/$plugin 10 | source $plugin_dir/plugin 11 | done 12 | fi 13 | unset plugin plugin_dir 14 | } 15 | 16 | # vim: ft=zsh 17 | -------------------------------------------------------------------------------- /func/zeesh-plugin-enabled: -------------------------------------------------------------------------------- 1 | zeesh-plugin-enabled() { 2 | if [ ${zeesh_plugins[(r)$1]} ]; then 3 | return 0 4 | fi 5 | return 1 6 | } 7 | 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /func/zeesh-plugin-list: -------------------------------------------------------------------------------- 1 | zeesh-plugin-list() { 2 | set -A reply $(/bin/ls ~/.zsh/plugins ${*} 2>/dev/null) 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /func/zeesh-plugin-new: -------------------------------------------------------------------------------- 1 | zeesh-plugin-new() { 2 | local plugin_name=$1 3 | local plugin_dir=~/.zsh/plugins/$plugin_name 4 | local plugin=$plugin_dir/plugin 5 | local fp='' 6 | local desc 7 | 8 | if [ ! $1 ]; then 9 | echo "Please specify a name for your plugin" 10 | return 11 | fi 12 | 13 | if [ -d $plugin_dir ]; then 14 | echo "A plugin by that name already exists!" 15 | return 16 | fi 17 | 18 | # Create plugin dir and create initial plugin skeleton 19 | mkdir $plugin_dir 20 | echo '### '$plugin_name' / zeesh! plugin' > $plugin 21 | 22 | # Plugin description 23 | echo 'Please enter a short description of your plugin:' 24 | read desc 25 | echo "\n" >> $plugin 26 | echo '### '$desc >> $plugin 27 | 28 | # Options 29 | ask 'Do you want to load functions for your plugin automatically? (y/n):' && enable_functions=yes 30 | if [ $enable_functions]; then 31 | ask 'Do you want me to include a sample functions for you? (y/n):' && enable_sample=yes 32 | fi 33 | ask 'Do you want to use zeesh-prefs? (y/n):' && enable_prefs=yes 34 | ask 'Do you want to load completions for your plugin automatically? (y/n):' && enable_plugins=yes 35 | 36 | # Setup functions 37 | if [ $enable_functions ]; then 38 | fp='$plugin_dir/func ' 39 | mkdir $plugin_dir/func 40 | if [ $enable_sample ]; then 41 | echo $plugin_name'(){' > $plugin_dir/func/$plugin_name 42 | if [ $enable_prefs ]; then 43 | echo '# default prefs for '$plugin_name', only used by zeesh-prefs to create new prefs file' > $plugin_dir/default.prefs 44 | echo '# to modify your actual preferences for this plugin edit ~/.zsh/local/'$plugin_name'.prefs' >> $plugin_dir/default.prefs 45 | echo 'key: value' >> $plugin_dir/default.prefs 46 | echo ' typeset -A prefs' >> $plugin_dir/func/$plugin_name 47 | echo ' zeesh-prefs get '$plugin_name' # try to get prefs or create new prefs file using default.prefs' >> $plugin_dir/func/$plugin_name 48 | echo ' if [[ "$prefs" != "" ]]; then' >> $plugin_dir/func/$plugin_name 49 | echo ' fi' >> $plugin_dir/func/$plugin_name 50 | fi 51 | echo '}' >> $plugin_dir/func/$plugin_name 52 | echo "# vim: ft=zsh" >> $/plugin_dir/func/$plugin_name 53 | fi 54 | fi 55 | 56 | # Create skeleton/dir 57 | if [ $enable_completions ]; then 58 | fp=$fp'$plugin_dir/comp ' 59 | fi 60 | 61 | if [ $fp ]; then 62 | echo 'fpath=( '$fpath')' >> $plugin 63 | fi 64 | 65 | if [ $enable_functions ]; then 66 | echo 'autoload -U $plugin_dir/func/*(:t)' >> $plugin 67 | fi 68 | 69 | # Echo out end of plugin file 70 | echo "\n"'## exports' >> $plugin 71 | echo "\n"'## aliases' >> $plugin 72 | echo "\n"'## functions' >> $plugin 73 | echo "# vim: ft=zsh" >> $plugin 74 | } 75 | 76 | # vim: ft=zsh 77 | -------------------------------------------------------------------------------- /func/zeesh-plugin-valid: -------------------------------------------------------------------------------- 1 | zeesh-plugin-valid() { 2 | if [ $1 ] && [[ -d .zsh/plugins/$1 ]] && [[ -f .zsh/plugins/$1/plugin.zsh ]]; then 3 | echo 'true' 4 | else 5 | echo 'false' 6 | fi 7 | } 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /func/zeesh-prefs: -------------------------------------------------------------------------------- 1 | zeesh-prefs() { 2 | local usage="zeesh-prefs is a zeesh! helper that manages preference files for plugins\n usage: prefs " 3 | local plugin=$1 4 | local cmd=$2 5 | local pref_file=~/.zsh/local/$plugin.prefs 6 | local default_pref_file=~/.zsh/plugins/$plugin/default.prefs 7 | 8 | # get me out of here if not called right! 9 | [ -n "$cmd" ] || { echo $usage; return } 10 | [ -d ~/.zsh/plugins/$plugin ] || { echo $usage; return } 11 | 12 | case $cmd in 13 | create) 14 | if [[ -f $pref_file ]]; then 15 | echo "preferences file already exists!" 16 | local ans 17 | echo "copy default preferences over $pref_file? (y/n): \c"; read ans 18 | if [[ -f $default_pref_file ]]; then 19 | cat $default_pref_file > $pref_file 20 | local ans 21 | echo "edit preferences now? (y/n): \c"; read ans 22 | if [[ $ans[1]:l == 'y' ]]; then 23 | $EDITOR $pref_file 24 | fi 25 | else 26 | echo "no preferences found, no example preferences found!" 27 | echo "try to manually create $pref_file" 28 | fi 29 | else 30 | if [[ -f $default_pref_file ]]; then 31 | cat $default_pref_file > $pref_file 32 | echo "no preferences found, creating $pref_file" 33 | local ans 34 | echo "edit preferences now? (y/n): \c"; read ans 35 | if [[ $ans[1]:l == 'y' ]]; then 36 | $EDITOR $pref_file 37 | fi 38 | else 39 | echo "no preferences found, no example preferences found!" 40 | echo "try to manually create $pref_file" 41 | fi 42 | fi 43 | ;; 44 | get) 45 | if [[ -f $pref_file ]]; then 46 | typeset -a lines 47 | lines=("${(f)$(cat $pref_file | grep -v "^$" | grep -v "^#")}") 48 | for i in $lines; do 49 | local key=$i[(ws': ')1] 50 | local value=$i[(ws': ')2] 51 | prefs[$key]=$value 52 | done 53 | else 54 | zeesh-prefs create $plugin 55 | fi 56 | ;; 57 | list) 58 | if [[ -f $pref_file ]]; then 59 | typeset -a lines 60 | lines=("${(f)$(cat $pref_file | grep -v "^$" | grep -v "^#")}") 61 | for i in $lines; do 62 | echo $i 63 | done 64 | else 65 | echo 'preferences file not found' 66 | fi 67 | ;; 68 | set) 69 | if [[ -f $pref_file ]] && [ $3 ] && [ $4 ]; then 70 | typeset -a lines 71 | lines=("${(f)$(cat $pref_file)}") 72 | tmp_file=$pref_file.tmp 73 | touch $tmp_file 74 | local found=false 75 | for line in $lines; do 76 | local key=$line[(ws': ')1] 77 | if [[ $key == $3 ]]; then 78 | found=true 79 | pref="$key: $4" 80 | echo $pref >> $tmp_file 81 | echo "set $pref" 82 | else 83 | echo $line >> $tmp_file 84 | fi 85 | done 86 | if [[ $found == false ]]; then 87 | local ans 88 | echo "key not found, add setting anyways? (y/n): \c"; read ans 89 | if [[ $ans[1]:l == 'y' ]]; then 90 | echo 'yayaya' 91 | echo "$3: $4" >> $pref_file 92 | fi 93 | else 94 | mv $tmp_file $pref_file 95 | fi 96 | else 97 | zeesh-prefs $cmd create 98 | fi 99 | ;; 100 | esac 101 | } 102 | 103 | # vim: ft=zsh 104 | -------------------------------------------------------------------------------- /local/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeekay/zeesh/5deaf7b144c238ec9d2d14f0cb5073cbbc5bf292/local/.empty -------------------------------------------------------------------------------- /plugins/ai/init: -------------------------------------------------------------------------------- 1 | # ZSH has a quirk where `preexec` is only run if a command is actually run (i.e 2 | # pressing ENTER at an empty command line will not cause preexec to fire). This 3 | # can cause timing issues, as a user who presses "ENTER" without running a command 4 | # will see the time to the start of the last command, which may be very large. 5 | 6 | # To fix this, we create STARSHIP_START_TIME upon preexec() firing, and destroy it 7 | # after drawing the prompt. This ensures that the timing for one command is only 8 | # ever drawn once (for the prompt immediately after it is run). 9 | 10 | zmodload zsh/parameter # Needed to access jobstates variable for STARSHIP_JOBS_COUNT 11 | 12 | # Defines a function `__starship_get_time` that sets the time since epoch in millis in STARSHIP_CAPTURED_TIME. 13 | if [[ $ZSH_VERSION == ([1-4]*) ]]; then 14 | # ZSH <= 5; Does not have a built-in variable so we will rely on Starship's inbuilt time function. 15 | __starship_get_time() { 16 | STARSHIP_CAPTURED_TIME=$(/usr/local/bin/starship time) 17 | } 18 | else 19 | zmodload zsh/datetime 20 | zmodload zsh/mathfunc 21 | __starship_get_time() { 22 | (( STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000)) )) 23 | } 24 | fi 25 | 26 | 27 | # The two functions below follow the naming convention `prompt__` 28 | # for compatibility with Zsh's prompt system. See 29 | # https://github.com/zsh-users/zsh/blob/2876c25a28b8052d6683027998cc118fc9b50157/Functions/Prompts/promptinit#L155 30 | 31 | # Runs before each new command line. 32 | prompt_starship_precmd() { 33 | # Save the status, because commands in this pipeline will change $? 34 | STARSHIP_CMD_STATUS=$? STARSHIP_PIPE_STATUS=(${pipestatus[@]}) 35 | 36 | # Compute cmd_duration, if we have a time to consume, otherwise clear the 37 | # previous duration 38 | if (( ${+STARSHIP_START_TIME} )); then 39 | __starship_get_time && (( STARSHIP_DURATION = STARSHIP_CAPTURED_TIME - STARSHIP_START_TIME )) 40 | unset STARSHIP_START_TIME 41 | else 42 | unset STARSHIP_DURATION 43 | fi 44 | 45 | # Use length of jobstates array as number of jobs. Expansion fails inside 46 | # quotes so we set it here and then use the value later on. 47 | STARSHIP_JOBS_COUNT=${#jobstates} 48 | } 49 | 50 | # Runs after the user submits the command line, but before it is executed. 51 | prompt_starship_preexec() { 52 | __starship_get_time && STARSHIP_START_TIME=$STARSHIP_CAPTURED_TIME 53 | } 54 | 55 | # Add hook functions 56 | autoload -Uz add-zsh-hook 57 | add-zsh-hook precmd prompt_starship_precmd 58 | add-zsh-hook preexec prompt_starship_preexec 59 | 60 | # Set up a function to redraw the prompt if the user switches vi modes 61 | starship_zle-keymap-select() { 62 | zle reset-prompt 63 | } 64 | 65 | ## Check for existing keymap-select widget. 66 | # zle-keymap-select is a special widget so it'll be "user:fnName" or nothing. Let's get fnName only. 67 | __starship_preserved_zle_keymap_select=${widgets[zle-keymap-select]#user:} 68 | if [[ -z $__starship_preserved_zle_keymap_select ]]; then 69 | zle -N zle-keymap-select starship_zle-keymap-select; 70 | else 71 | # Define a wrapper fn to call the original widget fn and then Starship's. 72 | starship_zle-keymap-select-wrapped() { 73 | $__starship_preserved_zle_keymap_select "$@"; 74 | starship_zle-keymap-select "$@"; 75 | } 76 | zle -N zle-keymap-select starship_zle-keymap-select-wrapped; 77 | fi 78 | 79 | __starship_get_time && STARSHIP_START_TIME=$STARSHIP_CAPTURED_TIME 80 | 81 | export STARSHIP_SHELL="zsh" 82 | 83 | # Set up the session key that will be used to store logs 84 | STARSHIP_SESSION_KEY="$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM"; # Random generates a number b/w 0 - 32767 85 | STARSHIP_SESSION_KEY="${STARSHIP_SESSION_KEY}0000000000000000" # Pad it to 16+ chars. 86 | export STARSHIP_SESSION_KEY=${STARSHIP_SESSION_KEY:0:16}; # Trim to 16-digits if excess. 87 | 88 | VIRTUAL_ENV_DISABLE_PROMPT=1 89 | 90 | setopt promptsubst 91 | 92 | PROMPT='$(/usr/local/bin/starship prompt --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")' 93 | RPROMPT='$(/usr/local/bin/starship prompt --right --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")' 94 | PROMPT2="$(/usr/local/bin/starship prompt --continuation)" 95 | -------------------------------------------------------------------------------- /plugins/ai/install: -------------------------------------------------------------------------------- 1 | echo -n "I can't find starship, would you like me to install it for you? (y/N) " 2 | 3 | read ans 4 | if [[ "$ans" == "y" ]]; then 5 | curl -sS https://starship.rs/install.sh | sh 6 | echo "...installed starship!" 7 | fi 8 | -------------------------------------------------------------------------------- /plugins/ai/plugin: -------------------------------------------------------------------------------- 1 | ### starship / zeesh! plugin 2 | 3 | if ! hash starship &> /dev/null; then 4 | . $plugin_dir/install 5 | fi 6 | 7 | source <(/usr/local/bin/starship init zsh --print-full-init) 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/audio/plugin: -------------------------------------------------------------------------------- 1 | ### audio / zeesh! plugin 2 | 3 | alias sound-dl=youtube-dl --extract audio 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/auto-fu/install: -------------------------------------------------------------------------------- 1 | echo -n "I can't find auto-fu.zsh, would you like me to install it for you? (y/N) " 2 | 3 | read ans 4 | if [[ "$ans" == "y" ]]; then 5 | git clone --depth 1 git://github.com/hchbaw/auto-fu.zsh $plugin_dir/lib 6 | source $plugin_dir/lib/auto-fu.zsh 7 | auto-fu-zcompile $plugin_dir/lib/auto-fu.zsh $plugin_dir/lib/ > /dev/null 2>&1 8 | echo "...installed auto-fu!" 9 | fi 10 | -------------------------------------------------------------------------------- /plugins/auto-fu/plugin: -------------------------------------------------------------------------------- 1 | ### auto-fu / zeesh! plugin 2 | 3 | [ -d $plugin_dir/lib ] || . $plugin_dir/install 4 | 5 | source $plugin_dir/lib/auto-fu; auto-fu-install; 6 | zstyle ':auto-fu:highlight' input bold 7 | zstyle ':auto-fu:highlight' completion fg=black,bold 8 | zstyle ':auto-fu:highlight' completion/one fg=white,bold,underline 9 | zstyle ':auto-fu:var' postdisplay $'\n-azfu-' 10 | zstyle ':auto-fu:var' track-keymap-skip opp 11 | zle-line-init () {auto-fu-init;}; zle -N zle-line-init 12 | zle -N zle-keymap-select auto-fu-zle-keymap-select 13 | 14 | # vim: ft=zsh 15 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_cake: -------------------------------------------------------------------------------- 1 | #compdef cake 2 | 3 | # cake, version 1.0.0(coffeescript) 4 | 5 | local curcontext="$curcontext" state line expl ret=1 6 | typeset -A opt_args 7 | 8 | # -f FILE, --file=FILE read tasks from FILE [pavement.py] 9 | _arguments -C -s -S \ 10 | '*:target:->target' && ret=0 11 | 12 | case "$state" in 13 | target) 14 | local -a targets 15 | if [ -f "Cakefile" ]; then 16 | targets=( ${${(f)"$(_call_program targets $words[1] 2>/dev/null | grep cake | grep -v 'Cakefile defines the following' | sed 's/ *#.*//g; s/cake //g')"}}) 17 | _wanted targets expl 'cake target' compadd -a targets && return 0 18 | else 19 | _message -e target 'cake target' 20 | fi 21 | ;; 22 | esac 23 | 24 | return ret 25 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_cdsrc: -------------------------------------------------------------------------------- 1 | #compdef cdsrc 2 | _files -W `cdsrc --location` -/ 3 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_coffee: -------------------------------------------------------------------------------- 1 | #compdef coffee 2 | # ------------------------------------------------------------------------------ 3 | # Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # * Neither the name of the zsh-users nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # ------------------------------------------------------------------------------ 28 | # Description 29 | # ----------- 30 | # 31 | # Completion script for Coffee.js v0.6.11 (http://coffeejs.org) 32 | # 33 | # ------------------------------------------------------------------------------ 34 | # Authors 35 | # ------- 36 | # 37 | # * Mario Fernandez (https://github.com/sirech) 38 | # 39 | # ------------------------------------------------------------------------------ 40 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 41 | # vim: ft=zsh sw=2 ts=2 et 42 | # ------------------------------------------------------------------------------ 43 | 44 | local curcontext="$curcontext" state line ret=1 45 | typeset -A opt_args 46 | 47 | _arguments -C \ 48 | '(- *)'{-h,--help}'[display this help message]' \ 49 | '(- *)'{-v,--version}'[display the version number]' \ 50 | '(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \ 51 | '(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \ 52 | '(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \ 53 | '(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \ 54 | '(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' \ 55 | '(--nodejs)--nodejs[pass options directly to the "node" binary]' \ 56 | '(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \ 57 | '(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \ 58 | '(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \ 59 | '(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \ 60 | '(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \ 61 | '(-r --require)'{-r,--require}'[require a library before executing your script]:library' \ 62 | '(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \ 63 | '(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \ 64 | '*:script or directory:_files' && ret=0 65 | 66 | return ret 67 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_gcc-config: -------------------------------------------------------------------------------- 1 | #compdef gcc-config 2 | # ------------------------------------------------------------------------------ 3 | # Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # * Neither the name of the zsh-users nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # ------------------------------------------------------------------------------ 28 | # Description 29 | # ----------- 30 | # 31 | # Completion script for GCC config script (symlink manager for multiversioning). 32 | # 33 | # ------------------------------------------------------------------------------ 34 | # Authors 35 | # ------- 36 | # 37 | # * Vadim A. Misbakh-Soloviev 38 | # * Bapt 39 | # * kaworu 40 | # * David Durrleman 41 | # * oberyno 42 | # * Mamoru Komachi 43 | # 44 | # ------------------------------------------------------------------------------ 45 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 46 | # vim: ft=zsh sw=2 ts=2 et 47 | # ------------------------------------------------------------------------------ 48 | # 49 | 50 | local arguments 51 | 52 | arguments=( 53 | '(- :)'{--use-old,-O}'[use the old profile if one was selected]' 54 | '(- :)'{--use-portage-chost,-P}'[only set profile if its CHOST matches /etc/make.conf]:profiles:_gcc_profile' 55 | '(- :)'{--get-current-profile,-c}'[print current used gcc profile]' 56 | '(- :)'{--list-profiles,-l}'[print a list of available profiles]' 57 | '(- :)'{--print-environ,-E}'[print environment of the given/current profile]:profiles:_gcc_profile' 58 | '(- :)'{--get-bin-path,-B}'[print binary path of given/current profile]:profiles:_gcc_profile' 59 | '(- :)'{--get-lib-path,-L}'[print library path of given/current profile]:profiles:_gcc_profile' 60 | '(- :)'{--get-stdcxx-incdir,-X}'[print g++ include path of given/current profile]:profiles:_gcc_profile' 61 | '(- :)'{--help,-h}'[show help]' 62 | '(- :)'{--version,-v}'[show version info]' 63 | '(- :):profiles:_gcc_profile' 64 | ) 65 | 66 | _gcc_profile () { 67 | local profile 68 | profile=(${(f)"$(_call_program gcc-installed RC_NOCOLOR=yes gcc-config --list-profiles)"}) 69 | profile=${${profile/\[([^]]*)\]/}/\*} 70 | _tags profile && { compadd "$@" -k profile || compadd "$@" ${(kv)=profile} } 71 | } 72 | 73 | _arguments $arguments 74 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_hoodoo: -------------------------------------------------------------------------------- 1 | #compdef hoodoo 2 | 3 | _hoodoo() { 4 | _arguments -s \ 5 | '*::hoodoo command:_hoodoo_command' 6 | } 7 | 8 | (( $+functions[_hoodoo_command] )) || 9 | _hoodoo_command(){ 10 | local ret=1 11 | 12 | # newline delimited list of commands in command_name:description format 13 | _hoodoo_cmds=( 14 | ${(f)"$(hoodoo command_list)"} 15 | ) 16 | 17 | _describe -t commands 'hoodoo command' _hoodoo_cmds 18 | 19 | return ret 20 | } 21 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_managepy: -------------------------------------------------------------------------------- 1 | #compdef managepy 2 | 3 | typeset -A opt_args 4 | 5 | _arguments -C \ 6 | '1:cmds:->cmds' \ 7 | '2:subcmds:->subcmds' \ 8 | '*:: :->args' \ 9 | && ret=0 10 | 11 | case $state in 12 | cmds) 13 | local commands 14 | commands=(${(f)"$(python manage.py complete)"}) 15 | _describe -t commands 'command' commands && ret=0 16 | ;; 17 | subcmds) 18 | local subcommands 19 | subcommands=(${(f)"$(python manage.py complete $words[2])"}) 20 | _describe -t subcommands 'subcommand' subcommands && ret=0 21 | ;; 22 | args) 23 | _files 24 | ;; 25 | esac 26 | 27 | return 1 28 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_node: -------------------------------------------------------------------------------- 1 | #compdef node 2 | # ------------------------------------------------------------------------------ 3 | # Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # * Neither the name of the zsh-users nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # ------------------------------------------------------------------------------ 28 | # Description 29 | # ----------- 30 | # 31 | # Completion script for Node.js v0.6.11 (http://nodejs.org) 32 | # 33 | # ------------------------------------------------------------------------------ 34 | # Authors 35 | # ------- 36 | # 37 | # * Mario Fernandez (https://github.com/sirech) 38 | # 39 | # ------------------------------------------------------------------------------ 40 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 41 | # vim: ft=zsh sw=2 ts=2 et 42 | # ------------------------------------------------------------------------------ 43 | 44 | local curcontext="$curcontext" state line ret=1 45 | typeset -A opt_args 46 | 47 | _arguments -C \ 48 | '(- 1 *)--help[print options help]' \ 49 | '(- 1 *)'{-v,--version}'[print node version]' \ 50 | '(- 1 *)--v8-options[print v8 command line options]' \ 51 | '(-e --eval)'{-e,--eval}'[evaluate script]:Inline Script' \ 52 | '(-p --print)'{-p,--print}'[print result of --eval]' \ 53 | '(--vars)--vars[print various compiled-in variables]' \ 54 | '*:JS Script:_files -g "*.js"' && ret=0 55 | 56 | return ret 57 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_pip: -------------------------------------------------------------------------------- 1 | #compdef pip 2 | # ------------------------------------------------------------------------------ 3 | # Description 4 | # ----------- 5 | # 6 | # Completion script for pip (http://pypi.python.org/pypi/pip). 7 | # 8 | # Source: https://github.com/technolize/zsh-completion-funcs 9 | # 10 | # ------------------------------------------------------------------------------ 11 | # Authors 12 | # ------- 13 | # 14 | # * technolize (https://github.com/technolize) 15 | # 16 | # ------------------------------------------------------------------------------ 17 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 18 | # vim: ft=zsh sw=2 ts=2 et 19 | # ------------------------------------------------------------------------------ 20 | 21 | 22 | local ret=1 state 23 | 24 | declare -ga common_ops 25 | common_ops=( 26 | "--version[display version number]" 27 | {-h,--help}"[show help]" 28 | {-E,--environment=}"[virtualenv environment to run pip]:environment:_directories" 29 | {-s,--enable-site-packages}"[include site-packages in virtualenv]" 30 | {-v,--verbose}"[give more output]" 31 | {-q,--quiet}"[give less output]" 32 | "--log=[log file where a complete record will be kept]" 33 | "--proxy=[specify a proxy in the form user:passwd@proxy.server:port]:proxy" 34 | "--timeout=[set the socket timeout (default 15 seconds)]:second" 35 | ) 36 | 37 | _directories () { 38 | _wanted directories expl directory _path_files -/ "$@" - 39 | } 40 | 41 | typeset -A opt_args 42 | _arguments \ 43 | ':subcommand:->subcommand' \ 44 | $common_ops \ 45 | '*::options:->options' && ret=0 46 | 47 | case $state in 48 | subcommand) 49 | subcommands=( 50 | "bundle:create pybundle" 51 | "freeze:put all currently installed packages" 52 | "help:show available commands" 53 | "install:install packages" 54 | "search:search pypi" 55 | "uninstall:uninstall packages" 56 | "unzip:unzip undividual packages" 57 | "zip:zip dividual packages" 58 | ) 59 | 60 | _describe -t subcommands 'pip subcommand' subcommands && ret=0 61 | ;; 62 | 63 | options) 64 | declare -a args 65 | args=( 66 | $common_ops 67 | ) 68 | 69 | declare -a requirement 70 | requirement=( 71 | {-r,--requirement=}"[install all the packages listed in the given requirements file]:filename" 72 | ) 73 | 74 | declare -a findlink 75 | findlink=( 76 | {-f,--find-links=}"[URL to look for packages at]:url" 77 | ) 78 | 79 | case $words[1] in 80 | bundle | install) 81 | args+=( 82 | {-e,--editable=}"[install a package directly from a checkout]:VCS+REPOS_URL[@REV]#egg=PACKAGE" 83 | $requirement 84 | $findlink 85 | {-i,--index-url=,--pypi-url=}"[base URL of Python Package Index]:URL" 86 | "--extra-index-url=[extra URLs of package indexes to use]:URL" 87 | {-b,--build=,--build-dir=}"[unpack packages into DIR]:directory:_directories" 88 | {--src=,--source=}"[check out --editable packages into DIR]:directory:_directories" 89 | {-U,--upgrade}"[upgrade all packages to the newest available version]" 90 | {-I,--ignore-installed}"[ignore the installed packages]" 91 | "--noinstall[download and unpack all packages, but don't actually install them]" 92 | "--install-option=[extra arguments to be supplied to the setup.py install command]" 93 | ) 94 | ;; 95 | 96 | freeze) 97 | args+=( 98 | $requirement 99 | $findlink 100 | ) 101 | ;; 102 | 103 | unzip | zip) 104 | args+=( 105 | "--unzip[unzip a package]" 106 | "--no-pyc[do not include .pyc files in zip files]" 107 | {-l,--list}"[list the packages available, and their zip status]" 108 | "--sort-files[with --list, sort packages according to how many files they contain]" 109 | "--path=[restrict operation to the given paths]:paths" 110 | {-n,--simulate}"[do not actually perform the zip/unzip operation]" 111 | ) 112 | ;; 113 | esac 114 | 115 | _arguments $args && ret=0 116 | ;; 117 | esac 118 | 119 | return ret 120 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_sake: -------------------------------------------------------------------------------- 1 | #compdef sake 2 | 3 | # sake, version 1.0.0 4 | 5 | local curcontext="$curcontext" state line expl ret=1 6 | typeset -A opt_args 7 | 8 | # -f FILE, --file=FILE read tasks from FILE [pavement.py] 9 | _arguments -C -s -S \ 10 | '*:target:->target' && ret=0 11 | 12 | case "$state" in 13 | target) 14 | local -a targets 15 | if [ -f "Sakefile" ] || [ -f "Cakefile" ] || [ -f "Sakefile.js" ] || [ -f "Sakefile.ts" ]; then 16 | targets=( ${${(f)"$(_call_program targets $words[1] 2>/dev/null | grep sake | grep -v 'defines the following' | sed 's/ *#.*//g; s/sake //g')"}}) 17 | _wanted targets expl 'sake target' compadd -a targets && return 0 18 | else 19 | _message -e target 'sake target' 20 | fi 21 | ;; 22 | esac 23 | 24 | return ret 25 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_ssh-copy-id: -------------------------------------------------------------------------------- 1 | #compdef ssh-copy-id 2 | # ------------------------------------------------------------------------------ 3 | # Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # * Redistributions of source code must retain the above copyright 9 | # notice, this list of conditions and the following disclaimer. 10 | # * Redistributions in binary form must reproduce the above copyright 11 | # notice, this list of conditions and the following disclaimer in the 12 | # documentation and/or other materials provided with the distribution. 13 | # * Neither the name of the zsh-users nor the 14 | # names of its contributors may be used to endorse or promote products 15 | # derived from this software without specific prior written permission. 16 | # 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | # DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY 21 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # ------------------------------------------------------------------------------ 28 | # Description 29 | # ----------- 30 | # 31 | # Completion script for ssh-copy-id. 32 | # 33 | # ------------------------------------------------------------------------------ 34 | # Authors 35 | # ------- 36 | # 37 | # * Julien Nicoulaud 38 | # 39 | # ------------------------------------------------------------------------------ 40 | # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- 41 | # vim: ft=zsh sw=2 ts=2 et 42 | # ------------------------------------------------------------------------------ 43 | 44 | 45 | # FIXME This completes "user@host" and not "[user@]host" ("user@" is optionnal), 46 | # should be merged in _ssh. 47 | 48 | _arguments -A "-*" \ 49 | '-i+[use identity file]:SSH identity file:_files' \ 50 | '1: :_user_at_host' 51 | -------------------------------------------------------------------------------- /plugins/autocomplete/comp/_vagrant: -------------------------------------------------------------------------------- 1 | #compdef vagrant 2 | #autoload 3 | 4 | # vagrant zsh completion 5 | 6 | local -a _1st_arguments 7 | _1st_arguments=( 8 | 'box:Box commands' 9 | 'destroy:Destroys the vagrant environment' 10 | 'halt:Halts the currently running vagrant environment' 11 | 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' 12 | 'package:Packages a vagrant environment for distribution' 13 | 'plugin:Plugin commands' 14 | 'provision:Run the provisioner' 15 | 'reload:Reload the vagrant environment' 16 | 'resume:Resumes a suspend vagrant environment' 17 | 'ssh:SSH into the currently running environment' 18 | 'ssh-config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' 19 | 'status:Shows the status of the current Vagrant environment.' 20 | 'suspend:Suspends the currently running vagrant environment' 21 | 'up:Creates the vagrant environment' 22 | '--help:[TASK] Describe available tasks or one specific task' 23 | '--version:Prints the Vagrant version information' 24 | ) 25 | 26 | local -a _box_arguments 27 | _box_arguments=( 28 | 'add:NAME URI Add a box to the system' 29 | 'help:COMMAND Describe subcommands or one specific subcommand' 30 | 'list:Lists all installed boxes' 31 | 'remove:NAME Remove a box from the system' 32 | 'repackage:NAME Repackage an installed box into a `.box` file.' 33 | ) 34 | 35 | __task_list () 36 | { 37 | local expl 38 | declare -a tasks 39 | 40 | tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) 41 | 42 | _wanted tasks expl 'help' compadd $tasks 43 | } 44 | 45 | __box_list () 46 | { 47 | _wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g') 48 | } 49 | 50 | __vm_list () 51 | { 52 | _wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *:\([a-zA-Z0-9]\+\)' 2>/dev/null | cut -d: -f2) 53 | } 54 | 55 | __vagrant-box () 56 | { 57 | local curcontext="$curcontext" state line 58 | typeset -A opt_args 59 | 60 | _arguments -C \ 61 | ':command:->command' \ 62 | '*::options:->options' 63 | 64 | case $state in 65 | (command) 66 | _describe -t commands "gem subcommand" _box_arguments 67 | return 68 | ;; 69 | 70 | (options) 71 | case $line[1] in 72 | (repackage|remove) 73 | _arguments ':feature:__box_list' 74 | ;; 75 | esac 76 | ;; 77 | esac 78 | } 79 | 80 | 81 | 82 | 83 | local expl 84 | local -a boxes installed_boxes 85 | 86 | local curcontext="$curcontext" state line 87 | typeset -A opt_args 88 | 89 | _arguments -C \ 90 | ':command:->command' \ 91 | '*::options:->options' 92 | 93 | case $state in 94 | (command) 95 | _describe -t commands "gem subcommand" _1st_arguments 96 | return 97 | ;; 98 | 99 | (options) 100 | case $line[1] in 101 | (help) 102 | _arguments ':feature:__task_list' 103 | ;; 104 | 105 | (box) 106 | __vagrant-box 107 | ;; 108 | (up|provision|package|destroy|reload|ssh|halt|resume|status) 109 | _arguments ':feature:__vm_list' 110 | esac 111 | ;; 112 | esac 113 | -------------------------------------------------------------------------------- /plugins/autocomplete/plugin: -------------------------------------------------------------------------------- 1 | # zeesh zsh autocomplete plugin 2 | 3 | HOMEBREW_ZSH_COMPLETION=${HOMEBREW_ZSH_COMPLETION:-/usr/local/Library/Contributions/brew_zsh_completion.zsh} 4 | 5 | # symlink _brew if on osx 6 | if [ ! -f "$plugin_dir/comp/_brew" ] && [ -f $HOMEBREW_ZSH_COMPLETION ]; then 7 | ln -s $HOMEBREW_ZSH_COMPLETION $plugin_dir/comp/_brew 8 | fi 9 | 10 | # add ellipsis, zeesh comps to $fpath 11 | fpath=( $plugin_dir/comp $HOME/.ellipsis/comp $fpath ) 12 | 13 | # enable autocompletions and cache in ~/.zsh/cache 14 | autoload -Uz compinit && compinit -i -u -d ~/.zsh/cache/zcompdump 15 | 16 | # speed up completion 17 | zstyle ':completion:*' accept-exact '*(N)' 18 | zstyle ':completion:*' cache-path ~/.zsh/cache 19 | zstyle ':completion:*' use-cache on 20 | 21 | zstyle ':completion:*' completer _complete _ignored _match _correct _approximate _prefix 22 | 23 | zstyle ':completion:*:*:open:*' matcher 'm:{a-z}={A-Z} r: ||[^ ]=**' 24 | 25 | # case-insensitive (all), partial-word and then substring completion 26 | zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' 27 | zstyle ':completion:*' list-colors '' 28 | zstyle ':completion:*:*:*:*:*' menu select 29 | zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' 30 | 31 | zstyle ':completion:*:*:*:users' ignored-patterns \ 32 | Guest adm amanda apache avahi beaglidx bin cacti canna clamav daemon \ 33 | dbus distcache dovecot fax ftp games gdm gkrellmd gopher hacluster \ 34 | haldaemon halt hsqldb ident junkbust ldap lp mail mailman mailnull \ 35 | mldonkey mysql nagios named netdump news nfsnobody nobody nscd ntp \ 36 | nut nx openvpn operator pcap postfix postgres privoxy pulse pvm \ 37 | quagga radvd rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs '_*' 38 | 39 | # ... unless we really want to. 40 | zstyle '*' single-ignored show 41 | 42 | # Ignore multiple entries. 43 | zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes 44 | zstyle ':completion:*:rm:*' file-patterns '*:all-files' 45 | 46 | # SSH/SCP/RSYNC 47 | zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host hosts:-domain:domain hosts:-ipaddr:ip\ address *' 48 | zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr 49 | zstyle ':completion:*:ssh:*' tag-order 'hosts:-host hosts:-domain:domain hosts:-ipaddr:ip\ address *' 50 | zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr 51 | zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*.*' loopback localhost 52 | zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^*.*' '*@*' 53 | zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^<->.<->.<->.<->' '127.0.0.<->' 54 | 55 | # hide shit 56 | zstyle ':completion:*:*' ignored-patterns '*.zwc' '*.old' 'broadcasthost' '*?.pyc' '*__pycache__' 57 | 58 | # zshfu plugin list autocomplete 59 | compctl -K zeesh-plugin-list zeesh-plugin 60 | 61 | # Add manage.py completions 62 | compdef _managepy manage.py 63 | 64 | # Add sake completions 65 | compdef _sake sake 66 | 67 | # vim: ft=zsh 68 | -------------------------------------------------------------------------------- /plugins/bebop/plugin: -------------------------------------------------------------------------------- 1 | ### bebop / zeesh! plugin 2 | 3 | alias bb=bebop 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/clojure/bin/ng-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | if [ -z $VIMCLOJURE_SERVER_JAR ]; then 4 | echo "Error! Need to define location of VimClojure nailgun server jar with:" 5 | echo "export VIMCLOJURE_SERVER_JAR=" 6 | exit 1 7 | fi 8 | 9 | if [ ! -f $VIMCLOJURE_SERVER_JAR ]; then 10 | echo "Error! Unable to find VimClojure nailgun server jar at '$VIMCLOJURE_SERVER_JAR'" 11 | exit 1 12 | fi 13 | 14 | LEIN_CLASSPATH=$(lein classpath) 15 | 16 | if [ ! $LEIN_CLASSPATH ]; then 17 | echo "Warning! Unable to get classpath from lein, just using existing classpath, expecting clojure jars to be available" 18 | fi 19 | 20 | NG_CLASSPATH="$VIMCLOJURE_SERVER_JAR:$LEIN_CLASSPATH:$CLASSPATH" 21 | echo java -server -cp "$NG_CLASSPATH" vimclojure.nailgun.NGServer 22 | java -server -cp "$NG_CLASSPATH" vimclojure.nailgun.NGServer 23 | -------------------------------------------------------------------------------- /plugins/clojure/lib/server-2.3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zeekay/zeesh/5deaf7b144c238ec9d2d14f0cb5073cbbc5bf292/plugins/clojure/lib/server-2.3.1.jar -------------------------------------------------------------------------------- /plugins/clojure/plugin: -------------------------------------------------------------------------------- 1 | ### clojure / zeesh! plugin 2 | 3 | ### Clojure plugin for zeesh 4 | 5 | ## exports 6 | export CLASSPATH=/usr/share/clojure/clojure.jar:$CLASSPATH 7 | export VIMCLOJURE_SERVER_JAR=~/.zsh/plugins/clojure/lib/server-2.3.1.jar 8 | export PATH=$PATH:~/.zsh/plugins/clojure/bin 9 | 10 | ## aliases 11 | alias clj='rlwrap clj' 12 | 13 | # vim: ft=zsh 14 | -------------------------------------------------------------------------------- /plugins/color-switch/func/color-switch: -------------------------------------------------------------------------------- 1 | color-switch() { 2 | if [ $1 ]; then 3 | if [ -f ~/.zsh/plugins/color-switch/themes/$1.theme ]; then 4 | source ~/.zsh/plugins/color-switch/themes/$1.theme 5 | if [ -f ~/.zsh/local/color-switch.last ]; then 6 | rm ~/.zsh/local/color-switch.last 7 | fi 8 | echo $1 > ~/.zsh/local/color-switch.last 9 | else 10 | echo "Can't find that theme" 11 | fi 12 | else 13 | LAST_THEME=$(cat ~/.zsh/local/color-switch.last | sed -e 's/^[ \t]*//') 14 | echo -e "current theme: "$LAST_THEME 15 | echo -e "\\e[0mnc (No color)" 16 | echo -e "\\e[1;37mwhite\\t\\e[0;30mblack" 17 | echo -e "\\e[0;34mblue\\t\\e[1;34mlight blue" 18 | echo -e "\\e[0;32mgreen\\t\\e[1;32mlight green" 19 | echo -e "\\e[0;36mcyan\\t\\e[1;36mlight cyan" 20 | echo -e "\\e[0;31mred\\t\\e[1;31mlight red" 21 | echo -e "\\e[0;35mpurple\\t\\e[1;35mlight purple" 22 | echo -e "\\e[0;33myellow\\t\\e[1;33mlight yellow" 23 | echo -e "\\e[1;30mgray\\t\\e[0;37mlight gray" 24 | fi 25 | } 26 | 27 | # vim: ft=zsh 28 | -------------------------------------------------------------------------------- /plugins/color-switch/func/color-switch-themes: -------------------------------------------------------------------------------- 1 | color-switch-themes() { 2 | set -A reply $(ls ~/.zsh/plugins/color-switch/themes | cut -d . -f1 ${*} 2>/dev/null) 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/color-switch/plugin: -------------------------------------------------------------------------------- 1 | ### color-switch / zeesh! plugin 2 | 3 | # you can easily craft new themes using ansi escape codes 4 | # save your new .theme in ~/.zsh/plugins/color_switch/themes 5 | # ex to set the "black" color to #777777: 6 | # echo -e "\e]4;00;#777777\a" | tr -d '\n' # black 7 | 8 | # ansi color code chart: 9 | # 00 - black 10 | # 01 - red 11 | # 02 - green 12 | # 03 - yellow 13 | # 04 - blue 14 | # 05 - purple 15 | # 06 - cyan 16 | # 07 - light gray 17 | # 08 - gray 18 | # 09 - light red 19 | # 10 - light green 20 | # 11 - light yellow 21 | # 12 - light blue 22 | # 13 - light purple 23 | # 14 - light cyan 24 | # 15 - bold white 25 | 26 | fpath=( ~/.zsh/plugins/color-switch/func $fpath ) 27 | autoload color-switch color-switch-themes 28 | 29 | # theme completion 30 | compctl -K color-switch color-switch-themes 31 | 32 | # Load last theme 33 | if [ -f ~/.zsh/local/color_switch.last ]; then 34 | local theme=$(cat ~/.zsh/local/color-switch.last | sed -e 's/^[ \t]*//') 35 | source ~/.zsh/plugins/color-switch/themes/$theme.theme &! 36 | export COLOR_SWITCH_THEME=$theme 37 | fi 38 | 39 | # vim: ft=zsh 40 | -------------------------------------------------------------------------------- /plugins/color-switch/themes/desert.theme: -------------------------------------------------------------------------------- 1 | # desert theme 2 | echo -e "\e]4;00;#777777\a" | tr -d '\n' # black 3 | echo -e "\e]4;01;#ff2b2b\a" | tr -d '\n' # red 4 | echo -e "\e]4;02;#98fb98\a" | tr -d '\n' # green 5 | echo -e "\e]4;03;#f0e68c\a" | tr -d '\n' # yellow 6 | echo -e "\e]4;04;#cd853f\a" | tr -d '\n' # blue 7 | echo -e "\e]4;05;#ffdead\a" | tr -d '\n' # purple 8 | echo -e "\e]4;06;#ffa0a0\a" | tr -d '\n' # cyan 9 | echo -e "\e]4;07;#f5deb3\a" | tr -d '\n' # light gray 10 | echo -e "\e]4;08;#555555\a" | tr -d '\n' # gray 11 | echo -e "\e]4;09;#ff5555\a" | tr -d '\n' # light red 12 | echo -e "\e]4;10;#55ff55\a" | tr -d '\n' # light green 13 | echo -e "\e]4;11;#ffff55\a" | tr -d '\n' # light yellow 14 | echo -e "\e]4;12;#87ceeb\a" | tr -d '\n' # light blue 15 | echo -e "\e]4;13;#ff55ff\a" | tr -d '\n' # light purple 16 | echo -e "\e]4;14;#ffd700\a" | tr -d '\n' # light cyan 17 | echo -e "\e]4;15;#ffffff\a" | tr -d '\n' # bold white 18 | -------------------------------------------------------------------------------- /plugins/color-switch/themes/eterm.theme: -------------------------------------------------------------------------------- 1 | # eterm theme 2 | echo -e "\e]4;00;#000000\a" | tr -d '\n' # black 3 | echo -e "\e]4;01;#cc0000\a" | tr -d '\n' # red 4 | echo -e "\e]4;02;#00cc00\a" | tr -d '\n' # green 5 | echo -e "\e]4;03;#cccc00\a" | tr -d '\n' # yellow 6 | echo -e "\e]4;04;#0000cc\a" | tr -d '\n' # blue 7 | echo -e "\e]4;05;#cc00cc\a" | tr -d '\n' # purple 8 | echo -e "\e]4;06;#00cccc\a" | tr -d '\n' # cyan 9 | echo -e "\e]4;07;#faebd7\a" | tr -d '\n' # light gray 10 | echo -e "\e]4;08;#333333\a" | tr -d '\n' # gray 11 | echo -e "\e]4;09;#ff0000\a" | tr -d '\n' # light red 12 | echo -e "\e]4;10;#00ff00\a" | tr -d '\n' # light green 13 | echo -e "\e]4;11;#ffff00\a" | tr -d '\n' # yellow 14 | echo -e "\e]4;12;#0000ff\a" | tr -d '\n' # light blue 15 | echo -e "\e]4;13;#ff00ff\a" | tr -d '\n' # light purple 16 | echo -e "\e]4;14;#00ffff\a" | tr -d '\n' # light cyan 17 | echo -e "\e]4;15;#ffffff\a" | tr -d '\n' # white 18 | -------------------------------------------------------------------------------- /plugins/color-switch/themes/gnome.theme: -------------------------------------------------------------------------------- 1 | # gnome theme 2 | echo -e "\e]4;00;#000000\a" | tr -d '\n' # black 3 | echo -e "\e]4;01;#aa0000\a" | tr -d '\n' # red 4 | echo -e "\e]4;02;#00aa00\a" | tr -d '\n' # green 5 | echo -e "\e]4;03;#ffff55\a" | tr -d '\n' # yellow 6 | echo -e "\e]4;04;#0000aa\a" | tr -d '\n' # blue 7 | echo -e "\e]4;05;#aa00aa\a" | tr -d '\n' # purple 8 | echo -e "\e]4;06;#00aaaa\a" | tr -d '\n' # cyan 9 | echo -e "\e]4;07;#aaaaaa\a" | tr -d '\n' # light gray 10 | echo -e "\e]4;08;#555555\a" | tr -d '\n' # gray 11 | echo -e "\e]4;09;#ff5555\a" | tr -d '\n' # light red 12 | echo -e "\e]4;10;#55ff55\a" | tr -d '\n' # light green 13 | echo -e "\e]4;11;#aaaaaa\a" | tr -d '\n' # brown 14 | echo -e "\e]4;12;#5555ff\a" | tr -d '\n' # light blue 15 | echo -e "\e]4;13;#ff55ff\a" | tr -d '\n' # light purple 16 | echo -e "\e]4;14;#55ffff\a" | tr -d '\n' # light cyan 17 | echo -e "\e]4;15;#ffffff\a" | tr -d '\n' # white 18 | -------------------------------------------------------------------------------- /plugins/color-switch/themes/kind-of-blue.theme: -------------------------------------------------------------------------------- 1 | # kind-of-blue theme 2 | echo -e "\e]4;00;#888888\a" | tr -d '\n' # black 3 | echo -e "\e]4;01;#FF3D3D\a" | tr -d '\n' # red 4 | echo -e "\e]4;02;#2BE480\a" | tr -d '\n' # green 5 | echo -e "\e]4;03;#f0e68c\a" | tr -d '\n' # yellow 6 | echo -e "\e]4;04;#59A3FF\a" | tr -d '\n' # blue 7 | echo -e "\e]4;05;#D6A0FF\a" | tr -d '\n' # purple 8 | echo -e "\e]4;06;#ffa0a0\a" | tr -d '\n' # cyan 9 | echo -e "\e]4;07;#f5deb3\a" | tr -d '\n' # light gray 10 | echo -e "\e]4;08;#999999\a" | tr -d '\n' # gray 11 | echo -e "\e]4;09;#ff5555\a" | tr -d '\n' # light red 12 | echo -e "\e]4;10;#55ff55\a" | tr -d '\n' # light green 13 | echo -e "\e]4;11;#ffff55\a" | tr -d '\n' # light yellow 14 | echo -e "\e]4;12;#A8D0FF\a" | tr -d '\n' # light blue 15 | echo -e "\e]4;13;#E2BFFF\a" | tr -d '\n' # light purple 16 | echo -e "\e]4;14;#3AC0FF\a" | tr -d '\n' # light cyan 17 | echo -e "\e]4;15;#ffffff\a" | tr -d '\n' # bold white 18 | -------------------------------------------------------------------------------- /plugins/color-switch/themes/warm.theme: -------------------------------------------------------------------------------- 1 | # warm theme 2 | echo -e "\e]4;00;#888888\a" | tr -d '\n' # black 3 | echo -e "\e]4;01;#FF7E69\a" | tr -d '\n' # red 4 | echo -e "\e]4;02;#53E27E\a" | tr -d '\n' # green 5 | echo -e "\e]4;03;#FFFA75\a" | tr -d '\n' # yellow 6 | echo -e "\e]4;04;#26B3FF\a" | tr -d '\n' # blue 7 | echo -e "\e]4;05;#FF90F7\a" | tr -d '\n' # purple 8 | echo -e "\e]4;06;#71C29B\a" | tr -d '\n' # cyan 9 | echo -e "\e]4;07;#FF7A00\a" | tr -d '\n' # light gray 10 | echo -e "\e]4;08;#6B7A7D\a" | tr -d '\n' # gray 11 | echo -e "\e]4;09;#ff5555\a" | tr -d '\n' # light red 12 | echo -e "\e]4;10;#4DE57B\a" | tr -d '\n' # light green 13 | echo -e "\e]4;11;#ACCFFB\a" | tr -d '\n' # light yellow 14 | echo -e "\e]4;12;#C7D2FB\a" | tr -d '\n' # light blue 15 | echo -e "\e]4;13;#E2BFFF\a" | tr -d '\n' # light purple 16 | echo -e "\e]4;14;#FFD8B2\a" | tr -d '\n' # light cyan 17 | echo -e "\e]4;15;#ffffff\a" | tr -d '\n' # bold white 18 | -------------------------------------------------------------------------------- /plugins/colors/plugin: -------------------------------------------------------------------------------- 1 | autoload colors 2 | if [[ "$terminfo[colors]" -gt 8 ]]; then 3 | colors 4 | fi 5 | for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do 6 | eval $COLOR='$fg_no_bold[${(L)COLOR}]' 7 | eval BOLD_$COLOR='$fg_bold[${(L)COLOR}]' 8 | done 9 | eval RESET='$reset_color' 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /plugins/cygwin/func/cyg-pkill: -------------------------------------------------------------------------------- 1 | # kill matching processes 2 | cyg-pkill() { 3 | if [ $1 ]; then 4 | pids=($(zeesh_psgrep "$@" | tr -s '[:space:]' | cut -d ' ' -f3 )) 5 | if [[ $pids[1] != '' ]]; then 6 | echo "killed:" 7 | zeesh_psgrep "$@" 8 | for pid in $pids 9 | do 10 | /bin/kill -f $pid 11 | done 12 | else 13 | echo "No matches" 14 | fi 15 | unset pids 16 | fi 17 | } 18 | 19 | # vim: ft=zsh 20 | -------------------------------------------------------------------------------- /plugins/cygwin/func/cyg-uptime: -------------------------------------------------------------------------------- 1 | # check uptime on windows 2 | cyg-uptimg() { 3 | systeminfo | grep 'Boot Time' | cut -c28- 4 | } 5 | 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /plugins/cygwin/func/foobar: -------------------------------------------------------------------------------- 1 | foobar() { 2 | /cygdrive/c/Program\ Files\ \(x86\)/foobar2000/foobar2000.exe $@ &! 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/cygwin/func/precmd: -------------------------------------------------------------------------------- 1 | # precmd is called just before the prompt is printed 2 | precmd() { 3 | print -Pn "\e]0;%n@%m:%~\a" 4 | } 5 | 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /plugins/cygwin/func/preexec: -------------------------------------------------------------------------------- 1 | # preexec is called just before any command line is executed 2 | preexec() { 3 | print -Pn "\e]0;%n@%m:%~ [$1]\a" 4 | } 5 | 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /plugins/cygwin/plugin: -------------------------------------------------------------------------------- 1 | ### cygwin / zeesh! plugin 2 | ### Makes life in cygwin a bit more comfortable. 3 | 4 | fpath=( ~/.zsh/plugins/cygwin/func $fpath ) 5 | autoload -U ~/.zsh/plugins/cygwin/func/*(:t) 6 | 7 | export PATH=/usr/local/bin:/usr/bin:$PATH 8 | export LS_COLORS='di=34:ln=35:so=32:pi=33;40:ex=31:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' 9 | export USING_CYGWIN=1 10 | 11 | # no core dumps 12 | ulimit -S -c 0 > /dev/null 2>&1 13 | 14 | ## aliases 15 | alias ls='ls -AF --color=auto' 16 | alias ex='explorer' 17 | alias foo=foobar 18 | alias fb=foobar 19 | alias kill='kill -f' 20 | alias ps='ps -W -a -f' 21 | alias pk='cyg-pkill' 22 | alias uptime='cyg-uptime' 23 | alias open='cygstart' 24 | alias o='cygstart' 25 | 26 | last-modified(){ 27 | stat -c '%Y' $1 28 | } 29 | 30 | # vim: ft=zsh 31 | -------------------------------------------------------------------------------- /plugins/disable-xoff/plugin: -------------------------------------------------------------------------------- 1 | # disables xon/xoff 2 | stty stop undef 3 | stty start undef 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/django/plugin: -------------------------------------------------------------------------------- 1 | ### django / zeesh! plugin 2 | 3 | ## aliases 4 | alias manage='./manage.py' 5 | alias dj='./manage.py' 6 | alias rs='./manage.py runserver 0.0.0.0:8000' 7 | alias rb='./manage.py runbebop 0.0.0.0:8000' 8 | alias djproj=django-startproj 9 | alias djapp='./manage.py startapp' 10 | alias djsync'./manage.py syncdb' 11 | alias djshell='./manage.py shell' 12 | alias djload='./manage.py loaddata fixtures/*' 13 | 14 | # vim: ft=zsh 15 | -------------------------------------------------------------------------------- /plugins/freebsd/func/list_syctls: -------------------------------------------------------------------------------- 1 | list_sysctls() { 2 | set -A reply $(sysctl -AN ${1%.*} 2>/dev/null) 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/freebsd/plugin: -------------------------------------------------------------------------------- 1 | ### freebsd / zeesh! plugin 2 | 3 | fpath=( ~/.zsh/plugins/osx/func $fpath ) 4 | autoload -U ~/.zsh/plugins/osx/func/*(:t) 5 | 6 | ## exports 7 | export LSCOLORS=ExfxcxdxbxegedabagAcEx 8 | export PATH=~/.bin:~/.ellipsis/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin 9 | 10 | ## alias 11 | alias ls='ls -AGF' 12 | 13 | ## comp 14 | compctl -K list_sysctls sysctl 15 | compctl -c man 16 | compctl -c info 17 | compctl -c which 18 | # no core dumps 19 | limit core 0 20 | 21 | ps() { 22 | if [ $1 ]; then 23 | /bin/ps $@ 24 | else 25 | /bin/ps ux 26 | fi 27 | } 28 | 29 | last-modified() { 30 | stat -f '%m' $1 31 | } 32 | 33 | # vim: ft=zsh 34 | -------------------------------------------------------------------------------- /plugins/git/commands/git-alias: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case $# in 4 | 0) git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort ;; 5 | 1) git alias | grep -e "$1" ;; 6 | *) git config --global "alias.$1" "$2" ;; 7 | esac 8 | -------------------------------------------------------------------------------- /plugins/git/commands/git-branch-by-time: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # create temp file 4 | echo > /tmp/gbt 5 | 6 | # get current branch name 7 | branch="$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')" 8 | 9 | # append branches 10 | IFS=$'\n' branches=($(git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short)|%(objectname:short)|%(contents:subject)|%(authorname), %(committerdate:relative)')) 11 | 12 | for b in ${branches[*]}; do 13 | if [ "$branch" ] && [ "$(echo $b | grep $branch)" ]; then 14 | echo '|* '"$b" >> /tmp/gbt 15 | else 16 | echo '| '"$b" >> /tmp/gbt 17 | fi 18 | done 19 | 20 | # append remotes 21 | IFS=$'\n' branches=($(git for-each-ref --sort=-committerdate refs/remotes/ --format='remotes/%(refname:short)|%(objectname:short)|%(contents:subject)|%(authorname), %(committerdate:relative)')) 22 | 23 | for b in ${branches[*]}; do 24 | echo '| '"$b" >> /tmp/gbt 25 | done 26 | 27 | # output table 28 | cat /tmp/gbt | column -t -s "|" 29 | -------------------------------------------------------------------------------- /plugins/git/commands/git-changelog: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FILE="" 4 | LIST=false 5 | TAG="n.n.n" 6 | GIT_LOG_OPTS="" 7 | 8 | while [ "$1" != "" ]; do 9 | case $1 in 10 | -l | --list ) 11 | LIST=true 12 | ;; 13 | -t | --tag ) 14 | TAG=$2 15 | shift 16 | ;; 17 | --no-merges ) 18 | GIT_LOG_OPTS='--no-merges' 19 | ;; 20 | * ) 21 | FILE=$1 22 | ;; 23 | esac 24 | shift 25 | done 26 | 27 | DATE=`date +'%Y-%m-%d'` 28 | HEAD="\n$TAG / $DATE\n==================\n\n" 29 | 30 | if $LIST; then 31 | version=$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1)) 32 | if test -z "$version"; then 33 | git log $GIT_LOG_OPTS --pretty="format: * %s" 34 | else 35 | git log $GIT_LOG_OPTS --pretty="format: * %s" $version.. 36 | fi 37 | exit 38 | fi 39 | 40 | CHANGELOG=$FILE 41 | if test "$CHANGELOG" = ""; then 42 | CHANGELOG=`ls | egrep 'change|history' -i` 43 | if test "$CHANGELOG" = ""; then 44 | CHANGELOG='History.md'; 45 | fi 46 | fi 47 | tmp="/tmp/changelog" 48 | printf "$HEAD" > $tmp 49 | git-changelog $GIT_LOG_OPTS --list >> $tmp 50 | printf '\n' >> $tmp 51 | if [ -f $CHANGELOG ]; then cat $CHANGELOG >> $tmp; fi 52 | mv $tmp $CHANGELOG 53 | test -n "$EDITOR" && $EDITOR $CHANGELOG 54 | -------------------------------------------------------------------------------- /plugins/git/commands/git-changes: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Save diff-stat log 4 | git log --all --stat "$@" > /tmp/git-churn.txt 5 | 6 | # Sum file/insertion/deletion changes. 7 | files=`perl -n -e '/(\d+) file/ && print $1."\n"' /tmp/git-churn.txt | awk '{sum+=$1}END{print sum}'` 8 | insertions=`perl -n -e '/(\d+) insertion/ && print $1."\n"' /tmp/git-churn.txt | awk '{sum+=$1}END{print sum}'` 9 | deletions=`perl -n -e '/(\d+) deletion/ && print $1."\n"' /tmp/git-churn.txt | awk '{sum+=$1}END{print sum}'` 10 | 11 | echo "$files files changed, $insertions insertions(+), $deletions deletions(-)" 12 | -------------------------------------------------------------------------------- /plugins/git/commands/git-churn: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Written by Corey Haines 4 | # Scriptified by Gary Bernhardt 5 | # 6 | # Put this anywhere on your $PATH (~/bin is recommended). Then git will see it 7 | # and you'll be able to do `git churn`. 8 | # 9 | # Show churn for whole repo: 10 | # $ git churn 11 | # 12 | # Show churn for specific directories: 13 | # $ git churn app lib 14 | # 15 | # Show churn for a time range: 16 | # $ git churn --since='1 month ago' 17 | # 18 | # (These are all standard arguments to `git log`.) 19 | 20 | set -e 21 | git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count\tfile"} {print $1 "\t" $2}' | sort -g 22 | 23 | 24 | -------------------------------------------------------------------------------- /plugins/git/commands/git-clone-subdir: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | git clone $1 `basename $2` 4 | cd `basename $2` 5 | git filter-branch --prune-empty --subdirectory-filter $2 master 6 | -------------------------------------------------------------------------------- /plugins/git/commands/git-divergence: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | ( 6 | branch() { 7 | git branch 2>/dev/null | grep -e '^*' | tr -d '\* ' 8 | } 9 | 10 | ensure_valid_ref() { 11 | ref=$1 12 | ( 13 | set +e 14 | git show-ref $ref > /dev/null 15 | if [[ $? == 1 ]]; then 16 | echo "$0: bad ref: $ref" 17 | exit 1 18 | fi 19 | ) 20 | } 21 | 22 | show_rev() { 23 | rev=$1 24 | git --no-pager log -1 $rev --graph --pretty=format:'%C(yellow)%h%Cblue%d%Creset %s %C(white)%an, %ar%Creset' 25 | echo 26 | git --no-pager diff --stat $rev^..$rev 27 | echo 28 | } 29 | 30 | if [[ $# == 2 ]]; then 31 | LOCAL=$1 32 | REMOTE=$2 33 | elif [[ $# == 1 ]]; then 34 | LOCAL=`branch` 35 | REMOTE=$1 36 | else 37 | LOCAL=`branch` 38 | REMOTE=origin/$LOCAL 39 | fi 40 | 41 | ensure_valid_ref $LOCAL 42 | ensure_valid_ref $REMOTE 43 | 44 | echo "changes from local ${LOCAL} to remote ${REMOTE}:" 45 | 46 | echo 47 | echo incoming: 48 | for rev in `git rev-list $LOCAL..$REMOTE`; do 49 | show_rev $rev 50 | done 51 | 52 | echo 53 | echo outgoing: 54 | for rev in `git rev-list $REMOTE..$LOCAL`; do 55 | show_rev $rev 56 | done 57 | ) 58 | -------------------------------------------------------------------------------- /plugins/git/commands/git-effort: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | tmp=/tmp/.git-effort 4 | above='0' 5 | color= 6 | 7 | # 8 | # get date for the given 9 | # 10 | 11 | date() { 12 | git log --pretty='format: %ai' $1 | cut -d ' ' -f 2 13 | } 14 | 15 | # 16 | # hide cursor 17 | # 18 | 19 | hide_cursor() { 20 | printf '\033[?25l' 21 | } 22 | 23 | # 24 | # show cursor 25 | # 26 | 27 | show_cursor() { 28 | printf '\033[?25h' 29 | printf '\033[m\n' 30 | exit 1 31 | } 32 | 33 | # 34 | # get active days for the given 35 | # 36 | 37 | active_days() { 38 | date $1 | uniq | awk ' 39 | { sum += 1 } 40 | END { print sum } 41 | ' 42 | } 43 | 44 | # 45 | # set 'color' based on the given 46 | # 47 | 48 | color_for() { 49 | test $1 -gt 10 && color='33' 50 | test $1 -gt 25 && color='33;1' 51 | test $1 -gt 50 && color='93' 52 | test $1 -gt 75 && color='93;1' 53 | test $1 -gt 100 && color='31' 54 | test $1 -gt 125 && color='31;1' 55 | test $1 -gt 150 && color='91' 56 | test $1 -gt 200 && color='91;1' 57 | } 58 | 59 | # 60 | # compute the effort of the given 61 | # 62 | 63 | effort() { 64 | for file in $@; do 65 | commits=`git log --oneline $file | wc -l` 66 | color='90' 67 | 68 | # ignore <= --above 69 | test $commits -le $above && continue 70 | 71 | # commits 72 | color_for $commits 73 | len=${#file} 74 | dot="." 75 | f_dot=$file 76 | i=0 ; while test $i -lt $((45-$len)) ; do 77 | f_dot=$f_dot$dot 78 | i=$(($i+1)) 79 | done 80 | 81 | printf " \033[${color}m%s %-10d" $f_dot $commits 82 | 83 | # active days 84 | active=`active_days $file` 85 | color_for $active 86 | printf "\033[${color}m %d\033[0m\n" $active 87 | done 88 | } 89 | 90 | # 91 | # print heading 92 | # 93 | 94 | heading() { 95 | echo 96 | printf " %-45s %-10s %s\n" 'file' 'commits' 'active days' 97 | echo 98 | } 99 | 100 | # 101 | # output sorted results 102 | # 103 | 104 | sort_effort() { 105 | clear 106 | echo 107 | heading 108 | cat $tmp | sort -rn -k 2 109 | } 110 | 111 | # --above 112 | 113 | if test "$1" = "--above"; then 114 | shift; above=$1 115 | shift 116 | fi 117 | 118 | # [file ...] 119 | 120 | if test $# -ge 1; then 121 | files=$@ 122 | else 123 | files=`git ls-files` 124 | fi 125 | 126 | # hide cursor 127 | 128 | hide_cursor 129 | trap show_cursor INT 130 | 131 | # loop files 132 | 133 | heading 134 | effort $files | tee $tmp && sort_effort 135 | echo 136 | 137 | show_cursor 138 | -------------------------------------------------------------------------------- /plugins/git/commands/git-ignore: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | show_contents() { 4 | test -f "$2" && echo "$1 gitignore: $2" && cat "$2" 5 | } 6 | 7 | show_global() { 8 | show_contents Global `git config --global core.excludesfile` 9 | } 10 | 11 | add_global() { 12 | add_patterns `git config --global core.excludesfile` "$@" 13 | } 14 | 15 | show_local() { 16 | show_contents Local .gitignore 17 | } 18 | 19 | add_local() { 20 | add_patterns .gitignore "$@" 21 | } 22 | 23 | add_patterns() { 24 | echo "Adding pattern(s) to: $1" 25 | for pattern in "${@:2}"; do 26 | echo "... adding '$pattern'" 27 | (test -f "$1" && test "$pattern" && grep -q "$pattern" "$1") || echo "$pattern" >> "$1" 28 | done 29 | } 30 | 31 | if test $# -eq 0; then 32 | show_global 33 | echo "---------------------------------" 34 | show_local 35 | else 36 | case "$1" in 37 | -l|--local) 38 | test $# -gt 1 && add_local "${@:2}" && echo 39 | show_local 40 | ;; 41 | -g|--global) 42 | test $# -gt 1 && add_global "${@:2}" && echo 43 | show_global 44 | ;; 45 | *) 46 | add_local "$@" 47 | ;; 48 | esac 49 | fi 50 | -------------------------------------------------------------------------------- /plugins/git/commands/git-info: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | get_config() { 4 | git config --list 5 | } 6 | 7 | most_recent_commit() { 8 | git log --max-count=1 --pretty=short 9 | } 10 | 11 | local_branches() { 12 | git branch 13 | } 14 | 15 | remote_branches() { 16 | git branch -r 17 | } 18 | 19 | remote_urls() { 20 | git remote -v 21 | } 22 | 23 | # Show info similar to svn 24 | 25 | echo 26 | echo "## Remote URLs:\n" 27 | echo "$(remote_urls)\n" 28 | 29 | echo "## Remote Branches:\n" 30 | echo "$(remote_branches)\n" 31 | 32 | echo "## Local Branches:\n" 33 | echo "$(local_branches)\n" 34 | 35 | echo "## Most Recent Commit:\n" 36 | echo "$(most_recent_commit)\n" 37 | echo "Type 'git log' for more commits, or 'git show ' for full commit details.\n" 38 | 39 | if test "$1" != "--no-config"; then 40 | echo "## Configuration (.git/config):\n" 41 | echo "$(get_config)\n" 42 | fi -------------------------------------------------------------------------------- /plugins/git/commands/git-log-fuzzy-file-search: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | prefix=$(echo `pwd` | sed "s:`git root`/::") 4 | 5 | if [ "$1" = "" ]; then 6 | echo Filter required 7 | else 8 | git log -n 500 --pretty=format: --name-only . | sed "s:$prefix/::" | sort -u | grep "$1" | xargs git log --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white)%an, %ar%Creset' --stat -- 9 | fi 10 | -------------------------------------------------------------------------------- /plugins/git/commands/git-promote: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Promotes a local topic branch to a remote tracking branch of the same name, 4 | # by pushing and then setting up the git config 5 | 6 | # Thanks to ENTP: http://hoth.entp.com/2008/11/10/improving-my-git-workflow 7 | 8 | curr_branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||') 9 | 10 | remote_branch=$(git branch -r | grep "origin/${curr_branch}") 11 | [ -z "${remote_branch}" ] && ( git push origin "${curr_branch}" ) 12 | 13 | origin=$(git config --get "branch.${curr_branch}.remote") 14 | [ -z "${origin}" ] && ( git config --add "branch.${curr_branch}.remote" origin ) 15 | 16 | merge=$(git config --get "branch.${curr_branch}.merge") 17 | [ -z "${merge}" ] && ( git config --add "branch.${curr_branch}.merge" "refs/heads/${curr_branch}" ) 18 | -------------------------------------------------------------------------------- /plugins/git/commands/git-quick-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # parse arguments 4 | args=() 5 | words=() 6 | i=1 7 | while [ $i -le $# ]; do 8 | arg="${@[$i]}" 9 | case $arg in 10 | -*) 11 | args[$i]=$arg 12 | ;; 13 | *) 14 | words[$i]=$arg 15 | ;; 16 | esac 17 | let i++ 18 | done 19 | 20 | # join message 21 | message='' 22 | for i in ${words[*]}; do 23 | if [ "$message" ]; then 24 | message="$message $i" 25 | else 26 | message="$i" 27 | fi 28 | done 29 | 30 | if [ "$message" ]; then 31 | git commit ${args[*]} -m "$message" 32 | else 33 | git commit ${args[*]} 34 | fi 35 | -------------------------------------------------------------------------------- /plugins/git/commands/git-rename-tag: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | old=$1 4 | new=$2 5 | 6 | test -z $old && echo "old tag name required." 1>&2 && exit 1 7 | test -z $new && echo "new tag name required." 1>&2 && exit 1 8 | 9 | git tag $new $old 10 | git tag -d $old 11 | git push origin $new 12 | git push origin :refs/tag/$old -------------------------------------------------------------------------------- /plugins/git/commands/git-repl: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while true; do 4 | # Current branch 5 | cur=`git symbolic-ref HEAD 2> /dev/null | cut -d/ -f3-` 6 | 7 | # Prompt 8 | if test -n "$cur"; then 9 | prompt="git ($cur)> " 10 | else 11 | prompt="git> " 12 | fi 13 | 14 | # Readline 15 | read -e -r -p "$prompt" cmd 16 | 17 | # EOF 18 | test $? -ne 0 && break 19 | 20 | # History 21 | history -s "$cmd" 22 | 23 | # Built-in commands 24 | case $cmd in 25 | ls) cmd=ls-files;; 26 | "") continue;; 27 | quit) break;; 28 | esac 29 | 30 | if [[ $cmd == !* ]]; then 31 | eval ${cmd:1} 32 | elif [[ $cmd == git* ]]; then 33 | eval $cmd 34 | else 35 | eval git "$cmd" 36 | fi 37 | done 38 | 39 | echo 40 | -------------------------------------------------------------------------------- /plugins/git/commands/git-resolve: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | IFS=$'\n' files=($(git ls-files --unmerged | cut -f2 | uniq)) 4 | 5 | for file in ${files[*]}; do 6 | git checkout $@ $file 7 | git add $file 8 | done 9 | -------------------------------------------------------------------------------- /plugins/git/commands/git-summary: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | commit="" 4 | test $# -ne 0 && commit=$@ 5 | project=${PWD##*/} 6 | 7 | # 8 | # get date for the given 9 | # 10 | 11 | date() { 12 | git log --pretty='format: %ai' $1 | cut -d ' ' -f 2 13 | } 14 | 15 | # 16 | # get active days for the given 17 | # 18 | 19 | active_days() { 20 | date $1 | uniq | awk ' 21 | { sum += 1 } 22 | END { print sum } 23 | ' 24 | } 25 | 26 | # 27 | # get the commit total 28 | # 29 | 30 | commit_count() { 31 | git log --oneline $commit | wc -l | tr -d ' ' 32 | } 33 | 34 | # 35 | # total file count 36 | # 37 | 38 | file_count() { 39 | git ls-files | wc -l | tr -d ' ' 40 | } 41 | 42 | # 43 | # list authors 44 | # 45 | 46 | authors() { 47 | git shortlog -n -s $commit | awk ' 48 | { args[NR] = $0; sum += $0 } 49 | END { 50 | for (i = 1; i <= NR; ++i) { 51 | printf "%-30s %2.1f%%\n", args[i], 100 * args[i] / sum 52 | } 53 | } 54 | ' 55 | } 56 | 57 | # 58 | # fetch repository age from oldest commit 59 | # 60 | 61 | repository_age() { 62 | git log --reverse --pretty=oneline --format="%ar" | head -n 1 | sed 's/ago//' 63 | } 64 | 65 | # summary 66 | 67 | echo 68 | echo " project : $project" 69 | echo " repo age :" $(repository_age) 70 | echo " active :" $(active_days) days 71 | echo " commits :" $(commit_count) 72 | if test "$commit" = ""; then 73 | echo " files :" $(file_count) 74 | fi 75 | echo " authors : " 76 | authors 77 | echo 78 | -------------------------------------------------------------------------------- /plugins/git/commands/git-unmerged: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | local unmerged unmerged_full stat 4 | unmerged=${(j:\|:)$(git ls-files --unmerged | cut -f 2 | uniq)} 5 | 6 | if [ "$unmerged" ]; then 7 | IFS=$'\n' unmerged_full=($(git status --short | grep --color=never $unmerged)) 8 | 9 | # this is all a bit overly complicated, just to get some nice colors ;_; 10 | for f in $unmerged_full; do 11 | echo -e "\e[0;31m${f% *}\e[m ${f#* }" 12 | done 13 | fi 14 | -------------------------------------------------------------------------------- /plugins/git/plugin: -------------------------------------------------------------------------------- 1 | ### git / zeesh! plugin 2 | 3 | fpath=( $plugin_dir/comp $fpath ) 4 | autoload -U $plugin_dir/comp/*(:t) 5 | 6 | # Ensure vcs info uses git, not hub 7 | zstyle ':vcs_info:git:*:-all-' command `which git` 8 | 9 | export PATH=$PATH:$plugin_dir/commands 10 | 11 | if hash hub 2>/dev/null; then 12 | alias git=hub 13 | fi 14 | 15 | gca() { 16 | # check for unmerged files 17 | if [ ! -z "`git status -s | grep '^U'`" ]; then 18 | git commit 19 | else 20 | noglob git-quick-commit -a $@ 21 | fi 22 | } 23 | 24 | gcA() { 25 | # check for unmerged files 26 | if [ ! -z "`git status -s | grep '^U'`" ]; then 27 | git commit 28 | else 29 | git add -A . 30 | noglob git-quick-commit $@ 31 | fi 32 | } 33 | 34 | alias ga='git add' 35 | alias gau='git add --update' 36 | alias gb='git branch -v -v' 37 | alias gba='git branch -v -v -a' 38 | alias gbd='git branch -D' 39 | alias gbt=git-branch-by-time 40 | alias gc='noglob git-quick-commit' 41 | alias gcl='git clone' 42 | alias gco-ours="git ls-files --unmerged | cut -f2 | uniq | xargs git checkout --ours" 43 | alias gco-theirs="git ls-files --unmerged | cut -f2 | uniq | xargs git checkout --theirs" 44 | alias gco='git checkout' 45 | alias gd='git diff --color' 46 | alias gds='git diff --color --stat' 47 | alias gda='git diff HEAD --color' 48 | alias gdas='git diff HEAD --color --stat' 49 | alias gdss='git diff --color --staged --stat' 50 | alias gf='git fetch' 51 | alias gl="git log -n 500 --pretty=format':%C(green)%h%Cblue%d%C(black) %s %C(white)%an, %ar%Creset'" 52 | alias glg="gl --graph" 53 | alias glp="gl -p --color" 54 | alias gls="gl --stat" 55 | alias gm='git merge --no-ff' 56 | alias gmf='git merge --ff-only' 57 | alias gmt='git mergetool -y' 58 | alias gpl='git pull' 59 | alias gprq='hub pull-request' 60 | alias gps='git push' 61 | alias gr='git reset' 62 | alias gr='git rebase' 63 | alias gra='git rebase --abort' 64 | alias grc='git rebase --continue' 65 | alias grs='git rebase --skip' 66 | alias grba='git rebase --abort' 67 | alias grbc='git rebase --continue' 68 | alias grbs='git rebase --skip' 69 | alias grh='git reset --hard' 70 | alias gs='git status -s' 71 | alias gum=git-unmerged 72 | alias gv='noglob git vim' 73 | 74 | # completion for custom commands 75 | zstyle ':completion:*:*:hub:*' user-commands \ 76 | pull-request:'open a pull request on GitHub' \ 77 | fork:'fork remote repository on GitHub and add as remote' \ 78 | create:'create this repository on GitHub and add GitHub as origin' \ 79 | browse:'open a GitHub page in the default browser' \ 80 | compare:'open a compare page on GitHub' \ 81 | branch-by-time:'list branches ordered by time' \ 82 | changes:'show file and line changes' \ 83 | churn:'show files with most commits' \ 84 | divergence:'show differences between incoming and outgoing branches' \ 85 | promote:'promotes a local topic branch to a remote tracking branch of the same name' \ 86 | quick-commit:'quickly commit' \ 87 | resolve:'resolve merge conflicts using a specific version of the conflicted files' \ 88 | unmerged:'list unmerged files' 89 | 90 | # vim: ft=zsh 91 | -------------------------------------------------------------------------------- /plugins/go/plugin: -------------------------------------------------------------------------------- 1 | # zeesh go plugin 2 | 3 | # Source GVM if it's installed 4 | [[ -s ~/.gvm/scripts/gvm ]] && source ~/.gvm/scripts/gvm 5 | 6 | # Set GOPATH to ~/go 7 | export GOPATH=~/go 8 | 9 | # Add Go binaries to path 10 | export PATH=$GOPATH/bin:$PATH 11 | 12 | # vim: ft=zsh 13 | -------------------------------------------------------------------------------- /plugins/haskell/plugin: -------------------------------------------------------------------------------- 1 | # haskell zshfu plugin 2 | #fpath=( ~/.zsh/plugins/haskell/func $fpath ) 3 | #autoload -U ~/.zsh/plugins/haskell/func/*(:t) 4 | 5 | export PATH=~/.cabal/bin:~/Library/Haskell/bin:$PATH 6 | 7 | # alias ghci='ghci 2>&1 | HsColour -tty' 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/history-substring-search/install: -------------------------------------------------------------------------------- 1 | repo="git://github.com/zsh-users/zsh-history-substring-search.git" 2 | 3 | echo -n "I can't find zsh-$plugin would you like me to install it for you? (y/N) " 4 | read ans 5 | if [[ "$ans" == "y" ]]; then 6 | git clone --depth 1 $repo $plugin_dir/lib 7 | echo "...installed $plugin" 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/history-substring-search/plugin: -------------------------------------------------------------------------------- 1 | ### history-substring-search / zeesh! plugin 2 | 3 | [ -d "$plugin_dir/lib" ] || source "$plugin_dir/install" 4 | 5 | source "$plugin_dir/lib/zsh-$plugin.zsh" 6 | 7 | if [ "$EDITOR" = "vim" ]; then 8 | # arrow key bindings delay escape so you might want to unbind them: 9 | # bindkey -r "^[[0A" 10 | # bindkey -r "^[[0B" 11 | # bindkey -r "^[[A" 12 | # bindkey -r "^[[B" 13 | 14 | # disable normal history search 15 | bindkey -r "^R" 16 | 17 | # search up/down history with ^n/p 18 | bindkey -M viins '^j' history-substring-search-up 19 | bindkey -M viins '^k' history-substring-search-up 20 | 21 | bindkey -M viins '^p' history-substring-search-down 22 | bindkey -M viins '^p' history-substring-search-down 23 | 24 | bindkey -M vicmd '^n' history-substring-search-up 25 | bindkey -M vicmd '^p' history-substring-search-down 26 | 27 | bindkey -M viins "^[[0A" history-substring-search-up 28 | bindkey -M viins "^[[0B" history-substring-search-down 29 | bindkey -M viins "OA" history-substring-search-up 30 | bindkey -M viins "OB" history-substring-search-down 31 | bindkey -M viins "^[[A" history-substring-search-up 32 | bindkey -M viins "^[[B" history-substring-search-down 33 | 34 | bindkey -M vicmd "^[[0A" history-substring-search-up 35 | bindkey -M vicmd "^[[0B" history-substring-search-down 36 | bindkey -M vicmd "^[[A" history-substring-search-up 37 | bindkey -M vicmd "^[[B" history-substring-search-down 38 | bindkey -M vicmd "OA" history-substring-search-up 39 | bindkey -M vicmd "OB" history-substring-search-down 40 | fi 41 | 42 | # vim: ft=zsh 43 | -------------------------------------------------------------------------------- /plugins/ipython/plugin: -------------------------------------------------------------------------------- 1 | ### ipython / zeesh! plugin 2 | # 3 | # wrapper for ipython 4 | 5 | # fpath=( ~/.zsh/plugins/ipython/func $fpath ) 6 | # autoload -U ~/.zsh/plugins/ipython/func/*(:t) 7 | export _kernel_home=~/.ipython/profile_default/security 8 | 9 | ipython-kernel-launch() { 10 | ipython kernel &! 11 | local pid=$! 12 | echo "--existing kernel-$pid.json" | pbcopy 13 | } 14 | 15 | ipython-kernel-list() { 16 | for f in `ls $_kernel_home`; do 17 | echo `basename $f` | sed 's/\(kernel-[0-9]*\).*/\1/' 18 | done 19 | } 20 | 21 | _ipython-kill-pid() { 22 | kill `echo $1 | sed 's/kernel-\([0-9]*\).*/\1/'` 23 | rm $_kernel_home/$1.json 24 | echo "killed $1" 25 | } 26 | 27 | ipython-kill() { 28 | if [ $1 ]; then 29 | if [[ $1 == "all" ]]; then 30 | for kernel in `ipython-kernel-list`; do 31 | _ipython-kill-pid $kernel 32 | done 33 | else 34 | for kernel in `ipython-kernel-list | /usr/bin/grep $1`; do 35 | _ipython-kill-pid $kernel 36 | done 37 | fi 38 | fi 39 | } 40 | 41 | ipython-kernel() { 42 | if [ $1 ]; then 43 | case $1 in 44 | kill) 45 | if [ $2 ]; then 46 | ipython-kill $2 47 | else 48 | echo "Specify a kernel to kill" 49 | fi 50 | ;; 51 | launch) 52 | ipython-kernel-launch 53 | ;; 54 | list|*) 55 | ipython-kernel-list 56 | ;; 57 | esac 58 | else 59 | ipython-kernel-list 60 | fi 61 | } 62 | 63 | # vim: ft=zsh 64 | -------------------------------------------------------------------------------- /plugins/iterm2/plugin: -------------------------------------------------------------------------------- 1 | # zeesh! / iterm2 plugin 2 | 3 | if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then 4 | [ -f ~/.iterm2_shell_integration.zsh ] && source ~/.iterm2_shell_integration.zsh 5 | fi 6 | 7 | # vim: ft=zsh 8 | -------------------------------------------------------------------------------- /plugins/javascript/npm.sh: -------------------------------------------------------------------------------- 1 | ###-begin-npm-completion-### 2 | # 3 | # npm command completion script 4 | # 5 | # Installation: npm completion >> ~/.bashrc (or ~/.zshrc) 6 | # Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm 7 | # 8 | 9 | COMP_WORDBREAKS=${COMP_WORDBREAKS/=/} 10 | COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} 11 | export COMP_WORDBREAKS 12 | 13 | if type complete &>/dev/null; then 14 | _npm_completion () { 15 | local si="$IFS" 16 | IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \ 17 | COMP_LINE="$COMP_LINE" \ 18 | COMP_POINT="$COMP_POINT" \ 19 | npm completion -- "${COMP_WORDS[@]}" \ 20 | 2>/dev/null)) || return $? 21 | IFS="$si" 22 | } 23 | complete -o default -F _npm_completion npm 24 | elif type compdef &>/dev/null; then 25 | _npm_completion() { 26 | local si=$IFS 27 | compadd -- $(COMP_CWORD=$((CURRENT-1)) \ 28 | COMP_LINE=$BUFFER \ 29 | COMP_POINT=0 \ 30 | npm completion -- "${words[@]}" \ 31 | 2>/dev/null) 32 | IFS=$si 33 | } 34 | compdef _npm_completion npm 35 | elif type compctl &>/dev/null; then 36 | _npm_completion () { 37 | local cword line point words si 38 | read -Ac words 39 | read -cn cword 40 | let cword-=1 41 | read -l line 42 | read -ln point 43 | si="$IFS" 44 | IFS=$'\n' reply=($(COMP_CWORD="$cword" \ 45 | COMP_LINE="$line" \ 46 | COMP_POINT="$point" \ 47 | npm completion -- "${words[@]}" \ 48 | 2>/dev/null)) || return $? 49 | IFS="$si" 50 | } 51 | compctl -K _npm_completion npm 52 | fi 53 | ###-end-npm-completion-### 54 | -------------------------------------------------------------------------------- /plugins/javascript/plugin: -------------------------------------------------------------------------------- 1 | ### javascript / zeesh! plugin 2 | 3 | ## exports 4 | export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules:/usr/lib/node_modules 5 | 6 | #. ~/.zsh/plugins/javascript/npm.sh 7 | 8 | alias coffee='coffee --nodejs --harmony' 9 | alias node='node --harmony' 10 | 11 | if hash sake 2>/dev/null; then 12 | alias cake=sake 13 | fi 14 | 15 | if hash pnpm 2>/dev/null; then 16 | alias pn=pnpm 17 | fi 18 | 19 | # vim: ft=zsh 20 | -------------------------------------------------------------------------------- /plugins/kubernetes/plugin: -------------------------------------------------------------------------------- 1 | ### kubernetes / zeesh! plugin 2 | 3 | if hash kubectl 2>/dev/null; then 4 | if [[ ! -a $plugin_dir/comp.zsh ]]; then 5 | kubectl completion zsh > $plugin_dir/comp.zsh 6 | fi 7 | source $plugin_dir/comp.zsh 8 | fi 9 | 10 | # This command is used ALOT both below and in daily life 11 | alias k=kubectl 12 | 13 | # Apply a YML file 14 | alias kaf='k apply -f' 15 | 16 | # Drop into an interactive terminal on a container 17 | alias keti='k exec -ti' 18 | 19 | # Manage configuration quickly to switch contexts between local, dev ad staging. 20 | alias kcuc='k config use-context' 21 | alias kcsc='k config set-context' 22 | alias kcdc='k config delete-context' 23 | alias kccc='k config current-context' 24 | 25 | alias kg='k get -o wide' 26 | alias ke='k edit' 27 | alias kd='k describe' 28 | alias krm='k delete' 29 | 30 | # Node management. 31 | alias kgn='kg nodes' 32 | alias kdn='kd nodes' 33 | alias ken='ke nodes' 34 | 35 | # Pod management. 36 | alias kgp='kg pods' 37 | alias kdp='kd pods' 38 | alias kep='ke pods' 39 | 40 | # Service management. 41 | alias kgs='kg svc' 42 | alias kds='kd svc' 43 | alias kes='ke svc' 44 | 45 | # Service account management 46 | alias kgsa='kg sa' 47 | alias kdsa='kd sa' 48 | alias kesa='ke sa' 49 | 50 | # Secret management 51 | alias kgscr='kg secret' 52 | alias kdscr='kd secret' 53 | alias kescr='kd secret' 54 | 55 | # Deployment management. 56 | alias kgd='kg deployment' 57 | alias ked='ke deployment' 58 | alias kdd='kd deployment' 59 | alias ksd='k scale deployment' 60 | alias krsd='k rollout status deployment' 61 | 62 | # Rollout management. 63 | alias kgrs='k rs' 64 | alias krh='k rollout history' 65 | alias kru='k rollout undo' 66 | 67 | # Logs 68 | alias kl='k logs' 69 | alias klf='k logs -f' 70 | 71 | # vim: ft=zsh 72 | -------------------------------------------------------------------------------- /plugins/linux/func/ogrep: -------------------------------------------------------------------------------- 1 | ogrep() { 2 | if [ $1 ]; then 3 | files=("${$(ls | grep -i $1)}") 4 | for file in $files; do 5 | echo opening $file 6 | xdg-open $file 7 | done 8 | fi 9 | } 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /plugins/linux/plugin: -------------------------------------------------------------------------------- 1 | ### linux / zeesh! plugin 2 | 3 | fpath=( $plugin_dir/func $fpath ) 4 | autoload -U $plugin_dir/func/*(:t) 5 | 6 | setopt extended_glob 7 | export LS_COLORS='di=1;34:ln=35:so=32:pi=33;40:ex=31:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' 8 | export PATH=~/.bin:~/.bin/ellipsis:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin 9 | 10 | alias l='/bin/ls' 11 | alias ls='ls -F --color=auto' 12 | alias la='ls -AF --color=auto' 13 | alias lsa='ls -AF --color=auto' 14 | alias ll='ls -lhF --color=auto' 15 | alias lla='ls -lhAF --color=auto' 16 | alias lsla='ls -lhAF --color=auto' 17 | alias lt='ls -lhtF --color=auto' 18 | alias lta='ls -lhtAF --color=auto' 19 | 20 | alias open=xdg-open 21 | alias o=xdg-open 22 | 23 | # no core dumps 24 | ulimit -S -c 0 > /dev/null 2>&1 25 | 26 | ps() { 27 | if [ $1 ]; then 28 | /bin/ps $@ 29 | else 30 | /bin/ps ux 31 | fi 32 | } 33 | 34 | last-modified(){ 35 | stat -c '%Y' $1 36 | } 37 | 38 | # vim: ft=zsh 39 | -------------------------------------------------------------------------------- /plugins/login-info/plugin: -------------------------------------------------------------------------------- 1 | ### login-info / zeesh! plugin 2 | ### displays version information on login 3 | 4 | if [[ -o interactive ]]; then 5 | versions=(`~/.dot-files/scripts/dotfiles-version`) 6 | in_array plugins themes && theme=`cat .zsh/local/theme.last` 7 | if [ $theme ]; then 8 | echo "\e[1mzsh $ZSH_VERSION :: $versions :: $theme\e[0m" 9 | else 10 | echo "\e[1mzsh $ZSH_VERSION :: $versions\e[0m" 11 | fi 12 | fi 13 | 14 | # vim: ft=zsh 15 | -------------------------------------------------------------------------------- /plugins/lolz/plugin: -------------------------------------------------------------------------------- 1 | # LOL!!1 2 | 3 | alias wtf='dmesg' 4 | alias onoz='cat /var/log/errors.log' 5 | alias rtfm='man' 6 | 7 | alias visible='echo' 8 | alias invisible='cat' 9 | alias moar='more' 10 | 11 | alias icanhas='mkdir' 12 | alias donotwant='rm' 13 | alias dowant='cp' 14 | alias gtfo='mv' 15 | 16 | alias hai='cd' 17 | alias plz='pwd' 18 | 19 | alias inur='locate' 20 | 21 | alias nomz='ps -aux' 22 | alias nomnom='killall' 23 | 24 | alias cya='reboot' 25 | alias kthxbai='halt' 26 | 27 | # vim: ft=zsh 28 | -------------------------------------------------------------------------------- /plugins/mercurial/func/hgc: -------------------------------------------------------------------------------- 1 | hgc() { 2 | if [[ $# == 0 ]]; then 3 | hg ci 4 | else 5 | local message='' 6 | for i; do 7 | message="$message $i" 8 | done 9 | hg ci -m "$message" 10 | fi 11 | } 12 | 13 | # vim: ft=zsh 14 | -------------------------------------------------------------------------------- /plugins/mercurial/plugin: -------------------------------------------------------------------------------- 1 | ### mercurial / zeesh! plugin 2 | 3 | fpath=( $plugin_dir/func $fpath ) 4 | autoload -U $plugin_dir/func/*(:t) 5 | 6 | alias hgi='hg id -n -b -t' 7 | alias hgs='hg status' 8 | alias hga='hg add -v' 9 | alias hgr='hg rm -f -v' 10 | alias hgpl='hg pull' 11 | alias hgps='hg push' 12 | alias hgf='hg fetch' 13 | alias hgu='hg up' 14 | alias hgcp='hg ci && hg push' 15 | alias hgm='hg merge' 16 | alias hgl='hg log' 17 | alias hgd='hg diff' 18 | alias hg-merge-local='hg --config ui.merge=internal:local merge' 19 | alias hg-merge-other='hg --config ui.merge=internal:other merge' 20 | 21 | # vim: ft=zsh 22 | -------------------------------------------------------------------------------- /plugins/nvm/install: -------------------------------------------------------------------------------- 1 | echo -n "I can't find nvm-zsh, would you like me to install it for you? (y/N) " 2 | 3 | 4 | read ans 5 | if [[ "$ans" == "y" ]]; then 6 | git clone --depth 1 https://github.com/lukechilds/zsh-nvm $plugin_dir/lib 7 | echo "...installed nvm-zsh!" 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/nvm/plugin: -------------------------------------------------------------------------------- 1 | ### nvm / zeesh! plugin 2 | 3 | [ -d $plugin_dir/lib ] || . $plugin_dir/install 4 | 5 | export NVM_AUTO_USE=true 6 | export NVM_LAZY_LOAD=true 7 | export NVM_LAZY_LOAD_EXTRA_COMMANDS=('vim') 8 | export NVM_NO_USE=true 9 | source $plugin_dir/lib/zsh-nvm.plugin.zsh; 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /plugins/osx/func/addgroup: -------------------------------------------------------------------------------- 1 | #!/bin/zsh -f 2 | 3 | version="2.0.0" 4 | 5 | # The script must be run as an admin user 6 | # 7 | if [[ -z $(/usr/bin/id -p $USER | grep admin) ]];then 8 | print "You must be an administrative user with sudo privileges in order to run $0" 9 | fi 10 | 11 | # Obtained and modified from a bash shell script available at 12 | # http://www.osxfaq.com/tips/unix-tricks/week91/friday.ws 13 | 14 | # Modified to use Directory Service on 10.5.X 15 | 16 | # Create a group. 17 | # Takes a group name and gid and creates a new group in NetInfo groups 18 | 19 | # For 10.5: Eliminated niutil commands in favor of Directory Service 20 | 21 | progname=$0 22 | 23 | declare group gid # to hold the given group name and group id 24 | declare str # working 25 | 26 | 27 | usage() { 28 | print "Create a new group" 29 | print "Usage: $progname groupname gid" 30 | if [[ "$*" != "" ]]; then 31 | print "" 32 | print "Error: $*" 33 | fi 34 | return 1 35 | } 36 | 37 | # Check parameters 38 | # 39 | if [[ $# -ne 2 ]]; then 40 | usage 41 | return 1 42 | fi 43 | 44 | group="$1"; gid="$2" 45 | 46 | # check that the group id is numeric 47 | if [[ -z "$(echo $gid | egrep "^[[:digit:]]+$")" ]]; then 48 | usage "Group ID must be numeric" 49 | return 1 50 | fi 51 | 52 | # search Directory Service for the given group - it should not exist 53 | # str="$(nifind /groups/$group .)" 54 | str="$( dscl . -list /Groups | grep -w $group )" 55 | if [[ ! -z "$str" ]]; then 56 | usage "Group $group already exists" 57 | return 1 58 | fi 59 | 60 | 61 | # search Directory Service for the given gid - it should not exist 62 | #str="$(nireport . /groups gid | grep -w $uid)" 63 | str="$( dscl . -list /Users PrimaryGroupID | awk '{print $2}' | grep -w $gid)" 64 | if [[ ! -z "$str" ]]; then 65 | usage "Group ID $uid already exists" 66 | return 1 67 | fi 68 | 69 | # Add the new group to Directory Services 70 | # 71 | # add group and essential properties 72 | sudo dscl . create /groups/$group 73 | sudo dscl . create /groups/$group name $group 74 | sudo dscl . create /groups/$group passwd "*" 75 | sudo dscl . create /groups/$group gid $gid 76 | #dscl . create /groups/$group users "" breaks add-user2group if added as a blank value 77 | 78 | print "" 79 | print "New group $group has been created with gid $gid" 80 | print "" 81 | print "Reality check: The following is gleaned from the Directory Service database" 82 | print "The Directory Service database now contains $(dscl . -list /Groups | grep -w $group )" 83 | print "with the gid assigned as $(dscl . -list /Groups PrimaryGroupID | grep -w $gid | awk '{print $2}' )" 84 | print "" 85 | print "Now add users to it with \e[1m adduser2group \e[0m " 86 | 87 | return 0 88 | -------------------------------------------------------------------------------- /plugins/osx/func/cdf: -------------------------------------------------------------------------------- 1 | cdf() { 2 | pushd "`pwdf $@`" 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/osx/func/dashboard-disable: -------------------------------------------------------------------------------- 1 | dashboard-disable() { 2 | defaults write com.apple.dashboard mcx-disabled -boolean YES 3 | killall Dock 4 | } 5 | 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /plugins/osx/func/dashboard-enable: -------------------------------------------------------------------------------- 1 | dashboard-enable() { 2 | defaults write com.apple.dashboard mcx-disabled -boolean NO 3 | killall Dock 4 | } 5 | 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /plugins/osx/func/font-smoothing: -------------------------------------------------------------------------------- 1 | font-smoothing() { 2 | if [[ $1 -gt 0 ]] && [[ $1 -lt 5 ]]; then 3 | defaults -currentHost write -g AppleFontSmoothing -int $1 4 | echo "set AppleFontSmoothing to $1" 5 | echo "restart for this to take effect" 6 | else 7 | echo 'value must be between 1-4' 8 | fi 9 | } 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /plugins/osx/func/grep-fs-open: -------------------------------------------------------------------------------- 1 | grep-fs-open(){ 2 | if [ $1 ]; then 3 | sudo fs_usage -w -f filesys $1 | egrep "open" 4 | fi 5 | } 6 | 7 | # vim: ft=zsh 8 | -------------------------------------------------------------------------------- /plugins/osx/func/hide-in-dock: -------------------------------------------------------------------------------- 1 | hide-in-dock() { 2 | if [ $1 ]; then 3 | if [[ -d "$1/Contents" ]]; then 4 | if [[ $(defaults read "$1/Contents/Info" LSUIElement) -eq '0' ]]; then 5 | defaults write "$1/Contents/Info" LSUIElement 1 6 | echo "Hiding $1" 7 | else 8 | defaults write "$1/Contents/Info" LSUIElement 0 9 | echo "Showing $1" 10 | fi 11 | else 12 | echo "Please specify a valid application" 13 | fi 14 | else 15 | echo "Please specify a valid application" 16 | fi 17 | } 18 | 19 | # vim: ft=zsh 20 | -------------------------------------------------------------------------------- /plugins/osx/func/invisible: -------------------------------------------------------------------------------- 1 | invisible() { 2 | if [ `GetFileInfo -a $1 | /usr/bin/grep V` ]; then 3 | setFile -a v $1 4 | else 5 | setFile -a V $1 6 | fi 7 | } 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/osx/func/isightcap: -------------------------------------------------------------------------------- 1 | isightcap() { 2 | date=$(date +%y%m%d_%H_%M_%S).jpg; 3 | isightcapture -w 640 -h 480 -n 3 -d -t jpg ~/.isightcapture/$date > /dev/null 4 | unset date 5 | } 6 | 7 | # vim: ft=zsh 8 | -------------------------------------------------------------------------------- /plugins/osx/func/list-sysctls: -------------------------------------------------------------------------------- 1 | list-sysctls () { 2 | set -A reply $(sysctl -AN ${1%.*} 2>/dev/null) 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/osx/func/mds-disable: -------------------------------------------------------------------------------- 1 | # Disable Spotlight Indexing 2 | mds-disable() { 3 | sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist 4 | } 5 | 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /plugins/osx/func/mds-enable: -------------------------------------------------------------------------------- 1 | # Enable Spotlight Indexing 2 | mds-enable() { 3 | sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist 4 | } 5 | 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /plugins/osx/func/ogrep: -------------------------------------------------------------------------------- 1 | ogrep() { 2 | if [ $1 ]; then 3 | files=("${$(ls | grep -i $1)}") 4 | for file in $files; do 5 | echo opening $file 6 | open $file 7 | done 8 | fi 9 | } 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /plugins/osx/func/pman: -------------------------------------------------------------------------------- 1 | pman() { 2 | man -t "$@" | open -f -a /Applications/Preview.app 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/osx/func/pwdf: -------------------------------------------------------------------------------- 1 | pwdf() { 2 | osascript -e 'tell application "Finder"'\ 3 | -e "if (${1-1} <= (count Finder windows)) then"\ 4 | -e "get POSIX path of (target of window ${1-1} as alias)"\ 5 | -e 'else' -e 'get POSIX path of (desktop as alias)'\ 6 | -e 'end if' -e 'end tell'; 7 | } 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/osx/func/quit: -------------------------------------------------------------------------------- 1 | # Quit an OS X application from the command line 2 | quit() { 3 | for app in $*; do 4 | osascript -e 'quit app "'$app'"' 5 | done 6 | } 7 | 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /plugins/osx/func/relaunch: -------------------------------------------------------------------------------- 1 | relaunch () { 2 | for app in $*; do 3 | osascript -e 'quit app "'$app'"'; 4 | sleep 2; 5 | open -a $app 6 | done 7 | } 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/osx/func/screencap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Integrates Mac OS X's screenshot utility with DropBox for easy sharing. 4 | 5 | # - Starts the interactive take-screenshot function, saves it to your public 6 | # Dropbox (if you didn't cancel it) where it will be uploaded automatically. 7 | # Copies the public URL to your clipboard and opens your browser to it. 8 | 9 | ## Config 10 | dropbox_id="112358132134" ## this is fibonacci's dropbox id 11 | dropbox_public_folder="$HOME/dropbox/Public/screenshots" 12 | upload_delay_in_second=1.5 13 | 14 | ## Derivative Variables 15 | filename=$(date '+%F__%H-%M-%S.png') 16 | save_to="$dropbox_public_folder/$filename" 17 | url="http://dl.dropbox.com/u/$dropbox_id/screenshots/$filename" 18 | 19 | ## start interactive screen capture 20 | screencapture -i "$save_to" 21 | 22 | ## if the screenshot actually saved to a file (user didn't cancel by pressing escape) 23 | if [[ -e "$save_to" ]]; then 24 | ## echo some output in case you run this in a shell 25 | echo "Saved screenshot to:" "$save_to" 26 | 27 | ## copy url to the clipboard 28 | echo "$url" | pbcopy 29 | 30 | ## wait for Dropbox to upload your screenshot, then open in your browser 31 | sleep $upload_delay_in_second 32 | ## The `-g` flag means it won't bring your browser to the foreground, which 33 | ## feels less like getting interrupted. 34 | open -g "$url" 35 | fi 36 | -------------------------------------------------------------------------------- /plugins/osx/func/set-hostname: -------------------------------------------------------------------------------- 1 | set-hostname() { 2 | sudo scutil --set HostName $1 3 | sudo scutil --set LocalHostName $1 4 | sudo scutil --set ComputerName $1 5 | dscacheutil -flushcache 6 | } 7 | 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /plugins/osx/func/show-all-files: -------------------------------------------------------------------------------- 1 | show-all-files() { 2 | if [[ `defaults read com.apple.Finder AppleShowAllFiles` == "NO" ]]; then 3 | defaults write com.apple.Finder AppleShowAllFiles YES 4 | else 5 | defaults write com.apple.Finder AppleShowAllFiles NO 6 | fi 7 | killall Finder 8 | } 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /plugins/osx/func/spotlight-disable: -------------------------------------------------------------------------------- 1 | spotlight-disable() { 2 | sudo mdutil -i off / 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/osx/func/spotlight-enable: -------------------------------------------------------------------------------- 1 | spotlight-enable() { 2 | sudo mdutil -i on / 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/osx/func/switch_users: -------------------------------------------------------------------------------- 1 | #compdef switch_users 2 | 3 | local expl users 4 | 5 | zstyle -a ":completion:${curcontext}:" users users && 6 | _wanted users expl user compadd "$@" -a users && return 0 7 | 8 | _wanted users expl %B'possible users to switch to ----'%b compadd "$@" -k userdirs 9 | -------------------------------------------------------------------------------- /plugins/osx/func/tab: -------------------------------------------------------------------------------- 1 | tab() { 2 | osascript 2>/dev/null <& /dev/null 35 | tiff2icns -noLarge $resourcePath/icon.tiff >& /dev/null 36 | fi 37 | 38 | # create the executable 39 | cat >$execPath/$name < $plistPath < 48 | 49 | 50 | 51 | CFBundleExecutable 52 | $name 53 | CFBundleIconFile 54 | icon 55 | 56 | 57 | EOF 58 | 59 | -------------------------------------------------------------------------------- /plugins/pianobar/func/pianobar-wrapper: -------------------------------------------------------------------------------- 1 | pianobar-wrapper() { 2 | # control fifo 3 | ctl=~/.config/pianobar/ctl 4 | 5 | # check for ctl, create it if missing 6 | if [[ -p $ctl ]]; then 7 | else 8 | mkfifo $ctl 9 | fi 10 | 11 | # if input assume command is being sent 12 | if [ $1 ]; then 13 | case $1 in 14 | "+") 15 | echo '<3 current song' 16 | echo -n '+' > $ctl 17 | ;; 18 | "-") 19 | echo 'ban current song' 20 | echo -n '-' > $ctl 21 | ;; 22 | "n") 23 | echo 'next song' 24 | echo -n 'n' > $ctl 25 | ;; 26 | "p") 27 | echo 'pause/continue' 28 | echo -n 'p' > $ctl 29 | ;; 30 | "q") 31 | echo 'quit pianobar' 32 | echo -n 'q' > $ctl 33 | ;; 34 | "b") 35 | echo 'bookmark song/artist' 36 | echo -n 'b' > $ctl 37 | ;; 38 | esac 39 | else 40 | if [[ $(screen -ls | grep pianobar) == '' ]]; then 41 | screen -S pianobar pianobar 42 | else 43 | screen -dr pianobar 44 | fi 45 | fi 46 | } 47 | 48 | # vim: ft=zsh 49 | -------------------------------------------------------------------------------- /plugins/pianobar/plugin: -------------------------------------------------------------------------------- 1 | ### pianobar / zeesh! plugin 2 | 3 | fpath=( ~/.zsh/plugins/pianobar/func $fpath ) 4 | autoload -U ~/.zsh/plugins/pianobar/func/*(:t) 5 | 6 | ## aliases 7 | alias pianobar=pianobar-wrapper 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/python/comp/_cdsp: -------------------------------------------------------------------------------- 1 | #compdef cdsp 2 | _files -W `cdsp --location` -/ 3 | -------------------------------------------------------------------------------- /plugins/python/func/b64decode: -------------------------------------------------------------------------------- 1 | b64decode() { 2 | python -c "import base64, sys; print base64.decodestring(''.join(sys.argv[1:]))" $@ 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/python/func/b64encode: -------------------------------------------------------------------------------- 1 | b64_encode() { 2 | python -c "import base64, sys; print base64.encodestring(''.join(sys.argv[1:]))" $@ 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/python/func/cdsp: -------------------------------------------------------------------------------- 1 | # switch to active virtualenv site-packages dir 2 | cdsp() { 3 | local spdir=`python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()'` 4 | if [ $1 ]; then 5 | if [ "$1" = '--location' ]; then 6 | echo $spdir 7 | else 8 | cd $spdir/$1 9 | fi 10 | else 11 | cd $spdir 12 | fi 13 | } 14 | 15 | # vim: ft=zsh 16 | -------------------------------------------------------------------------------- /plugins/python/func/hexdecode: -------------------------------------------------------------------------------- 1 | hexdecode() { 2 | python -c "import sys; print ''.join(chr(int(''.join(i), 16)) for i in zip(*[iter(''.join(sys.argv[1:]))]*2))" $@ 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/python/func/python-bootstrap: -------------------------------------------------------------------------------- 1 | # setup basic python environment 2 | python-bootstrap() { 3 | version=$(python -c 'import sys; print sys.version' | grep --color=never -o '^[0-9].[0-9]') 4 | case $version in 5 | 2.6) 6 | curl -O http://python-distribute.org/distribute_setup.py 7 | python distribute_setup.py 8 | rm -rf distribute*.py 9 | rm -rf distribute*.tar.gz 10 | easy_install pip 11 | easy_install readline 12 | easy_install ipython 13 | pip install virtualenv 14 | pip install virtualenv-commands 15 | pip install argparse 16 | pip install fabric 17 | pip install ropevim 18 | pip install PyCrypto 19 | pip install PyAns1 20 | pip install -e svn+http://keyczar.googlecode.com/svn/trunk/python/ 21 | pip install pipe 22 | pip install requests 23 | ;; 24 | 2.7) 25 | curl -O http://python-distribute.org/distribute_setup.py 26 | python distribute_setup.py 27 | rm -rf distribute*.py 28 | rm -rf distribute*.tar.gz 29 | easy_install pip 30 | easy_install readline 31 | easy_install ipython 32 | pip install virtualenv 33 | pip install virtualenv-commands 34 | pip install fabric 35 | pip install ropevim 36 | pip install PyCrypto 37 | pip install PyAns1 38 | pip install -e svn+http://keyczar.googlecode.com/svn/trunk/python/ 39 | pip install pipe 40 | pip install requests 41 | ;; 42 | 3.0|3.1|3.2) 43 | curl -O http://python-distribute.org/distribute_setup.py 44 | python distribute_setup.py 45 | rm -rf distribute*.py 46 | rm -rf distribute*.tar.gz 47 | easy_install pip 48 | easy_install readline 49 | #easy_install ipython 50 | pip install virtualenv5 51 | pip install ropevim 52 | ;; 53 | *) 54 | echo 'unsupported version of python' 55 | ;; 56 | esac 57 | } 58 | 59 | # vim: ft=zsh 60 | -------------------------------------------------------------------------------- /plugins/python/func/urlencode: -------------------------------------------------------------------------------- 1 | urlencode() { 2 | python -c "import urllib, sys; print urllib.quote(''.join(sys.argv[1:]))" $@ 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/python/plugin: -------------------------------------------------------------------------------- 1 | ### python / zeesh! plugin 2 | 3 | fpath=( $plugin_dir/func $plugin_dir/comp $fpath ) 4 | autoload -U $plugin_dir/func/*(:t) $plugin_dir/comp/*(:t) 5 | 6 | ## exports 7 | if [ -e ~/.pythonrc ]; then 8 | export PYTHONSTARTUP=~/.pythonrc 9 | fi 10 | 11 | ## aliases 12 | alias py=python 13 | alias py3=python3 14 | alias ipy=ipython 15 | alias pyinstall='python setup.py install' 16 | alias pipi='pip install' 17 | alias pipu='pip install -U' 18 | pipr(){ 19 | if [ $1 ]; then 20 | pip install -r $@ 21 | else 22 | pip install -r requirements.txt 23 | fi 24 | } 25 | alias smtpconsole='python -m smtpd -n -c DebuggingServer localhost:1025' 26 | alias serve-this='python -m http.server' 27 | 28 | ## functions 29 | pjson() { 30 | python -mjson.tool 31 | } 32 | 33 | ipy-pdb() { 34 | ipython -pdb -c "%run $1" 35 | } 36 | 37 | noipy() { 38 | export NOIPYTHON=1 39 | python 40 | unset NOIPYTHON 41 | } 42 | 43 | py-upgrade() { 44 | pip freeze --local | cut -d = -f 1 | xargs echo pip install -U 45 | } 46 | 47 | pye(){ echo 'exec compile(''"'$@[1,-1]'"'', "", "single")' | python - } 48 | 49 | # vim: ft=zsh 50 | -------------------------------------------------------------------------------- /plugins/rails/plugin: -------------------------------------------------------------------------------- 1 | alias ss='thin --stats "/thin/stats" start' 2 | alias sg='ruby script/generate' 3 | alias sd='ruby script/destroy' 4 | alias sp='ruby script/plugin' 5 | alias ssp='ruby script/spec' 6 | alias rdbm='rake db:migrate' 7 | alias sc='ruby script/console' 8 | alias sd='ruby script/server --debugger' 9 | alias devlog='tail -f log/development.log' 10 | 11 | _cap_does_task_list_need_generating () { 12 | if [ ! -f .cap_tasks~ ]; then return 0; 13 | else 14 | accurate=$(stat -f%m .cap_tasks~) 15 | changed=$(stat -f%m config/deploy.rb) 16 | return $(expr $accurate '>=' $changed) 17 | fi 18 | } 19 | 20 | _cap () { 21 | if [ -f config/deploy.rb ]; then 22 | if _cap_does_task_list_need_generating; then 23 | echo "\nGenerating .cap_tasks~..." > /dev/stderr 24 | cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' 25 | > .cap_tasks~ 26 | fi 27 | compadd `cat .cap_tasks~` 28 | fi 29 | } 30 | 31 | compctl -K _cap cap 32 | 33 | remote_console() { 34 | /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" 35 | } 36 | 37 | # vim: ft=zsh 38 | -------------------------------------------------------------------------------- /plugins/remote-mvim/default.prefs: -------------------------------------------------------------------------------- 1 | # remote_mvim example preferences file 2 | local: 3 | remote: 4 | cmd: 5 | -------------------------------------------------------------------------------- /plugins/remote-mvim/func/remote-mvim: -------------------------------------------------------------------------------- 1 | remote-mvim() { 2 | typeset -A prefs 3 | zeesh-prefs remote_mvim get # get preferences, failing that create them 4 | if [[ $prefs != '' ]]; then 5 | local file=$@[-1] 6 | local args=$@[1,-2] 7 | local pwd=$(pwd) 8 | if [ $1 ]; then 9 | if [[ -d $file ]]; then 10 | if [[ $file[-1] != '/' ]]; then 11 | file=$file'/' 12 | fi 13 | if [[ $file[1] == '/' ]]; then 14 | ssh $prefs[remote] -f "$prefs[cmd] $args -c ':Nread scp://$prefs[local]/$file'" 15 | else 16 | echo "browsing $pwd/$file remotely on $prefs[remote] with mvim" 17 | ssh $prefs[remote] -f "$prefs[cmd] $args -c ':Nread scp://$prefs[local]/$pwd/$file'" 18 | fi 19 | else 20 | if [[ $file[1] == '/' ]]; then 21 | echo "opening $file remotely on $prefs[remote] with mvim" 22 | ssh $prefs[remote] -f "$prefs[cmd] $args scp://$prefs[local]/$file" 23 | else 24 | echo "opening $pwd/$file remotely on $prefs[remote] with mvim" 25 | ssh $prefs[remote] -f "$prefs[cmd] $args scp://$prefs[local]/$pwd/$file" 26 | fi 27 | fi 28 | else 29 | echo "browsing $pwd remotely on $prefs[remote] with mvim" 30 | ssh $prefs[remote] -f "$prefs[cmd] $args -c ':Nread scp://$prefs[local]/$pwd/'" 31 | fi 32 | fi 33 | } 34 | 35 | # vim: ft=zsh 36 | -------------------------------------------------------------------------------- /plugins/remote-mvim/plugin: -------------------------------------------------------------------------------- 1 | ### remote-mvim / zeesh! plugin 2 | 3 | # make sure to change settings in prefs file before usage 4 | # ~/.zsh/plugins/remote_mvim/prefs 5 | # local: 6 | # remote: 7 | # cmd: 8 | 9 | fpath=( ~/.zsh/plugins/remote-mvim/func $fpath ) 10 | autoload -U ~/.zsh/plugins/remote-mvim/func/*(:t) 11 | 12 | ## aliases 13 | alias mvim='remote-mvim' 14 | 15 | # vim: ft=zsh 16 | -------------------------------------------------------------------------------- /plugins/screen/func/screen-clean: -------------------------------------------------------------------------------- 1 | screen-clean() { 2 | local -a screens 3 | screens=( ${(f)"$(screen -ls | grep '(Detached)' | grep -o '[0-9]*.tty[0-9]*')"} ) 4 | for screen in $screens 5 | do 6 | screen -X -S $screen kill 7 | done 8 | } 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /plugins/screen/func/screen-kill: -------------------------------------------------------------------------------- 1 | screen-kill() { 2 | local -a screens 3 | screens=( ${(f)"$(screen -ls | grep -o '[0-9]*.tty[0-9]*')"} ) 4 | for screen in $screens 5 | do 6 | screen -X -S $screen kill 7 | done 8 | } 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /plugins/screen/plugin: -------------------------------------------------------------------------------- 1 | ### screen / zeesh! plugin 2 | # 3 | fpath=( ~/.zsh/plugins/screen/func $fpath ) 4 | autoload -U ~/.zsh/plugins/screen/func/*(:t) 5 | 6 | # aliases 7 | alias screens='screen -ls' 8 | alias wipe='screen -wipe' 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /plugins/share/func/share: -------------------------------------------------------------------------------- 1 | # simple function to scp a file to my server and create a link for me 2 | share() { 3 | if [ -f ~/.zsh/plugins/share/local.conf ]; then 4 | # load config 5 | if [ -f ~/.zsh/plugins/share/local.conf ]; then 6 | source ~/.zsh/plugins/share/local.conf 7 | fi 8 | if [ $2 ]; then 9 | if [ -f $1 ] && [ $_scp_share_server[$2] ]; then 10 | scp "$1" $_scp_share_server[$2] && echo "available at: $_scp_share_url[$2]$1 / copied to clipboard" 11 | echo "$_scp_share_url[$2]$1" | pbcopy 12 | else 13 | echo "Please specify a file to share and/or configure default server" 14 | fi 15 | elif [ $1 ]; then 16 | if [ -f $1 ] && [ $_scp_share_server[default] ]; then 17 | scp "$1" $_scp_share_server[default] && echo "available at: $_scp_share_url[default]$1 / copied to clipboard" 18 | echo "$_scp_share_url[default]$1" | pbcopy 19 | else 20 | echo "Please specify a file to share and/or configure default server" 21 | fi 22 | else 23 | echo "Please specify a file to share" 24 | fi 25 | else 26 | echo "Please configure ~/.zsh/plugins/share/local.conf first! Please refer to local.conf.example." 27 | fi 28 | } 29 | 30 | # vim: ft=zsh 31 | -------------------------------------------------------------------------------- /plugins/share/local.conf.example: -------------------------------------------------------------------------------- 1 | # setup config arrays, configure below 2 | typeset -A _scp_share_server 3 | typeset -A _scp_share_url 4 | 5 | # server / url mappings, default is required for normal usage 6 | _scp_share_server[default]='user@host:/path/to/shared/dir' 7 | _scp_share_url[default]='http://host.com/path/to/shared/dir' 8 | _scp_share_server[alias]='user@host:/path/to/shared/dir' 9 | _scp_share_url[alias]='http://path/to/shared/dir' 10 | _scp_share_server[host2]='user@host2:/path/to/shared/dir' 11 | _scp_share_url[host2]='http://host2.com/path/to/shared/dir' 12 | -------------------------------------------------------------------------------- /plugins/share/plugin: -------------------------------------------------------------------------------- 1 | # python zshfu plugin 2 | fpath=( ~/.zsh/plugins/share/func $fpath ) 3 | autoload -U share 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/spaceship/init: -------------------------------------------------------------------------------- 1 | # ZSH has a quirk where `preexec` is only run if a command is actually run (i.e 2 | # pressing ENTER at an empty command line will not cause preexec to fire). This 3 | # can cause timing issues, as a user who presses "ENTER" without running a command 4 | # will see the time to the start of the last command, which may be very large. 5 | 6 | # To fix this, we create STARSHIP_START_TIME upon preexec() firing, and destroy it 7 | # after drawing the prompt. This ensures that the timing for one command is only 8 | # ever drawn once (for the prompt immediately after it is run). 9 | 10 | zmodload zsh/parameter # Needed to access jobstates variable for STARSHIP_JOBS_COUNT 11 | 12 | # Defines a function `__starship_get_time` that sets the time since epoch in millis in STARSHIP_CAPTURED_TIME. 13 | if [[ $ZSH_VERSION == ([1-4]*) ]]; then 14 | # ZSH <= 5; Does not have a built-in variable so we will rely on Starship's inbuilt time function. 15 | __starship_get_time() { 16 | STARSHIP_CAPTURED_TIME=$(/usr/local/bin/starship time) 17 | } 18 | else 19 | zmodload zsh/datetime 20 | zmodload zsh/mathfunc 21 | __starship_get_time() { 22 | (( STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000)) )) 23 | } 24 | fi 25 | 26 | 27 | # The two functions below follow the naming convention `prompt__` 28 | # for compatibility with Zsh's prompt system. See 29 | # https://github.com/zsh-users/zsh/blob/2876c25a28b8052d6683027998cc118fc9b50157/Functions/Prompts/promptinit#L155 30 | 31 | # Runs before each new command line. 32 | prompt_starship_precmd() { 33 | # Save the status, because commands in this pipeline will change $? 34 | STARSHIP_CMD_STATUS=$? STARSHIP_PIPE_STATUS=(${pipestatus[@]}) 35 | 36 | # Compute cmd_duration, if we have a time to consume, otherwise clear the 37 | # previous duration 38 | if (( ${+STARSHIP_START_TIME} )); then 39 | __starship_get_time && (( STARSHIP_DURATION = STARSHIP_CAPTURED_TIME - STARSHIP_START_TIME )) 40 | unset STARSHIP_START_TIME 41 | else 42 | unset STARSHIP_DURATION 43 | fi 44 | 45 | # Use length of jobstates array as number of jobs. Expansion fails inside 46 | # quotes so we set it here and then use the value later on. 47 | STARSHIP_JOBS_COUNT=${#jobstates} 48 | } 49 | 50 | # Runs after the user submits the command line, but before it is executed. 51 | prompt_starship_preexec() { 52 | __starship_get_time && STARSHIP_START_TIME=$STARSHIP_CAPTURED_TIME 53 | } 54 | 55 | # Add hook functions 56 | autoload -Uz add-zsh-hook 57 | add-zsh-hook precmd prompt_starship_precmd 58 | add-zsh-hook preexec prompt_starship_preexec 59 | 60 | # Set up a function to redraw the prompt if the user switches vi modes 61 | starship_zle-keymap-select() { 62 | zle reset-prompt 63 | } 64 | 65 | ## Check for existing keymap-select widget. 66 | # zle-keymap-select is a special widget so it'll be "user:fnName" or nothing. Let's get fnName only. 67 | __starship_preserved_zle_keymap_select=${widgets[zle-keymap-select]#user:} 68 | if [[ -z $__starship_preserved_zle_keymap_select ]]; then 69 | zle -N zle-keymap-select starship_zle-keymap-select; 70 | else 71 | # Define a wrapper fn to call the original widget fn and then Starship's. 72 | starship_zle-keymap-select-wrapped() { 73 | $__starship_preserved_zle_keymap_select "$@"; 74 | starship_zle-keymap-select "$@"; 75 | } 76 | zle -N zle-keymap-select starship_zle-keymap-select-wrapped; 77 | fi 78 | 79 | __starship_get_time && STARSHIP_START_TIME=$STARSHIP_CAPTURED_TIME 80 | 81 | export STARSHIP_SHELL="zsh" 82 | 83 | # Set up the session key that will be used to store logs 84 | STARSHIP_SESSION_KEY="$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM"; # Random generates a number b/w 0 - 32767 85 | STARSHIP_SESSION_KEY="${STARSHIP_SESSION_KEY}0000000000000000" # Pad it to 16+ chars. 86 | export STARSHIP_SESSION_KEY=${STARSHIP_SESSION_KEY:0:16}; # Trim to 16-digits if excess. 87 | 88 | VIRTUAL_ENV_DISABLE_PROMPT=1 89 | 90 | setopt promptsubst 91 | 92 | PROMPT='$(/usr/local/bin/starship prompt --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")' 93 | RPROMPT='$(/usr/local/bin/starship prompt --right --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")' 94 | PROMPT2="$(/usr/local/bin/starship prompt --continuation)" 95 | -------------------------------------------------------------------------------- /plugins/spaceship/install: -------------------------------------------------------------------------------- 1 | echo -n "I can't find spaceship, would you like me to install it for you? (y/N) " 2 | 3 | read ans 4 | if [[ "$ans" == "y" ]]; then 5 | git clone --depth=1 https://github.com/spaceship-prompt/spaceship-prompt.git "$plugin_dir/lib" 6 | git clone --depth=1 https://github.com/spaceship-prompt/spaceship-vi-mode.git "$plugin_dir/vimode" 7 | echo "...installed spaceship!" 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/spaceship/plugin: -------------------------------------------------------------------------------- 1 | ### spaceship / zeesh! plugin 2 | 3 | [ -d $plugin_dir/lib ] || . $plugin_dir/install 4 | 5 | source $plugin_dir/vimode/spaceship-vi-mode.plugin.zsh; 6 | source $plugin_dir/lib/spaceship.zsh; 7 | eval spaceship_vi_mode_enable 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/starship/init: -------------------------------------------------------------------------------- 1 | # ZSH has a quirk where `preexec` is only run if a command is actually run (i.e 2 | # pressing ENTER at an empty command line will not cause preexec to fire). This 3 | # can cause timing issues, as a user who presses "ENTER" without running a command 4 | # will see the time to the start of the last command, which may be very large. 5 | 6 | # To fix this, we create STARSHIP_START_TIME upon preexec() firing, and destroy it 7 | # after drawing the prompt. This ensures that the timing for one command is only 8 | # ever drawn once (for the prompt immediately after it is run). 9 | 10 | zmodload zsh/parameter # Needed to access jobstates variable for STARSHIP_JOBS_COUNT 11 | 12 | # Defines a function `__starship_get_time` that sets the time since epoch in millis in STARSHIP_CAPTURED_TIME. 13 | if [[ $ZSH_VERSION == ([1-4]*) ]]; then 14 | # ZSH <= 5; Does not have a built-in variable so we will rely on Starship's inbuilt time function. 15 | __starship_get_time() { 16 | STARSHIP_CAPTURED_TIME=$(/usr/local/bin/starship time) 17 | } 18 | else 19 | zmodload zsh/datetime 20 | zmodload zsh/mathfunc 21 | __starship_get_time() { 22 | (( STARSHIP_CAPTURED_TIME = int(rint(EPOCHREALTIME * 1000)) )) 23 | } 24 | fi 25 | 26 | 27 | # The two functions below follow the naming convention `prompt__` 28 | # for compatibility with Zsh's prompt system. See 29 | # https://github.com/zsh-users/zsh/blob/2876c25a28b8052d6683027998cc118fc9b50157/Functions/Prompts/promptinit#L155 30 | 31 | # Runs before each new command line. 32 | prompt_starship_precmd() { 33 | # Save the status, because commands in this pipeline will change $? 34 | STARSHIP_CMD_STATUS=$? STARSHIP_PIPE_STATUS=(${pipestatus[@]}) 35 | 36 | # Compute cmd_duration, if we have a time to consume, otherwise clear the 37 | # previous duration 38 | if (( ${+STARSHIP_START_TIME} )); then 39 | __starship_get_time && (( STARSHIP_DURATION = STARSHIP_CAPTURED_TIME - STARSHIP_START_TIME )) 40 | unset STARSHIP_START_TIME 41 | else 42 | unset STARSHIP_DURATION 43 | fi 44 | 45 | # Use length of jobstates array as number of jobs. Expansion fails inside 46 | # quotes so we set it here and then use the value later on. 47 | STARSHIP_JOBS_COUNT=${#jobstates} 48 | } 49 | 50 | # Runs after the user submits the command line, but before it is executed. 51 | prompt_starship_preexec() { 52 | __starship_get_time && STARSHIP_START_TIME=$STARSHIP_CAPTURED_TIME 53 | } 54 | 55 | # Add hook functions 56 | autoload -Uz add-zsh-hook 57 | add-zsh-hook precmd prompt_starship_precmd 58 | add-zsh-hook preexec prompt_starship_preexec 59 | 60 | # Set up a function to redraw the prompt if the user switches vi modes 61 | starship_zle-keymap-select() { 62 | zle reset-prompt 63 | } 64 | 65 | ## Check for existing keymap-select widget. 66 | # zle-keymap-select is a special widget so it'll be "user:fnName" or nothing. Let's get fnName only. 67 | __starship_preserved_zle_keymap_select=${widgets[zle-keymap-select]#user:} 68 | if [[ -z $__starship_preserved_zle_keymap_select ]]; then 69 | zle -N zle-keymap-select starship_zle-keymap-select; 70 | else 71 | # Define a wrapper fn to call the original widget fn and then Starship's. 72 | starship_zle-keymap-select-wrapped() { 73 | $__starship_preserved_zle_keymap_select "$@"; 74 | starship_zle-keymap-select "$@"; 75 | } 76 | zle -N zle-keymap-select starship_zle-keymap-select-wrapped; 77 | fi 78 | 79 | __starship_get_time && STARSHIP_START_TIME=$STARSHIP_CAPTURED_TIME 80 | 81 | export STARSHIP_SHELL="zsh" 82 | 83 | # Set up the session key that will be used to store logs 84 | STARSHIP_SESSION_KEY="$RANDOM$RANDOM$RANDOM$RANDOM$RANDOM"; # Random generates a number b/w 0 - 32767 85 | STARSHIP_SESSION_KEY="${STARSHIP_SESSION_KEY}0000000000000000" # Pad it to 16+ chars. 86 | export STARSHIP_SESSION_KEY=${STARSHIP_SESSION_KEY:0:16}; # Trim to 16-digits if excess. 87 | 88 | VIRTUAL_ENV_DISABLE_PROMPT=1 89 | 90 | setopt promptsubst 91 | 92 | PROMPT='$(/usr/local/bin/starship prompt --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")' 93 | RPROMPT='$(/usr/local/bin/starship prompt --right --terminal-width="$COLUMNS" --keymap="${KEYMAP:-}" --status="$STARSHIP_CMD_STATUS" --pipestatus="${STARSHIP_PIPE_STATUS[*]}" --cmd-duration="${STARSHIP_DURATION:-}" --jobs="$STARSHIP_JOBS_COUNT")' 94 | PROMPT2="$(/usr/local/bin/starship prompt --continuation)" 95 | -------------------------------------------------------------------------------- /plugins/starship/install: -------------------------------------------------------------------------------- 1 | echo -n "I can't find starship, would you like me to install it for you? (y/N) " 2 | 3 | read ans 4 | if [[ "$ans" == "y" ]]; then 5 | curl -sS https://starship.rs/install.sh | sh 6 | echo "...installed starship!" 7 | fi 8 | -------------------------------------------------------------------------------- /plugins/starship/plugin: -------------------------------------------------------------------------------- 1 | ### starship / zeesh! plugin 2 | 3 | if ! hash starship &> /dev/null; then 4 | . $plugin_dir/install 5 | fi 6 | 7 | source <(/usr/local/bin/starship init zsh --print-full-init) 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/syntax-highlighting/install: -------------------------------------------------------------------------------- 1 | repo="git://github.com/zsh-users/zsh-syntax-highlighting.git" 2 | 3 | echo -n "I can't find $plugin would you like me to install it for you? (y/N) " 4 | read ans 5 | if [[ "$ans" == "y" ]]; then 6 | git clone --depth 1 $repo $plugin_dir/lib 7 | echo "...installed $plugin" 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/syntax-highlighting/plugin: -------------------------------------------------------------------------------- 1 | ### zsh-syntax-highlighting / zeesh! plugin 2 | 3 | [ -d "$plugin_dir/lib" ] || source "$plugin_dir/install" 4 | 5 | source "$plugin_dir/lib/zsh-syntax-highlighting.zsh" >/dev/null 2>&1 6 | 7 | # manually enable highlighters because _zsh_highlight_load_highlighters() is problematic 8 | typeset -gA ZSH_HIGHLIGHT_STYLES 9 | 10 | HIGHLIGHTERS_DIR="$plugin_dir/lib/highlighters/" 11 | local dir name 12 | for dir ($HIGHLIGHTERS_DIR/*/); do 13 | name="${dir:t}" 14 | source $dir/$name-highlighter.zsh 15 | done 16 | 17 | # override some styles 18 | ZSH_HIGHLIGHT_STYLES[default]='none' 19 | ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold' 20 | ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=magenta' 21 | ZSH_HIGHLIGHT_STYLES[alias]='fg=magenta' 22 | ZSH_HIGHLIGHT_STYLES[builtin]='fg=magenta,bold' 23 | ZSH_HIGHLIGHT_STYLES[function]='fg=magenta' 24 | ZSH_HIGHLIGHT_STYLES[command]='fg=cyan,bold' 25 | ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=red,bold,standout' 26 | ZSH_HIGHLIGHT_STYLES[path]='none' 27 | ZSH_HIGHLIGHT_STYLES[assign]='fg=magenta,bold' 28 | 29 | # vim: ft=zsh 30 | -------------------------------------------------------------------------------- /plugins/term/plugin: -------------------------------------------------------------------------------- 1 | # term support 2 | case "$TERM" in 3 | xterm*|rxvt*) 4 | preexec () { 5 | print -Pn "\e]0;%n@%m: $1\a" # xterm 6 | } 7 | precmd () { 8 | print -Pn "\e]0;%n@%m: %~\a" # xterm 9 | } 10 | ;; 11 | screen*) 12 | preexec () { 13 | local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} 14 | echo -ne "\ek$CMD\e\\" 15 | print -Pn "\e]0;%n@%m: $1\a" # xterm 16 | } 17 | precmd () { 18 | echo -ne "\ekzsh\e\\" 19 | print -Pn "\e]0;%n@%m: %~\a" # xterm 20 | } 21 | ;; 22 | esac 23 | 24 | # appearance 25 | typeset -Ag FX FG BG 26 | 27 | FX=( 28 | reset "%{^[[00m%}" 29 | bold "%{^[[01m%}" no-bold "%{^[[22m%}" 30 | italic "%{^[[03m%}" no-italic "%{^[[23m%}" 31 | underline "%{^[[04m%}" no-underline "%{^[[24m%}" 32 | blink "%{^[[05m%}" no-blink "%{^[[25m%}" 33 | reverse "%{^[[07m%}" no-reverse "%{^[[27m%}" 34 | ) 35 | 36 | for color in {000..255}; do 37 | FG[$color]="%{^[[38;5;${color}m%}" 38 | BG[$color]="%{^[[48;5;${color}m%}" 39 | done 40 | 41 | # vim: ft=zsh 42 | -------------------------------------------------------------------------------- /plugins/theme/bin/emoticon: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # prints random emoticon face 3 | typeset -A faces 4 | 5 | faces[0]='ヽ(`皿′)ノ' 6 | faces[1]='(`0´)' 7 | faces[2]='( `´)' 8 | faces[3]='(。_°☆\(- - )' 9 | faces[4]='(;・_・)' 10 | faces[5]='(-_-メ)' 11 | faces[6]='ヾ(・_・ )' 12 | faces[7]='(。・_・。)' 13 | faces[8]='( ̄~ ̄)' 14 | faces[9]='( ´ ▽ ` )' 15 | faces[10]='(;_・)' 16 | faces[11]='( ̄へ ̄)' 17 | faces[12]='(;´ρ`)' 18 | faces[13]='☆⌒(>。≪)' 19 | faces[14]='(´・`)' 20 | faces[15]='(O_O;)' 21 | faces[16]='(。_゜)' 22 | faces[17]='(*・_・)ノ⌒*' 23 | faces[18]='(?・・)σ ' 24 | faces[19]='(゚ー゚)(。_。)' 25 | faces[20]='ヾ(-_-;)' 26 | faces[21]='(ーー;)' 27 | faces[22]='_| ̄|○' 28 | faces[23]='(´・ω・`)' 29 | faces[24]='(* ̄m ̄)' 30 | faces[25]='(´ー`)┌' 31 | faces[26]='(゜◇゜)' 32 | faces[27]='( ゚Д ゚)' 33 | faces[28]='(T▽ T)' 34 | faces[29]='( ̄□ ̄;)' 35 | 36 | echo $faces[$[${RANDOM}%30]] 37 | -------------------------------------------------------------------------------- /plugins/theme/bogart.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a%m%s›%f' 7 | export VCS_INFO_GIT_FMT='%F{magenta}‹%b%c%u%0.10i%m%s›%f' 8 | 9 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}‹%b%c%u %i %a %m%s›%f' 10 | export VCS_INFO_HG_FMT='%F{magenta}‹%b%c%u %i %m%s›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | _prompt() { 23 | local s="%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b %F{blue}%B${PWD/$HOME/~}%b%f" 24 | 25 | # display vcs info 26 | if [ "$vcs_info_msg_0_" ]; then 27 | s="$s $vcs_info_msg_0_" 28 | fi 29 | 30 | # split 31 | s="$s\n" 32 | 33 | # print virtualenv name if active 34 | if [ $VIRTUAL_ENV ]; then 35 | s="$s%F{magenta}${${(s:/:)VIRTUAL_ENV}[-1]}%f" 36 | fi 37 | 38 | echo -e "$s%F{magenta}›%f " 39 | } 40 | 41 | _rprompt() { 42 | # print return code if non-zero 43 | local rc=$? 44 | 45 | if [[ $rc != 0 ]]; then 46 | local s="%F{red}% $rc!%f" 47 | fi 48 | 49 | echo -e $s 50 | } 51 | 52 | PROMPT='$(_prompt)' 53 | RPROMPT='$(_rprompt)' 54 | -------------------------------------------------------------------------------- /plugins/theme/colors/green.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_FMT='%F{green}‹%b%c%u%0.10i%m%s›%f' 7 | export VCS_INFO_GIT_ACTION_FMT='%F{green}‹%b%c%u%0.10i %a%m%s›%f' 8 | 9 | export VCS_INFO_HG_FMT='%F{green}‹%b%c%u%0.8i %m%s›%f' 10 | export VCS_INFO_HG_ACTION_FMT='%F{green}‹%b%c%u%0.10i %a %m%s›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r ' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | export ZEESH_THEME_NORMAL_CHAR='\n' 23 | export ZEESH_THEME_VISUAL_CHAR='\n' 24 | export ZEESH_THEME_INSERT_CHAR='\n' 25 | export ZEESH_THEME_PROMPT_CHAR='' 26 | 27 | _prompt() { 28 | local mode= 29 | case $KEYMAP in 30 | vicmd) 31 | mode=$ZEESH_THEME_NORMAL_CHAR 32 | ;; 33 | vivis) 34 | mode=$ZEESH_THEME_VISUAL_CHAR 35 | ;; 36 | *) 37 | mode=$ZEESH_THEME_INSERT_CHAR 38 | ;; 39 | esac 40 | 41 | local s="%F{green}%b%n%b%f%F{green}@%f%F{green}%b%m%f%b %F{blue}%b${PWD/$HOME/~}%b%f" 42 | 43 | # display vcs info 44 | if [ "$vcs_info_msg_0_" ]; then 45 | s="$s $vcs_info_msg_0_" 46 | fi 47 | 48 | # print virtualenv name if active 49 | if [ $VIRTUAL_ENV ]; then 50 | s="$s %F{green}‹${${(s:/:)VIRTUAL_ENV}[-1]}›%f " 51 | fi 52 | 53 | echo -e "$s%F{green} $mode$ZEESH_THEME_PROMPT_CHAR%f" 54 | } 55 | 56 | _rprompt() { 57 | # print return code if non-zero 58 | local rc=$? 59 | 60 | if [[ $rc != 0 ]]; then 61 | local s="%F{red}% $(emoticon) $rc!%f" 62 | fi 63 | 64 | echo -e $s 65 | } 66 | 67 | PROMPT='$(_prompt)' 68 | RPROMPT='$(_rprompt)' 69 | 70 | zle-keymap-select() { 71 | zle reset-prompt 72 | } 73 | zle -N zle-keymap-select 74 | 75 | zle-line-init() { 76 | zle reset-prompt 77 | } 78 | zle -N zle-line-init 79 | -------------------------------------------------------------------------------- /plugins/theme/colors/magenta.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_FMT='%F{magenta}‹%b%c%u%0.10i%m%s›%f' 7 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a%m%s›%f' 8 | 9 | export VCS_INFO_HG_FMT='%F{magenta}‹%b%c%u%0.8i %m%s›%f' 10 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a %m%s›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r ' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | export ZEESH_THEME_NORMAL_CHAR='\n' 23 | export ZEESH_THEME_VISUAL_CHAR='\n' 24 | export ZEESH_THEME_INSERT_CHAR='\n' 25 | export ZEESH_THEME_PROMPT_CHAR='' 26 | 27 | _prompt() { 28 | local mode= 29 | case $KEYMAP in 30 | vicmd) 31 | mode=$ZEESH_THEME_NORMAL_CHAR 32 | ;; 33 | vivis) 34 | mode=$ZEESH_THEME_VISUAL_CHAR 35 | ;; 36 | *) 37 | mode=$ZEESH_THEME_INSERT_CHAR 38 | ;; 39 | esac 40 | 41 | local s="%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b %F{blue}%B${PWD/$HOME/~}%b%f" 42 | 43 | # display vcs info 44 | if [ "$vcs_info_msg_0_" ]; then 45 | s="$s $vcs_info_msg_0_" 46 | fi 47 | 48 | # print virtualenv name if active 49 | if [ $VIRTUAL_ENV ]; then 50 | s="$s %F{magenta}‹${${(s:/:)VIRTUAL_ENV}[-1]}›%f " 51 | fi 52 | 53 | echo -e "$s%F{magenta} $mode$ZEESH_THEME_PROMPT_CHAR%f" 54 | } 55 | 56 | _rprompt() { 57 | # print return code if non-zero 58 | local rc=$? 59 | 60 | if [[ $rc != 0 ]]; then 61 | local s="%F{red}% $(emoticon) $rc!%f" 62 | fi 63 | 64 | echo -e $s 65 | } 66 | 67 | PROMPT='$(_prompt)' 68 | RPROMPT='$(_rprompt)' 69 | 70 | zle-keymap-select() { 71 | zle reset-prompt 72 | } 73 | zle -N zle-keymap-select 74 | 75 | zle-line-init() { 76 | zle reset-prompt 77 | } 78 | zle -N zle-line-init 79 | -------------------------------------------------------------------------------- /plugins/theme/colors/solace.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_FMT='%F{green}‹%b%c%u%0.10i%m%s›%f' 7 | export VCS_INFO_GIT_ACTION_FMT='%F{green}‹%b%c%u%0.10i %a%m%s›%f' 8 | 9 | export VCS_INFO_HG_FMT='%F{green}‹%b%c%u%0.8i %m%s›%f' 10 | export VCS_INFO_HG_ACTION_FMT='%F{green}‹%b%c%u%0.10i %a %m%s›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r ' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | export ZEESH_THEME_NORMAL_CHAR='\n' 23 | export ZEESH_THEME_VISUAL_CHAR='\n' 24 | export ZEESH_THEME_INSERT_CHAR='\n' 25 | export ZEESH_THEME_PROMPT_CHAR='' 26 | 27 | _prompt() { 28 | local mode= 29 | case $KEYMAP in 30 | vicmd) 31 | mode=$ZEESH_THEME_NORMAL_CHAR 32 | ;; 33 | vivis) 34 | mode=$ZEESH_THEME_VISUAL_CHAR 35 | ;; 36 | *) 37 | mode=$ZEESH_THEME_INSERT_CHAR 38 | ;; 39 | esac 40 | 41 | local s="%F{green}%b%n%b%f%F{green}@%f%F{green}%b%m%f%b %F{blue}%b${PWD/$HOME/~}%b%f" 42 | 43 | # display vcs info 44 | if [ "$vcs_info_msg_0_" ]; then 45 | s="$s $vcs_info_msg_0_" 46 | fi 47 | 48 | # print virtualenv name if active 49 | if [ $VIRTUAL_ENV ]; then 50 | s="$s %F{green}‹${${(s:/:)VIRTUAL_ENV}[-1]}›%f " 51 | fi 52 | 53 | echo -e "$s%F{green} $mode$ZEESH_THEME_PROMPT_CHAR%f" 54 | } 55 | 56 | _rprompt() { 57 | # print return code if non-zero 58 | local rc=$? 59 | 60 | if [[ $rc != 0 ]]; then 61 | local s="%F{red}% $(emoticon) $rc!%f" 62 | fi 63 | 64 | echo -e $s 65 | } 66 | 67 | PROMPT='$(_prompt)' 68 | RPROMPT='$(_rprompt)' 69 | 70 | zle-keymap-select() { 71 | zle reset-prompt 72 | } 73 | zle -N zle-keymap-select 74 | 75 | zle-line-init() { 76 | zle reset-prompt 77 | } 78 | zle -N zle-line-init 79 | -------------------------------------------------------------------------------- /plugins/theme/colors/zen.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_FMT='%F{green}‹%b%c%u%0.10i%m%s›%f' 7 | export VCS_INFO_GIT_ACTION_FMT='%F{green}‹%b%c%u%0.10i %a%m%s›%f' 8 | 9 | export VCS_INFO_HG_FMT='%F{green}‹%b%c%u%0.8i %m%s›%f' 10 | export VCS_INFO_HG_ACTION_FMT='%F{green}‹%b%c%u%0.10i %a %m%s›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r ' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | export ZEESH_THEME_NORMAL_CHAR='\n' 23 | export ZEESH_THEME_VISUAL_CHAR='\n' 24 | export ZEESH_THEME_INSERT_CHAR='\n' 25 | export ZEESH_THEME_PROMPT_CHAR='' 26 | 27 | _prompt() { 28 | local mode= 29 | case $KEYMAP in 30 | vicmd) 31 | mode=$ZEESH_THEME_NORMAL_CHAR 32 | ;; 33 | vivis) 34 | mode=$ZEESH_THEME_VISUAL_CHAR 35 | ;; 36 | *) 37 | mode=$ZEESH_THEME_INSERT_CHAR 38 | ;; 39 | esac 40 | 41 | local s="%F{green}%b%n%b%f%F{green}@%f%F{green}%b%m%f%b %F{blue}%b${PWD/$HOME/~}%b%f" 42 | 43 | # display vcs info 44 | if [ "$vcs_info_msg_0_" ]; then 45 | s="$s $vcs_info_msg_0_" 46 | fi 47 | 48 | # print virtualenv name if active 49 | if [ $VIRTUAL_ENV ]; then 50 | s="$s %F{green}‹${${(s:/:)VIRTUAL_ENV}[-1]}›%f " 51 | fi 52 | 53 | echo -e "$s%F{green} $mode$ZEESH_THEME_PROMPT_CHAR%f" 54 | } 55 | 56 | _rprompt() { 57 | # print return code if non-zero 58 | local rc=$? 59 | 60 | if [[ $rc != 0 ]]; then 61 | local s="%F{red}% $(emoticon) $rc!%f" 62 | fi 63 | 64 | echo -e $s 65 | } 66 | 67 | PROMPT='$(_prompt)' 68 | RPROMPT='$(_rprompt)' 69 | 70 | zle-keymap-select() { 71 | zle reset-prompt 72 | } 73 | zle -N zle-keymap-select 74 | 75 | zle-line-init() { 76 | zle reset-prompt 77 | } 78 | zle -N zle-line-init 79 | -------------------------------------------------------------------------------- /plugins/theme/emotifail.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}‹%s %b%m %0.10i%c%u %a›%f' 7 | export VCS_INFO_GIT_FMT='%F{magenta}‹%s %b%m %0.10i%c%u›%f' 8 | 9 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}‹%s %b%m %i%c%u %a›%f' 10 | export VCS_INFO_HG_FMT='%F{magenta}‹%s %b%m %i%c%u›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | _prompt() { 23 | local s="%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b %F{blue}%B${PWD/$HOME/~}%b%f" 24 | 25 | # display vcs info 26 | if [ "$vcs_info_msg_0_" ]; then 27 | s="$s $vcs_info_msg_0_" 28 | fi 29 | 30 | # split 31 | s="$s\n" 32 | 33 | # print virtualenv name if active 34 | if [ $VIRTUAL_ENV ]; then 35 | s="$s%F{magenta}${${(s:/:)VIRTUAL_ENV}[-1]}%f" 36 | fi 37 | 38 | echo -e "$s%F{magenta}›%f " 39 | } 40 | 41 | _rprompt() { 42 | # print return code if non-zero 43 | local rc=$? 44 | 45 | if [[ $rc != 0 ]]; then 46 | local s="%F{red}% $(emoticon) $rc!%f" 47 | fi 48 | 49 | echo -e $s 50 | } 51 | 52 | PROMPT='$(_prompt)' 53 | RPROMPT='$(_rprompt)' 54 | -------------------------------------------------------------------------------- /plugins/theme/excess.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}%a%f on %F{magenta}%b%m%f at %F{magenta}%0.10i%c%u %a%f' 7 | export VCS_INFO_GIT_FMT='on %F{magenta}%b%m%f at %F{magenta}%0.10i%c%u%f' 8 | 9 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}%a%f on %F{magenta}%b%m%f at %F{magenta}%i%c%u %a%f' 10 | export VCS_INFO_HG_FMT='on %F{magenta}%b%m%f at %F{magenta}%i%c%u%f' 11 | 12 | export VCS_INFO_HG_REV_FMT='%r' 13 | export VCS_INFO_HG_BOOKMARK_FMT='' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT=' $s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | _prompt() { 23 | local s="%B%F{magenta}%n%f%b at %B%F{magenta}%m%f%b in %F{blue}%B${PWD/$HOME/~}%b%f" 24 | 25 | # display vcs info 26 | if [ "$vcs_info_msg_0_" ]; then 27 | s="$s $vcs_info_msg_0_" 28 | fi 29 | 30 | # display newline before prompt 31 | s="$s\n" 32 | 33 | # print virtualenv name if active 34 | if [ $VIRTUAL_ENV ]; then 35 | s="$s%K{black}${${(s:/:)VIRTUAL_ENV}[-1]}%k" 36 | fi 37 | 38 | echo -e "\n$s%F{magenta}>%f " 39 | } 40 | 41 | _rprompt() { 42 | # print return code if non-zero 43 | local rc=$? 44 | if [[ $rc != 0 ]]; then 45 | s="%F{red}$rc!%f" 46 | fi 47 | echo -e $s 48 | } 49 | 50 | PROMPT='$(_prompt)' 51 | RPROMPT='$(_rprompt)' 52 | -------------------------------------------------------------------------------- /plugins/theme/func/theme: -------------------------------------------------------------------------------- 1 | theme() { 2 | if [ $1 ]; then 3 | if [ -f ~/.zsh/plugins/theme/colors/$1.zsh ]; then 4 | echo "Switching to $1" 5 | source ~/.zsh/plugins/theme/colors/$1.zsh 6 | echo $1 > ~/.zsh/local/theme.last 7 | else 8 | echo "Can't find that theme" 9 | fi 10 | else 11 | echo $(cat ~/.zsh/local/theme.last) 12 | fi 13 | } 14 | 15 | # vim: ft=zsh 16 | -------------------------------------------------------------------------------- /plugins/theme/hardcore.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_FMT='%F{magenta}‹%b%c%u%0.10i%m%s›%f' 7 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a%m%s›%f' 8 | 9 | export VCS_INFO_HG_FMT='%F{magenta}‹%b%c%u%0.8i %m%s›%f' 10 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a %m%s›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r ' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | export ZEESH_THEME_NORMAL_CHAR='\n:' 23 | export ZEESH_THEME_VISUAL_CHAR='\n:' 24 | export ZEESH_THEME_INSERT_CHAR='\n;' 25 | export ZEESH_THEME_PROMPT_CHAR=' ' 26 | 27 | alias :=; 28 | alias ::=; 29 | alias :::=; 30 | alias ::::=; 31 | alias :::::=; 32 | alias ::::::=; 33 | alias :::::::=; 34 | alias ::::::::=; 35 | alias :::::::::=; 36 | alias ::::::::::=; 37 | 38 | _prompt() { 39 | local mode= 40 | case $KEYMAP in 41 | vicmd) 42 | mode=$ZEESH_THEME_NORMAL_CHAR 43 | ;; 44 | vivis) 45 | mode=$ZEESH_THEME_VISUAL_CHAR 46 | ;; 47 | *) 48 | mode=$ZEESH_THEME_INSERT_CHAR 49 | ;; 50 | esac 51 | 52 | local s="%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b %F{blue}%B${PWD/$HOME/~}%b%f" 53 | 54 | # display vcs info 55 | if [ "$vcs_info_msg_0_" ]; then 56 | s="$s $vcs_info_msg_0_" 57 | fi 58 | 59 | # print virtualenv name if active 60 | if [ $VIRTUAL_ENV ]; then 61 | s="$s %F{magenta}‹${${(s:/:)VIRTUAL_ENV}[-1]}›%f " 62 | fi 63 | 64 | echo -e "$s%F{magenta} $mode$ZEESH_THEME_PROMPT_CHAR%f" 65 | } 66 | 67 | _rprompt() { 68 | # print return code if non-zero 69 | local rc=$? 70 | 71 | if [[ $rc != 0 ]]; then 72 | local s="%F{red}% $(emoticon) $rc!%f" 73 | fi 74 | 75 | echo -e $s 76 | } 77 | 78 | PROMPT='$(_prompt)' 79 | RPROMPT='$(_rprompt)' 80 | 81 | zle-keymap-select() { 82 | zle reset-prompt 83 | } 84 | zle -N zle-keymap-select 85 | 86 | zle-line-init() { 87 | zle reset-prompt 88 | } 89 | zle -N zle-line-init 90 | -------------------------------------------------------------------------------- /plugins/theme/plugin: -------------------------------------------------------------------------------- 1 | ### theme / zeesh! plugin 2 | 3 | export PATH=$PATH:$plugin_dir/bin 4 | fpath=( $plugin_dir/func $fpath ) 5 | autoload -U $plugin_dir/func/*(:t) 6 | 7 | autoload colors; colors 8 | setopt prompt_subst transientrprompt 9 | 10 | _list_colors() { 11 | reply=(`ls ~/.zsh/plugins/theme/colors | cut -d . -f1`) 12 | } 13 | 14 | # theme completion 15 | compctl -K _list_colors theme 16 | 17 | # Load last theme 18 | if [ -f ~/.zsh/local/theme.last ]; then 19 | local theme=$(cat ~/.zsh/local/theme.last) 20 | source ~/.zsh/plugins/theme/colors/$theme.zsh 21 | fi 22 | 23 | # vim: ft=zsh 24 | -------------------------------------------------------------------------------- /plugins/theme/pure.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a%m%s›%f' 7 | export VCS_INFO_GIT_FMT='%F{magenta}‹%b%c%u%0.10i%m%s›%f' 8 | 9 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}‹%b%c%u %i %a %m%s›%f' 10 | export VCS_INFO_HG_FMT='%F{magenta}‹%b%c%u %i %m%s›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | export ZEESH_THEME_PROMPT_CHAR=${ZEESH_THEME_PROMPT_CHAR:-❯} 23 | export ZEESH_THEME_NORMAL_CHAR=${ZEESH_THEME_NORMAL_CHAR:-'\n⊙'} 24 | export ZEESH_THEME_VISUAL_CHAR=${ZEESH_THEME_VISUAL_CHAR:-'\n⊡'} 25 | export ZEESH_THEME_INSERT_CHAR=${ZEESH_THEME_INSERT_CHAR:-'\n$ZEESH_THEME_PROMPT_CHAR'} 26 | 27 | _prompt() { 28 | local mode= 29 | local s= 30 | 31 | case $KEYMAP in 32 | vicmd) 33 | mode=$ZEESH_THEME_NORMAL_CHAR 34 | ;; 35 | vivis) 36 | mode=$ZEESH_THEME_VISUAL_CHAR 37 | ;; 38 | *) 39 | mode=$ZEESH_THEME_INSERT_CHAR 40 | ;; 41 | esac 42 | 43 | # only show user if in ssh connection 44 | [[ "$SSH_CONNECTION" != '' ]] && s="%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b " 45 | 46 | s="$s%F{blue}%B${PWD/$HOME/~}%b%f" 47 | 48 | # display vcs info 49 | if [ "$vcs_info_msg_0_" ]; then 50 | s="$s $vcs_info_msg_0_" 51 | fi 52 | 53 | # print virtualenv name if active 54 | if [ $VIRTUAL_ENV ]; then 55 | s="$s %F{magenta}‹${${(s:/:)VIRTUAL_ENV}[-1]}›%f " 56 | fi 57 | 58 | echo -e "$s%F{magenta} $mode$ZEESH_THEME_PROMPT_CHAR%f " 59 | } 60 | 61 | _rprompt() { 62 | # print return code if non-zero 63 | local rc=$? 64 | 65 | if [[ $rc != 0 ]]; then 66 | local s="%F{red}% $(emoticon) $rc!%f" 67 | fi 68 | 69 | echo -e $s 70 | } 71 | 72 | PROMPT='$(_prompt)' 73 | RPROMPT='$(_rprompt)' 74 | 75 | zle-keymap-select() { 76 | zle reset-prompt 77 | } 78 | zle -N zle-keymap-select 79 | 80 | zle-line-init() { 81 | zle reset-prompt 82 | } 83 | zle -N zle-line-init 84 | -------------------------------------------------------------------------------- /plugins/theme/slim.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}%b%m@%0.10i%c%u %a%f' 7 | export VCS_INFO_GIT_FMT='%F{magenta}%b%m@%0.10i%c%u%f' 8 | 9 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}%b%m@%i%c%u %a%f' 10 | export VCS_INFO_HG_FMT='%F{magenta}%b%m@%i%c%u%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | _prompt() { 23 | echo -e "%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b%F{magenta}›%f " 24 | } 25 | 26 | _rprompt() { 27 | local rc=$? 28 | local s="" 29 | 30 | # print return code if non-zero 31 | if [[ $rc != 0 ]]; then 32 | rc="$rc"! 33 | s="%F{red}% $rc$(emoticon) %f" 34 | fi 35 | 36 | # print virtualenv name if active 37 | if [ $VIRTUAL_ENV ]; then 38 | s="$s%F{magenta}${${(s:/:)VIRTUAL_ENV}[-1]}%f:" 39 | fi 40 | 41 | # print path 42 | s="$s%F{blue}%B${PWD/$HOME/~}%b%f" 43 | 44 | # display vcs info 45 | if [ "$vcs_info_msg_0_" ]; then 46 | s="$s $vcs_info_msg_0_" 47 | fi 48 | 49 | echo -e $s 50 | } 51 | 52 | PROMPT='$(_prompt)' 53 | RPROMPT='$(_rprompt)' 54 | -------------------------------------------------------------------------------- /plugins/theme/socialist.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}‹%s %b%m %0.10i%c%u %a›%f' 7 | export VCS_INFO_GIT_FMT='%F{magenta}‹%s %b%m %0.10i%c%u›%f' 8 | 9 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}‹%s %b%m %i%c%u %a›%f' 10 | export VCS_INFO_HG_FMT='%F{magenta}‹%s %b%m %i%c%u›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | _prompt() { 23 | local s="%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b %F{blue}%B${PWD/$HOME/~}%b%f" 24 | 25 | # display vcs info 26 | if [ "$vcs_info_msg_0_" ]; then 27 | s="$s $vcs_info_msg_0_" 28 | fi 29 | 30 | # split 31 | s="$s\n" 32 | 33 | # print virtualenv name if active 34 | if [ $VIRTUAL_ENV ]; then 35 | s="$s%F{magenta}${${(s:/:)VIRTUAL_ENV}[-1]}%f" 36 | fi 37 | 38 | echo -e "$s%F{magenta}%(!.☭.⚘)%f " 39 | } 40 | 41 | _rprompt() { 42 | # print return code if non-zero 43 | local rc=$? 44 | 45 | if [[ $rc != 0 ]]; then 46 | local s="%F{red}% $rc!%f" 47 | fi 48 | 49 | echo -e $s 50 | } 51 | 52 | PROMPT='$(_prompt)' 53 | RPROMPT='$(_rprompt)' 54 | -------------------------------------------------------------------------------- /plugins/theme/solace.zsh: -------------------------------------------------------------------------------- 1 | export VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | _rprompt() { 4 | local s='' 5 | 6 | # print return code if non-zero 7 | local rc=$? 8 | if [[ $rc != 0 ]]; then 9 | s="%F{red}$rc!%f " 10 | fi 11 | 12 | # print virtualenv name if active 13 | if [ $VIRTUAL_ENV ]; then 14 | s="$s%K{black}${${(s:/:)VIRTUAL_ENV}[-1]}%k" 15 | fi 16 | 17 | # display vcs info 18 | if [ "$vcs_info_msg_0_" ]; then 19 | [ $VIRTUAL_ENV ] && s="$s " 20 | s="$s%K{black}$vcs_info_msg_0_%k" 21 | fi 22 | echo -e $s 23 | } 24 | 25 | PROMPT='%B%F{magenta}%n%b%f%F{magenta}@%f%B%F{magenta}%m%b%f %F{blue}%B${PWD/$HOME/~}%b%F{magenta} ›%f ' 26 | RPROMPT='$(_rprompt)' 27 | -------------------------------------------------------------------------------- /plugins/theme/vi-statusline-legacy.zsh: -------------------------------------------------------------------------------- 1 | # Legacy version of vi-statusline with proper 2 | # vcs info formatting on zsh <5.0. 3 | 4 | VIRTUAL_ENV_DISABLE_PROMPT=true 5 | 6 | if zeesh-plugin-enabled vcs-info; then 7 | export VCS_INFO_BRANCH_FMT='%b' 8 | export VCS_INFO_STAGED_FMT='+' 9 | export VCS_INFO_UNSTAGED_FMT='!' 10 | export VCS_INFO_TIMESINCE_FMT='$s' 11 | 12 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}‹%s %b%m %0.10i%c%u %a›%f' 13 | export VCS_INFO_GIT_FMT='%F{magenta}‹%s %b%m %0.10i%c%u›%f' 14 | 15 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}‹%s %b%m %i%c%u %a›%f' 16 | export VCS_INFO_HG_FMT='%F{magenta}‹%s %b%m %i%c%u›%f' 17 | 18 | export VCS_INFO_HG_BOOKMARK_FMT='' 19 | export VCS_INFO_HG_REV_FMT='%r' 20 | 21 | source ~/.zsh/plugins/vcs-info/style.zsh 22 | fi 23 | 24 | export ZEESH_THEME_NORMAL_CHAR= 25 | export ZEESH_THEME_VISUAL_CHAR= 26 | export ZEESH_THEME_INSERT_CHAR= 27 | # export ZEESH_THEME_NORMAL_CHAR_R=‹normal› 28 | # export ZEESH_THEME_VISUAL_CHAR_R=‹visual› 29 | # export ZEESH_THEME_INSERT_CHAR_R=‹insert› 30 | export ZEESH_THEME_PROMPT_CHAR=› 31 | 32 | _prompt() { 33 | local mode= 34 | case $KEYMAP in 35 | vicmd) 36 | mode=$ZEESH_THEME_NORMAL_CHAR 37 | ;; 38 | vivis) 39 | mode=$ZEESH_THEME_VISUAL_CHAR 40 | ;; 41 | *) 42 | mode=$ZEESH_THEME_INSERT_CHAR 43 | ;; 44 | esac 45 | 46 | local s="%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b %F{blue}%B${PWD/$HOME/~}%b%f" 47 | 48 | # display vcs info 49 | if [ "$vcs_info_msg_0_" ]; then 50 | s="$s $vcs_info_msg_0_" 51 | fi 52 | 53 | # print virtualenv name if active 54 | if [ $VIRTUAL_ENV ]; then 55 | s="$s %F{magenta}‹${${(s:/:)VIRTUAL_ENV}[-1]}›%f " 56 | fi 57 | 58 | echo -e "$s%F{magenta} $mode$ZEESH_THEME_PROMPT_CHAR%f " 59 | } 60 | 61 | _rprompt() { 62 | # print return code if non-zero 63 | local rc=$? 64 | 65 | if [[ $rc != 0 ]]; then 66 | local s="%F{red}% $(emoticon) $rc!%f" 67 | fi 68 | 69 | echo -e $s 70 | } 71 | 72 | PROMPT='$(_prompt)' 73 | RPROMPT='$(_rprompt)' 74 | 75 | zle-keymap-select() { 76 | zle reset-prompt 77 | } 78 | zle -N zle-keymap-select 79 | 80 | zle-line-init() { 81 | zle reset-prompt 82 | } 83 | zle -N zle-line-init 84 | -------------------------------------------------------------------------------- /plugins/theme/vi-statusline.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_FMT='%F{magenta}‹%b%c%u%0.10i%m%s›%f' 7 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a%m%s›%f' 8 | 9 | export VCS_INFO_HG_FMT='%F{magenta}‹%b%c%u%0.8i %m%s›%f' 10 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a %m%s›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r ' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | alias -g ›=; 23 | alias ›=; 24 | export ZEESH_THEME_NORMAL_CHAR='\n⊙' 25 | export ZEESH_THEME_VISUAL_CHAR='\n⊡' 26 | export ZEESH_THEME_INSERT_CHAR='\n›' 27 | export ZEESH_THEME_PROMPT_CHAR='' 28 | 29 | _prompt() { 30 | local mode= 31 | case $KEYMAP in 32 | vicmd) 33 | mode=$ZEESH_THEME_NORMAL_CHAR 34 | ;; 35 | vivis) 36 | mode=$ZEESH_THEME_VISUAL_CHAR 37 | ;; 38 | *) 39 | mode=$ZEESH_THEME_INSERT_CHAR 40 | ;; 41 | esac 42 | 43 | local s="%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b %F{blue}%B${PWD/$HOME/~}%b%f" 44 | 45 | # display vcs info 46 | if [ "$vcs_info_msg_0_" ]; then 47 | s="$s $vcs_info_msg_0_" 48 | fi 49 | 50 | # print virtualenv name if active 51 | if [ $VIRTUAL_ENV ]; then 52 | s="$s %F{magenta}‹${${(s:/:)VIRTUAL_ENV}[-1]}›%f " 53 | fi 54 | 55 | echo -e "$s%F{magenta} $mode$ZEESH_THEME_PROMPT_CHAR%f " 56 | } 57 | 58 | _rprompt() { 59 | # print return code if non-zero 60 | local rc=$? 61 | 62 | if [[ $rc != 0 ]]; then 63 | local s="%F{red}% $(emoticon) $rc!%f" 64 | fi 65 | 66 | echo -e $s 67 | } 68 | 69 | PROMPT='$(_prompt)' 70 | RPROMPT='$(_rprompt)' 71 | 72 | zle-keymap-select() { 73 | zle reset-prompt 74 | } 75 | zle -N zle-keymap-select 76 | 77 | zle-line-init() { 78 | zle reset-prompt 79 | } 80 | zle -N zle-line-init 81 | -------------------------------------------------------------------------------- /plugins/theme/zen.zsh: -------------------------------------------------------------------------------- 1 | VIRTUAL_ENV_DISABLE_PROMPT=true 2 | 3 | if zeesh-plugin-enabled vcs-info; then 4 | export VCS_INFO_BRANCH_FMT='%b' 5 | 6 | export VCS_INFO_GIT_FMT='%F{magenta}‹%b%c%u%0.10i%m%s›%f' 7 | export VCS_INFO_GIT_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a%m%s›%f' 8 | 9 | export VCS_INFO_HG_FMT='%F{magenta}‹%b%c%u%0.8i %m%s›%f' 10 | export VCS_INFO_HG_ACTION_FMT='%F{magenta}‹%b%c%u%0.10i %a %m%s›%f' 11 | 12 | export VCS_INFO_HG_BOOKMARK_FMT='' 13 | export VCS_INFO_HG_REV_FMT='%r ' 14 | 15 | export VCS_INFO_STAGED_FMT='+' 16 | export VCS_INFO_UNSTAGED_FMT='!' 17 | export VCS_INFO_TIMESINCE_FMT='$s' 18 | 19 | source ~/.zsh/plugins/vcs-info/style.zsh 20 | fi 21 | 22 | export ZEESH_THEME_NORMAL_CHAR='\n' 23 | export ZEESH_THEME_VISUAL_CHAR='\n' 24 | export ZEESH_THEME_INSERT_CHAR='\n' 25 | export ZEESH_THEME_PROMPT_CHAR='' 26 | 27 | _prompt() { 28 | local mode= 29 | case $KEYMAP in 30 | vicmd) 31 | mode=$ZEESH_THEME_NORMAL_CHAR 32 | ;; 33 | vivis) 34 | mode=$ZEESH_THEME_VISUAL_CHAR 35 | ;; 36 | *) 37 | mode=$ZEESH_THEME_INSERT_CHAR 38 | ;; 39 | esac 40 | 41 | local s="%F{magenta}%B%n%b%f%F{magenta}@%f%F{magenta}%B%m%f%b %F{blue}%B${PWD/$HOME/~}%b%f" 42 | 43 | # display vcs info 44 | if [ "$vcs_info_msg_0_" ]; then 45 | s="$s $vcs_info_msg_0_" 46 | fi 47 | 48 | # print virtualenv name if active 49 | if [ $VIRTUAL_ENV ]; then 50 | s="$s %F{magenta}‹${${(s:/:)VIRTUAL_ENV}[-1]}›%f " 51 | fi 52 | 53 | echo -e "$s%F{magenta} $mode$ZEESH_THEME_PROMPT_CHAR%f" 54 | } 55 | 56 | _rprompt() { 57 | # print return code if non-zero 58 | local rc=$? 59 | 60 | if [[ $rc != 0 ]]; then 61 | local s="%F{red}% $(emoticon) $rc!%f" 62 | fi 63 | 64 | echo -e $s 65 | } 66 | 67 | PROMPT='$(_prompt)' 68 | RPROMPT='$(_rprompt)' 69 | 70 | zle-keymap-select() { 71 | zle reset-prompt 72 | } 73 | zle -N zle-keymap-select 74 | 75 | zle-line-init() { 76 | zle reset-prompt 77 | } 78 | zle -N zle-line-init 79 | -------------------------------------------------------------------------------- /plugins/upgrade/do_upgrade.zsh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | # tries to silently check for upgrades after login in the background 3 | if [ $1 ]; then 4 | 5 | # change dir to repo 6 | cd $1 7 | if [[ `hg id | cut -d ' ' -f 1` != `hg id default | cut -d ' ' -f 1` ]]; then 8 | hg pull > /dev/null 9 | hg up > /dev/null 10 | fi 11 | else 12 | echo 'requires path to repo' 13 | fi 14 | -------------------------------------------------------------------------------- /plugins/upgrade/plugin: -------------------------------------------------------------------------------- 1 | # plugin to upgrade hg repo every login 2 | 3 | # local path to repo 4 | repo=$HOME 5 | 6 | ~/.zsh/plugins/upgrade/do_upgrade.zsh $repo &! 7 | 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /plugins/upstart/comp/_log: -------------------------------------------------------------------------------- 1 | #compdef log 2 | _arguments "1: :(`_list_upstart_apps`)" 3 | -------------------------------------------------------------------------------- /plugins/upstart/comp/_restart: -------------------------------------------------------------------------------- 1 | #compdef restart 2 | _arguments "1: :(`_list_upstart_apps`)" 3 | -------------------------------------------------------------------------------- /plugins/upstart/comp/_start: -------------------------------------------------------------------------------- 1 | #compdef start 2 | _arguments "1: :(`_list_upstart_apps`)" 3 | -------------------------------------------------------------------------------- /plugins/upstart/comp/_stop: -------------------------------------------------------------------------------- 1 | #compdef stop 2 | _arguments "1: :(`_list_upstart_apps`)" 3 | -------------------------------------------------------------------------------- /plugins/upstart/func/log: -------------------------------------------------------------------------------- 1 | log() { 2 | if [ ! -f $_UPSTART_INIT_DIR/$1/log ]; then 3 | echo 'unsupported app' 4 | return 1 5 | fi 6 | 7 | source $_UPSTART_INIT_DIR/$1/log 8 | } 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /plugins/upstart/func/reload: -------------------------------------------------------------------------------- 1 | reload() { 2 | if [ ! -f $_UPSTART_INIT_DIR/$1/reload ]; then 3 | echo 'unsupported app' 4 | else 5 | source $_UPSTART_INIT_DIR/$1/reload 6 | fi 7 | } 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/upstart/func/restart: -------------------------------------------------------------------------------- 1 | restart() { 2 | if [ ! -f $_UPSTART_INIT_DIR/$1/start ]; then 3 | echo 'unsupported app' 4 | return 1 5 | fi 6 | 7 | stop $1 8 | start $1 9 | } 10 | 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /plugins/upstart/func/start: -------------------------------------------------------------------------------- 1 | start() { 2 | if [ ! -f $_UPSTART_INIT_DIR/$1/start ]; then 3 | echo 'unsupported app' 4 | exit 1 5 | fi 6 | 7 | source $_UPSTART_INIT_DIR/$1/start 8 | } 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /plugins/upstart/func/stop: -------------------------------------------------------------------------------- 1 | stop() { 2 | if [ ! -f $_UPSTART_INIT_DIR/$1/start ]; then 3 | echo 'unsupported app' 4 | return 1 5 | fi 6 | 7 | if [ ! -f $_UPSTART_INIT_DIR/$1/stop ]; then 8 | echo 'stop unsupported' 9 | return 1 10 | fi 11 | 12 | source $_UPSTART_INIT_DIR/$1/stop 13 | } 14 | 15 | # vim: ft=zsh 16 | -------------------------------------------------------------------------------- /plugins/upstart/init/cassandra/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | if [ -f /usr/local/opt/cassandra/bin/cassandra ]; then 3 | /usr/local/opt/cassandra/bin/cassandra 4 | else 5 | echo unable to find cassandra, try 'brew install cassandra' 6 | fi 7 | -------------------------------------------------------------------------------- /plugins/upstart/init/cassandra/stop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | if [ -f /usr/local/opt/nginx/sbin/nginx ]; then 4 | version=`/usr/local/opt/nginx/sbin/nginx -v 2>&1 | cut -d '/' -f 2` 5 | launchctl unload -w /usr/local/Cellar/nginx/$version/homebrew.mxcl.nginx.plist 6 | else 7 | echo unable to find nginx binary 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/upstart/init/couchdb/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | tail -n 20 -f /usr/local/var/log/nginx/access_log 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/couchdb/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | if [ -f /usr/local/opt/nginx/sbin/nginx ]; then 4 | version=`/usr/local/opt/nginx/sbin/nginx -v 2>&1 | cut -d '/' -f 2` 5 | launchctl load -w /usr/local/Cellar/nginx/$version/homebrew.mxcl.nginx.plist 6 | else 7 | echo unable to find nginx binary 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/upstart/init/couchdb/stop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | if [ -f /usr/local/opt/nginx/sbin/nginx ]; then 4 | version=`/usr/local/opt/nginx/sbin/nginx -v 2>&1 | cut -d '/' -f 2` 5 | launchctl unload -w /usr/local/Cellar/nginx/$version/homebrew.mxcl.nginx.plist 6 | else 7 | echo unable to find nginx binary 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/upstart/init/dnsmasq/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | tail -n 20 -f /usr/local/var/log/nginx/* 3 | -------------------------------------------------------------------------------- /plugins/upstart/init/dnsmasq/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | launchctl load -w /usr/local/opt/dnsmasq/*.plist 3 | -------------------------------------------------------------------------------- /plugins/upstart/init/dnsmasq/stop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | launchctl unload -w /usr/local/opt/dnsmasq/*.plist 3 | -------------------------------------------------------------------------------- /plugins/upstart/init/memcached/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | tail -n 20 -f /usr/local/var/log/redis.log 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/memcached/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | if [ -z "`ps uax | grep -v grep | grep memcached`" ]; then 4 | echo starting memcached 5 | /usr/local/opt/memcached/bin/memcached 6 | else 7 | echo memcached already running 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/upstart/init/mongodb/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | tail -n 20 -f /usr/local/var/log/mongodb/mongod.log 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/mongodb/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | mongod --fork --logpath /usr/local/var/log/mongodb/mongod.log 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/mysql/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | tail -n 20 -f /usr/local/var/log/mysql.log 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/mysql/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | mysql.server start 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/mysql/stop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | mysql.server stop 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/nginx/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | tail -n 20 -f /usr/local/var/log/nginx/* 3 | -------------------------------------------------------------------------------- /plugins/upstart/init/nginx/reload: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | nginx -s reload 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/nginx/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | nginx 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/nginx/stop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | nginx -s stop 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/php54/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | tail -n 20 -f /usr/local/Cellar/php54/5.4.23/var/log/php-fpm.log 3 | -------------------------------------------------------------------------------- /plugins/upstart/init/php54/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | launchctl load -w /usr/local/opt/php54/homebrew-php.josegonzalez.php54.plist 3 | -------------------------------------------------------------------------------- /plugins/upstart/init/php54/stop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | launchctl unload -w /usr/local/opt/php54/homebrew-php.josegonzalez.php54.plist 3 | -------------------------------------------------------------------------------- /plugins/upstart/init/postgresql/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | tail -n 20 -f /usr/local/var/postgres/server.log 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/postgresql/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | if [ -z "`pgrep postgres`" ]; then 4 | pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start 5 | else 6 | echo postgresql already running 7 | fi 8 | -------------------------------------------------------------------------------- /plugins/upstart/init/postgresql/stop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | pg_ctl -D /usr/local/var/postgres stop -s -m fast 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/redis/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | tail -n 20 -f /usr/local/var/log/redis.log 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/redis/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | if [ -z "`pgrep redis-server`" ]; then 4 | echo starting redis 5 | redis-server /usr/local/etc/redis.conf --daemonize yes --logfile /usr/local/var/log/redis.log 6 | else 7 | echo redis already running 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/upstart/init/redis/stop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | if [ -z "`ps uax | grep -v grep | grep redis-server`" ]; then 4 | echo redis not running 5 | else 6 | echo stopping redis 7 | kill `pgrep redis-server` 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/upstart/init/riak/log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | riak attach 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/riak/start: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | riak start 4 | -------------------------------------------------------------------------------- /plugins/upstart/init/riak/stop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | riak stop 4 | -------------------------------------------------------------------------------- /plugins/upstart/plugin: -------------------------------------------------------------------------------- 1 | ### upstart / zeesh! plugin 2 | 3 | # upstart-like helpers for homebrew mac systems 4 | 5 | # helper for completion functions 6 | export _UPSTART_INIT_DIR=$plugin_dir/init 7 | _list_upstart_apps() { 8 | installed=(/usr/local/Cellar/*(:t)) 9 | supported=($_UPSTART_INIT_DIR/*(:t)) 10 | regex=${(j:|:)installed} 11 | 12 | available=() 13 | for (( i=1; i <= $#supported; i++)); do 14 | if [ -n "`echo $supported[$i] | grep -E --color=never $regex`" ]; then 15 | available[$i]=$supported[$i] 16 | fi 17 | done 18 | echo $available 19 | } 20 | 21 | fpath=( $plugin_dir/func $plugin_dir/comp $fpath ) 22 | autoload -U $plugin_dir/func/*(:t) $plugin_dir/comp/*(:t) 23 | 24 | # vim: ft=zsh 25 | -------------------------------------------------------------------------------- /plugins/uwsgi/default.prefs: -------------------------------------------------------------------------------- 1 | # default prefs for uwsgi, only used by zeesh-prefs to create new prefs file 2 | # to modify your actual preferences for this plugin edit ~/.zsh/local/uwsgi.prefs 3 | args: -s 127.0.0.1:3031 -M -p 8 -L -l 1000 -v 256 -z 5 -O 2 -H $(pwd) --pythonpath $(pwd) --chdir $(pwd) -w $app 4 | -------------------------------------------------------------------------------- /plugins/uwsgi/func/uwsgi-wrapper: -------------------------------------------------------------------------------- 1 | uwsgi-wrapper() { 2 | typeset -A prefs 3 | zeesh-prefs get uwsgi # try to get prefs or create new prefs file using default.prefs 4 | if [[ $prefs != "" ]]; then 5 | if [ $1 ] && [ $2 ]; then 6 | if [[ -d $(pwd)/$2 ]]; then 7 | app=$( echo $2 | sed s,/,,g )'.uwsgi' 8 | eval "args=$prefs[args]" 9 | case $1 in 10 | start) 11 | if [[ $(ps | grep uwsgi | tr -s ' ' '\t' | cut -f11) == 'uwsgi' ]]; then 12 | echo 'uwsgi is already running!' 13 | else 14 | cmd='sudo uwsgi '$args 15 | echo "executing $cmd" 16 | echo $cmd | /bin/sh 17 | fi 18 | ;; 19 | stop) 20 | if [[ $(ps | grep uwsgi | tr -s ' ' '\t' | cut -f11) == 'uwsgi' ]]; then 21 | sudo pkill -9 uwsgi 22 | else 23 | echo 'uwsgi is not running!' 24 | fi 25 | ;; 26 | restart) 27 | if [[ $(ps | grep uwsgi | tr -s ' ' '\t' | cut -f11) == 'uwsgi' ]]; then 28 | sudo pkill -9 uwsgi 29 | cmd='sudo uwsgi '$args 30 | echo "executing $cmd" 31 | echo $cmd | /bin/sh 32 | else 33 | echo 'uwsgi is not running!' 34 | fi 35 | ;; 36 | esac 37 | else 38 | echo 'please specify a valid app' 39 | fi 40 | else 41 | echo 'please specify a valid command and app' 42 | fi 43 | fi 44 | } 45 | 46 | # vim: ft=zsh 47 | -------------------------------------------------------------------------------- /plugins/uwsgi/plugin: -------------------------------------------------------------------------------- 1 | ### uwsgi / zeesh! plugin 2 | ### wrapper for uwsgi to make restarting a bit easier 3 | 4 | fpath=( ~/.zsh/plugins/uwsgi/func $fpath ) 5 | autoload -U ~/.zsh/plugins/uwsgi/func/*(:t) 6 | 7 | ## aliases 8 | alias uwsgi=uwsgi-wrapper 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /plugins/vcs-info/plugin: -------------------------------------------------------------------------------- 1 | ### zeesh! / vcs-info 2 | 3 | # this plugin enables vcs_info for zsh 4 | autoload -Uz add-zsh-hook vcs_info 5 | 6 | export VCS_INFO_BRANCH_FMT=${VCS_INFO_BRANCH_FMT:-'%b'} 7 | 8 | export VCS_INFO_GIT_ACTION_FMT=${VCS_INFO_GIT_ACTION_FMT:-'%s:%b%m@%0.10i%c%u:%a'} 9 | export VCS_INFO_GIT_FMT=${VCS_INFO_GIT_FMT:-'%s:%b%m@%0.10i%c%u'} 10 | 11 | export VCS_INFO_HG_ACTION_FMT=${VCS_INFO_HG_ACTION_FMT:-'%s:%b%m@%i%c%u:%a'} 12 | export VCS_INFO_HG_FMT=${VCS_INFO_HG_FMT:-'%s:%b%m@%i%c%u'} 13 | export VCS_INFO_HG_BOOKMARK_FMT=${VCS_INFO_HG_BOOKMARK_FMT:-} 14 | export VCS_INFO_HG_REV_FMT=${VCS_INFO_HG_REV_FMT:-'%r'} 15 | 16 | export VCS_INFO_STAGED_FMT=${VCS_INFO_STAGED_FMT:-'+'} 17 | export VCS_INFO_UNSTAGED_FMT=${VCS_INFO_UNSTAGED_FMT:-'!'} 18 | export VCS_INFO_TIMESINCE_FMT=${VCS_INFO_TIMESINCE_FMT:-'$s'} 19 | 20 | # Call vcs_info as precmd before every prompt. 21 | _vcspromptprecmd() { 22 | vcs_info 23 | } 24 | add-zsh-hook precmd _vcspromptprecmd 25 | 26 | # Must run vcs_info when changing directories. 27 | _vcspromptchpwd() { 28 | FORCE_RUN_VCS_INFO=1 29 | } 30 | add-zsh-hook chpwd _vcspromptchpwd 31 | 32 | # Display info on right if no theme enabled. 33 | if ! zeesh-plugin-enabled theme; then 34 | source ~/.zsh/plugins/vcs-info/style.zsh 35 | export RPROMPT='${vcs_info_msg_0_}' 36 | fi 37 | 38 | # vim: ft=zsh 39 | -------------------------------------------------------------------------------- /plugins/vi-mode/func/gvim-wrapper: -------------------------------------------------------------------------------- 1 | gvim-wrapper() { 2 | local servername="`vim --serverlist | head -n 1`" 3 | if [ "$servername" ]; then 4 | gvim --servername "$servername" --remote-silent $@ > /dev/null 2>&1 5 | else 6 | gvim $@ > /dev/null 2>&1 7 | fi 8 | } 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /plugins/vi-mode/func/mvim-wrapper: -------------------------------------------------------------------------------- 1 | mvim-wrapper() { 2 | local servername="`mvim --serverlist | head -n 1`" 3 | if [ "$servername" ]; then 4 | mvim --servername "$servername" --remote-silent $@ > /dev/null 2>&1 5 | else 6 | mvim $@ > /dev/null 2>&1 7 | fi 8 | } 9 | 10 | # vim: ft=zsh 11 | -------------------------------------------------------------------------------- /plugins/vi-mode/old.zsh: -------------------------------------------------------------------------------- 1 | # These are required for zsh < 5.0.8 2 | 3 | # Delete from cursor position to end of word and stay in normal mode 4 | zle-vicmd-de() { 5 | zle kill-word 6 | } 7 | 8 | # Delete from cursor position to end of word + surrounding whitespace and stay in normal mode 9 | zle-vicmd-dw() { 10 | zle kill-word 11 | zle vi-delete-char 12 | } 13 | 14 | # Delete from cursor position to end of word and stay in normal mode 15 | zle-vicmd-db() { 16 | zle vi-backward-kill-word 17 | zle vi-backward-delete-char 18 | } 19 | 20 | # Delete current word and stay in normal mode 21 | zle-vicmd-diw() { 22 | zle kill-word 23 | } 24 | 25 | # Delete from current positon to end of word and change to insert mode 26 | zle-vicmd-cw() { 27 | zle kill-word 28 | zle -K viins 29 | } 30 | 31 | # Delete current word and change to insert mode 32 | zle-vicmd-ciw() { 33 | zle kill-word 34 | zle -K viins 35 | } 36 | 37 | # Delete current word and surrounding whitespace and change to insert mode 38 | zle-vicmd-caw() { 39 | zle kill-word 40 | zle vi-delete-char 41 | zle -K viins 42 | } 43 | 44 | zle -N zle-vicmd-caw 45 | zle -N zle-vicmd-ciw 46 | zle -N zle-vicmd-cw 47 | zle -N zle-vicmd-db 48 | zle -N zle-vicmd-de 49 | zle -N zle-vicmd-diw 50 | zle -N zle-vicmd-dw 51 | 52 | bindkey -M vicmd 'caw' zle-vicmd-caw 53 | bindkey -M vicmd 'ciw' zle-vicmd-ciw 54 | bindkey -M vicmd 'cw' zle-vicmd-cw 55 | bindkey -M vicmd 'db' zle-vicmd-db 56 | bindkey -M vicmd 'de' zle-vicmd-de 57 | bindkey -M vicmd 'diw' zle-vicmd-diw 58 | bindkey -M vicmd 'dw' zle-vicmd-dw 59 | 60 | bindkey -M vicmd 'u' undo 61 | bindkey -M vicmd '^R' redo 62 | -------------------------------------------------------------------------------- /plugins/vi-visual-mode/install: -------------------------------------------------------------------------------- 1 | url='http://bazaar.launchpad.net/~raybuntu/+junk/ZSH_stuff/download/head:/zle_vi_visual.zsh-20100104022202-vqm1bck1o1we2pho-2/zle_vi_visual.zsh' 2 | 3 | echo -n "I need to download zle_vi_visual.zsh before you can use $plugin. Is that ok? (y/N) " 4 | read ans 5 | if [[ "$ans" == "y" ]]; then 6 | hash curl 2>/dev/null || { echo >&2 "I require curl but it's not installed. Aborting."; exit 1; } 7 | mkdir -p $plugin_dir/lib 8 | curl $url -o $plugin_dir/lib/zle_vi_visual.zsh 9 | echo "...installed $plugin" 10 | fi 11 | -------------------------------------------------------------------------------- /plugins/vi-visual-mode/plugin: -------------------------------------------------------------------------------- 1 | ### vi-visual-mode / zeesh! plugin 2 | 3 | [ -d "$plugin_dir/lib" ] || source "$plugin_dir/install" 4 | 5 | source "$plugin_dir/lib/zle_vi_visual.zsh" >/dev/null 2>&1 6 | 7 | if [ "$EDITOR" = "vim" ]; then 8 | bindkey -rpM vivis '^[' 9 | bindkey -rpM vivis '' 10 | bindkey -M vivis '' zle-esc-in-place 11 | bindkey -M vivis '^[' zle-esc-in-place 12 | bindkey -M vivis 'i' vi-insert 13 | fi 14 | 15 | # vim: ft=zsh 16 | -------------------------------------------------------------------------------- /plugins/virtualbox/default.prefs: -------------------------------------------------------------------------------- 1 | # virtualbox zeesh! plugin example preferences file 2 | default: 3 | vboxmanage: 4 | -------------------------------------------------------------------------------- /plugins/virtualbox/func/vbox-manage: -------------------------------------------------------------------------------- 1 | # zeesh virtualbox management wrapper 2 | vbox-manage(){ 3 | usage='usage: (list|info|state|start|off|reset|pause|resume|save|snapshot|snapshots|switch|modify)' 4 | local cmd=$1 5 | local vm=$2 6 | local opts=$3 7 | local extraopts=$4 8 | 9 | typeset -A prefs 10 | zeesh-prefs virtualbox get 11 | local default=$prefs[default] 12 | local vboxmanage=$prefs[vboxmanage] 13 | 14 | # return usage if no command given 15 | [ -n "$cmd" ] || { echo $usage ; return } 16 | 17 | # handle non-vm specific commands 18 | non_vm_cmds=(commands list running) 19 | if [ -n "$non_vm_cmds[(r)$cmd]" ]; then 20 | case $cmd in 21 | commands) 22 | echo 'list:list vms' 23 | echo 'start:start vm' 24 | echo 'off:power off vm' 25 | echo 'reset:reset vm' 26 | echo 'pause:pause vm' 27 | echo 'resume:resume vm' 28 | echo 'save:save vm state' 29 | echo 'snapshot:take vm snapshot' 30 | echo 'snapshots:list vm snapshots' 31 | echo 'switch:switch vm snapshot' 32 | echo 'modify:modify vm' 33 | echo 'info:show vm info' 34 | echo 'state:show vm state' 35 | ;; 36 | list) 37 | vms=( ${(f)"$( vbox-vms )"} ) 38 | 39 | for i in {1..${#vms}}; do 40 | echo "$( _bold $vms[$i] ): $( $vboxmanage showvminfo $vms[$i] | grep 'State:' | tr -s ' ' | cut -d ' ' -f 2 ) / $(vbox-snapshots $vms[$i] current )" 41 | done 42 | unset vms 43 | ;; 44 | esac 45 | return 0 46 | fi 47 | 48 | # need a vm 49 | vbox-vms $vm || { echo 'specify a valid virtual machine'; return } 50 | 51 | # vm management commands 52 | case $cmd in 53 | start) 54 | vbox-running $vm && { echo "$vm is already running"; return } 55 | if [ -n "$opts" ]; then 56 | $vboxmanage startvm $vm --type $@[3,-1] 57 | else 58 | $vboxmanage startvm $vm --type headless 59 | fi 60 | ;; 61 | off) 62 | vbox-running $vm || { echo "$vm is not running"; return } 63 | $vboxmanage controlvm $vm poweroff 64 | ;; 65 | reset) 66 | vbox-running $vm || { echo "$vm is not running"; return } 67 | $vboxmanage controlvm $vm reset 68 | ;; 69 | pause) 70 | vbox-running $vm || { echo "$vm is not running"; return } 71 | $vboxmanage controlvm $vm pause 72 | ;; 73 | resume) 74 | vbox_running $vm && { echo "$vm is not running"; return } 75 | $vboxmanage controlvm $vm resume 76 | ;; 77 | save) 78 | vbox-running $vm || { echo "$vm is not running"; return } 79 | $vboxmanage controlvm $vm savestate 80 | ;; 81 | snapshot) 82 | $vboxmanage snapshot $vm take $opts 83 | ;; 84 | snapshots) 85 | vbox-snapshots $vm 86 | ;; 87 | switch) 88 | vbox-running $vm && { 89 | $vboxmanage controlvm $vm poweroff 90 | $vboxmanage snapshot $vm restore $opts 91 | if [ -n "$extraopts" ]; then 92 | $vboxmanage startvm $vm --type $extraopts 93 | else 94 | $vboxmanage startvm $vm --type headless 95 | fi 96 | return 0 97 | } 98 | $vboxmanage snapshot $vm restore $opts 99 | ;; 100 | info) 101 | $vboxmanage showvminfo $vm --details 102 | ;; 103 | state) 104 | echo "$( _bold state ): $( $vboxmanage showvminfo $vm | grep 'State:' | tr -s ' ' | cut -d ' ' -f 2- )" 105 | echo "$( _bold snapshot ): $(vbox-snapshots $vm current )" 106 | ;; 107 | modify) 108 | vbox-running $vm && { echo "stop $vm first"; return } 109 | $vboxmanage modifyvm $vm $@[3,-1] 110 | ;; 111 | *) 112 | echo $usage 113 | ;; 114 | esac 115 | } 116 | 117 | # vim: ft=zsh 118 | -------------------------------------------------------------------------------- /plugins/virtualbox/func/vbox-running: -------------------------------------------------------------------------------- 1 | # check if vm is running or returns a list of running vms 2 | vbox-running() { 3 | local vm=$1 4 | 5 | typeset -A prefs 6 | zeesh-prefs virtualbox get 7 | local vboxmanage=$prefs[vboxmanage] 8 | 9 | running=$($vboxmanage list runningvms | grep -o '^".*"' | cut -d '"' -f2) 10 | if [ -n "$vm" ]; then 11 | if [ -n "$running[(fr)$vm]" ]; then 12 | return 0 13 | else 14 | return 1 15 | fi 16 | else 17 | echo $running 18 | fi 19 | } 20 | 21 | # vim: ft=zsh 22 | -------------------------------------------------------------------------------- /plugins/virtualbox/func/vbox-snapshots: -------------------------------------------------------------------------------- 1 | # returns a list of snapshots for a vm 2 | vbox-snapshots() { 3 | local vm=$1 4 | local cmd=$2 5 | 6 | [ -n "$vm" ] || { echo 'No vm specified'; return 1 } 7 | 8 | typeset -A prefs 9 | zeesh-prefs virtualbox get 10 | local vboxmanage=$prefs[vboxmanage] 11 | 12 | _names() { 13 | $vboxmanage showvminfo --machinereadable $vm | grep -o 'SnapshotName.*' | cut -d '=' -f2 | tr -d '"' 14 | } 15 | _uuids() { 16 | $vboxmanage showvminfo --machinereadable $vm | grep -o 'SnapshotUUID.*' | cut -d '=' -f2 | tr -d '"' 17 | } 18 | _current() { 19 | $vboxmanage showvminfo $vm | /usr/bin/grep '*' | tr -s ' ' | cut -d ' ' -f 3- | tr -d '*' 20 | } 21 | 22 | case "$cmd" in 23 | current) 24 | _current 25 | ;; 26 | names) 27 | _names 28 | ;; 29 | uuids) 30 | _uuids 31 | ;; 32 | *) 33 | n=( ${(f)"$(_names)"} ) 34 | u=( ${(f)"$(_uuids)"} ) 35 | c=$( _current ) 36 | 37 | for i in {1..${#n}}; do 38 | l="$n[$i] (UUID: $u[$i])" 39 | if [[ "$l " == "$c" ]]; then 40 | l="$( _bold $l )" 41 | fi 42 | echo $l 43 | done 44 | unset n u c l 45 | ;; 46 | esac 47 | } 48 | 49 | # vim: ft=zsh 50 | -------------------------------------------------------------------------------- /plugins/virtualbox/func/vbox-vms: -------------------------------------------------------------------------------- 1 | # checks if vm exists or returns a list of vms 2 | vbox-vms() { 3 | local vm=$1 4 | 5 | typeset -A prefs 6 | zeesh-prefs virtualbox get 7 | local vboxmanage=$prefs[vboxmanage] 8 | 9 | vms=$($vboxmanage list vms | grep -o '^".*"' | cut -d '"' -f2) 10 | if [ -n "$vm" ]; then 11 | if [ -n "$vms[(fr)$vm]" ]; then 12 | return 0 13 | else 14 | return 1 15 | fi 16 | else 17 | echo $vms 18 | fi 19 | } 20 | 21 | # vim: ft=zsh 22 | -------------------------------------------------------------------------------- /plugins/virtualbox/plugin: -------------------------------------------------------------------------------- 1 | ### virtualbox / zeesh! plugin 2 | 3 | # make sure to change settings in prefs file before usage 4 | # ~/.zsh/plugins/virtualbox/prefs 5 | # default: 6 | # vboxmanage: 7 | 8 | fpath=( $plugin_dir/func $plugin_dir/comp $fpath ) 9 | autoload -U $plugin_dir/func/*(:t) 10 | autoload -U $plugin_dir/comp/*(:t) 11 | 12 | ## aliases 13 | alias vbox='vbox-manage' 14 | 15 | ## functions 16 | vbox-create-rawdisk() { 17 | sudo VBoxManage internalcommands createrawvmdk -filename $1 -rawdisk $2 18 | } 19 | 20 | # vim: ft=zsh 21 | -------------------------------------------------------------------------------- /plugins/virtualenv/comp/_cdv: -------------------------------------------------------------------------------- 1 | #compdef cdv 2 | _files -W `cdv --location` -/ 3 | -------------------------------------------------------------------------------- /plugins/virtualenv/func/cdv: -------------------------------------------------------------------------------- 1 | # switch to project dir in active virtualenv 2 | cdv() { 3 | if [ $VIRTUAL_ENV ]; then 4 | local project_dir="$VIRTUAL_ENV/${${(s:/:)VIRTUAL_ENV}[-1]}" 5 | if [ $1 ] && [ $1 = "--location" ]; then 6 | if [ -d "$project_dir" ]; then 7 | echo $project_dir 8 | else 9 | echo $VIRTUAL_ENV 10 | fi 11 | else 12 | if [ -d "$project_dir" ]; then 13 | cd $project_dir/$1 14 | else 15 | cd $VIRTUAL_ENV/$1 16 | fi 17 | fi 18 | else 19 | echo "No virtualenv activated" 20 | fi 21 | } 22 | 23 | # vim: ft=zsh 24 | -------------------------------------------------------------------------------- /plugins/virtualenv/func/ve-activate: -------------------------------------------------------------------------------- 1 | # activate virtualenv 2 | ve-activate() { 3 | if [ $1 ]; then 4 | local venv=$VIRTUALENVS_DIR/$1 5 | if [ -d $venv ]; then 6 | source $venv/bin/activate 7 | cd $VIRTUAL_ENV 8 | if [ -f $venv/bin/postactivate ]; then 9 | source $venv/bin/postactivate 10 | fi 11 | else 12 | echo "No virtualenv by that name found" 13 | fi 14 | else 15 | if [ -f bin/activate ]; then 16 | source bin/activate 17 | if [ -f bin/postactivate ]; then 18 | source bin/postactivate 19 | fi 20 | else 21 | echo "No virtualenv selected" 22 | fi 23 | fi 24 | } 25 | 26 | # vim: ft=zsh 27 | -------------------------------------------------------------------------------- /plugins/virtualenv/func/ve-deactivate: -------------------------------------------------------------------------------- 1 | # deactivate active virtualenv 2 | ve-deactivate() { 3 | # reset old environment variables 4 | if [ -n "$_OLD_VIRTUAL_PATH" ]; then 5 | PATH="$_OLD_VIRTUAL_PATH" 6 | export PATH 7 | unset _OLD_VIRTUAL_PATH 8 | fi 9 | if [ -n "$_OLD_VIRTUAL_PYTHONHOME" ] ; then 10 | PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME" 11 | export PYTHONHOME 12 | unset _OLD_VIRTUAL_PYTHONHOME 13 | fi 14 | 15 | if [ -n "$_OLD_VIRTUAL_PS1" ]; then 16 | PS1="$_OLD_VIRTUAL_PS1" 17 | export PS1 18 | unset _OLD_VIRTUAL_PS1 19 | fi 20 | 21 | unset VIRTUAL_ENV 22 | unset VIRTUAL_ENV_PROJECT_ROOT 23 | 24 | cd 25 | } 26 | 27 | # vim: ft=zsh 28 | -------------------------------------------------------------------------------- /plugins/virtualenv/func/ve-list: -------------------------------------------------------------------------------- 1 | ve-list() { 2 | set -A reply $(/bin/ls $VIRTUALENVS_DIR ${*} 2>/dev/null) 3 | } 4 | 5 | # vim: ft=zsh 6 | -------------------------------------------------------------------------------- /plugins/virtualenv/func/ve-newenv: -------------------------------------------------------------------------------- 1 | ve-newenv() { 2 | if [ $1 ]; then 3 | local venv=$VIRTUALENVS_DIR/$1 4 | virtualenv `echo ${VIRTUALENV_OPTS[@]}` $venv 5 | # default postactivate script 6 | echo `cat << EOF 7 | if [ -d $venv/$1 ]; then \n 8 | cd $venv/$1\n 9 | fi` > $venv/bin/postactivate 10 | else 11 | echo "What would you have me call your virtualenv then?" 12 | fi 13 | } 14 | 15 | # vim: ft=zsh 16 | -------------------------------------------------------------------------------- /plugins/virtualenv/plugin: -------------------------------------------------------------------------------- 1 | # virtualenv zshfu plugin 2 | fpath=( $plugin_dir/func $plugin_dir/comp $fpath ) 3 | autoload -U $plugin_dir/func/*(:t) $plugin_dir/comp/*(:t) 4 | 5 | compctl -K ve-list ve-activate 6 | 7 | # aliases 8 | alias act=ve-activate 9 | alias dact=ve-deactivate 10 | alias newenv=ve-newenv 11 | 12 | # virtualenv config 13 | export VIRTUALENVS_DIR=~/ve 14 | export VIRTUALENV_OPTS="--unzip-setuptools --distribute" 15 | 16 | # vim: ft=zsh 17 | -------------------------------------------------------------------------------- /plugins/yarn/install: -------------------------------------------------------------------------------- 1 | echo -n "I can't find zsh-yarn-completions would you like me to install it for you? (y/N) " && read ans 2 | 3 | if [[ "$ans" == "y" ]]; then 4 | git clone --depth 1 https://github.com/chrisands/zsh-yarn-completions.git $plugin_dir/lib 5 | echo "...installed $plugin" 6 | fi 7 | -------------------------------------------------------------------------------- /plugins/yarn/plugin: -------------------------------------------------------------------------------- 1 | ### yarn / zeesh! plugin 2 | 3 | if [ -d "$plugin_dir/lib" ]; then 4 | source $plugin_dir/lib/zsh-yarn-completions.plugin.zsh 5 | else 6 | source "$plugin_dir/install" 7 | fi 8 | 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /plugins/z/install: -------------------------------------------------------------------------------- 1 | echo -n "I can't find z.sh would you like me to install it for you? (y/N) " && read ans 2 | 3 | if [[ "$ans" == "y" ]]; then 4 | git clone --depth 1 git://github.com/rupa/z $plugin_dir/lib 5 | echo "...installed $plugin" 6 | fi 7 | -------------------------------------------------------------------------------- /plugins/z/plugin: -------------------------------------------------------------------------------- 1 | ### z / zeesh! plugin 2 | 3 | if [ -d "$plugin_dir/lib" ]; then 4 | # set opts 5 | export _Z_NO_RESOLVE_SYMLINKS=1 6 | export _Z_NO_PROMPT_COMMAND=1 7 | 8 | source $plugin_dir/lib/z.sh 9 | 10 | # zsh tab completion 11 | _z_zsh_tab_completion() { 12 | local compl 13 | read -l compl 14 | reply=(${(f)"$(_z --complete "$compl")"}) 15 | } 16 | compctl -U -K _z_zsh_tab_completion _z 17 | else 18 | source "$plugin_dir/install" 19 | fi 20 | 21 | # vim: ft=zsh 22 | -------------------------------------------------------------------------------- /scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # get first character of string, lowercase 4 | first_char() { 5 | echo $1 | cut -c 1 | tr '[A-Z]' '[a-z]' 6 | } 7 | 8 | # read user input 9 | ask() { 10 | question="$1" 11 | default="$2" 12 | 13 | echo "$question (yes/no default: $default) \c" 14 | 15 | read answer /dev/null`" != "" ]; then 38 | echo "rm ~/$name (broken link to `readlink $original`)" 39 | rm $original 40 | return 41 | fi 42 | 43 | if [ -e "$original" ]; then 44 | if [ -e "$backup" ]; then 45 | n=1 46 | while [ -e "$backup.$n" ]; do 47 | (( n ++ )) 48 | done 49 | backup="$backup.$n" 50 | fi 51 | 52 | echo "mv ~/$name $backup" 53 | mv "$original" "$backup" 54 | fi 55 | } 56 | 57 | install_zshrc() { 58 | backup $HOME/.zshrc 59 | 60 | platform=`uname | tr [A-Z] [a-z]` 61 | case $platform in 62 | darwin) 63 | platform='osx ' 64 | ;; 65 | freebsd) 66 | platform='freebsd' 67 | ;; 68 | linux) 69 | platform='linux ' 70 | ;; 71 | cygwin*) 72 | platform='cygwin ' 73 | ;; 74 | esac 75 | 76 | cat > $HOME/.zshrc << EOF 77 | zeesh_plugins=( 78 | autocomplete 79 | $platform 80 | git 81 | vcs-info 82 | syntax-highlighting 83 | history-substring-search 84 | theme 85 | vi-mode 86 | vi-visual-mode 87 | ) 88 | source ~/.zsh/zeesh.zsh 89 | EOF 90 | } 91 | 92 | git_clone() { 93 | git clone --depth 1 "$1" "$2" 2>&1 | grep 'Cloning into' 94 | } 95 | 96 | backup $HOME/.zsh 97 | git_clone https://github.com/zeekay/zeesh $HOME/.zsh 98 | 99 | if [ -z "$ELLIPSIS_INSTALL" ]; then 100 | ask "Create default zshrc?" "no" && install_zshrc 101 | fi 102 | 103 | cat << EOF 104 | Installation complete. 105 | __ 106 | __ / / 107 | ____ ____ ___ ____/ /_ / / 108 | /_ / / __/ __// __/ __ \ /_/ 109 | / /_/ __/ __/_\ \ / / /__ 110 | /___/___/___/____/_/ /_/__/ 111 | 112 | ...is now installed. 113 | EOF 114 | -------------------------------------------------------------------------------- /zeesh.zsh: -------------------------------------------------------------------------------- 1 | # zsh options 2 | setopt always_to_end \ 3 | auto_cd \ 4 | auto_name_dirs \ 5 | auto_param_slash \ 6 | cdablevarS \ 7 | complete_in_word \ 8 | correct \ 9 | extended_glob \ 10 | extended_history \ 11 | hist_beep \ 12 | hist_ignore_alldups \ 13 | hist_ignore_dups \ 14 | hist_ignore_space \ 15 | hist_no_store \ 16 | hist_reduce_blanks \ 17 | ignore_eof \ 18 | inc_append_history \ 19 | multios \ 20 | no_single_line_zle \ 21 | noflowcontrol \ 22 | pushd_ignore_dups \ 23 | pushd_silent \ 24 | pushd_to_home 25 | 26 | # history 27 | HISTFILE=~/.zsh/local/history 28 | HISTSIZE=10000 29 | SAVEHIST=10000 30 | 31 | # 100ms timeout for key sequences (defaults to 400ms) 32 | KEYTIMEOUT=50 33 | 34 | # exports 35 | export LANG=en_US.UTF-8 36 | export LC_CTYPE=en_US.UTF-8 37 | export RSYNC_RSH=ssh 38 | 39 | # aliases 40 | alias ag="ag -S --color-match='30;31' --color-line-number='31;35' --color-path='31;34'" 41 | alias clj='lein repl' 42 | alias cp='nocorrect cp' 43 | alias curl='noglob curl' 44 | alias diff='git diff --color=never --no-index' 45 | alias ff=ffind 46 | alias g=grep 47 | alias grep='grep -i --color=auto' 48 | alias l=ls 49 | alias md=take 50 | alias mv='nocorrect mv' 51 | alias nc='rlwrap nc' 52 | alias qmv=qmv-defaults 53 | alias rm='nocorrect rm' 54 | alias rmf='rm -rf' 55 | alias rscp='rsync --partial --progress --rsh=ssh' 56 | alias scp='scp -C' 57 | alias sl=ls 58 | alias speedtest='wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip' 59 | alias ssh-proxy='ssh -C2qTN -D 9999' 60 | alias tree='tree --dirsfirst -F' 61 | alias utc='date -u' 62 | alias zip='zip -r -9' 63 | 64 | # zeesh aliases 65 | alias help='zeesh help' 66 | alias plugin=zeesh-plugin 67 | alias prefs=zeesh-prefs 68 | alias tips='zeesh tips' 69 | alias vcs='zeesh-plugin-enable vcs-info' 70 | 71 | ## keybindings 72 | bindkey "^J" self-insert 73 | bindkey "\e[3~" delete-char 74 | bindkey '\e[1~' beginning-of-line 75 | bindkey '\e[4~' end-of-line 76 | bindkey '\e[H' beginning-of-line 77 | bindkey '\e[F' end-of-line 78 | bindkey '\e[7~' beginning-of-line 79 | bindkey '\e[8~' end-of-line 80 | bindkey '^[[5~' up-line-or-history 81 | bindkey '^[[6~' down-line-or-history 82 | bindkey '^[[A' history-search-backward 83 | bindkey '^[[B' history-search-forward 84 | bindkey ' ' magic-space 85 | bindkey '^[[Z' reverse-menu-complete 86 | bindkey '^R' history-incremental-search-backward 87 | bindkey -s '^L' "|$PAGER" 88 | bindkey '^Q' quote-line 89 | bindkey -s '^N' '> /dev/null 2>&1\n' 90 | zle -N fancy-ctrl-z 91 | bindkey '^Z' fancy-ctrl-z 92 | 93 | # default prompt 94 | PS1='%n@%m:%~ ' 95 | 96 | # load funcs 97 | fpath=( ~/.zsh/func $fpath ) 98 | autoload -U ~/.zsh/func/*(:t) 99 | 100 | # can't live without 101 | autoload -Uz url-quote-magic 102 | zle -N self-insert url-quote-magic 103 | 104 | # enable plugins 105 | zeesh-plugin-enable 106 | 107 | # source travis if it exists 108 | [ -f ~/.travis/travis.sh ] && source ~/.travis/travis.sh 109 | 110 | if [ -e ~/.zsh/after.zsh ]; then 111 | source ~/.zsh/after.zsh 112 | fi 113 | 114 | if [ -e ~/.zsh/local.zsh ]; then 115 | source ~/.zsh/local.zsh 116 | fi 117 | --------------------------------------------------------------------------------