Initial commit, modular zsh config easy to extend with extra behaviours

This commit is contained in:
Danielle McLean 2016-10-02 18:17:25 +11:00
commit df6164e3aa
No known key found for this signature in database
GPG key ID: CC91589719027E94
22 changed files with 154 additions and 0 deletions

1
home/.zprofile Normal file
View file

@ -0,0 +1 @@
for f in ~/.zsh/login/*; source $f

6
home/.zsh/all/functions Normal file
View file

@ -0,0 +1,6 @@
#! zsh
# autoloaded functions must be declared in every kind of zsh: they aren't
# inherited in the environment so non-login shells need them, and you'll want
# to call one in a script so non-interactive shells need them.
autoload composer enphp unphp
autoload -Uz zargs zmv

View file

@ -0,0 +1,5 @@
#! zsh
# Composer runs significantly faster if xdebug is unloaded.
local conf="$(php -r 'echo dirname(php_ini_loaded_file());')"
(cd $conf; rsync -ar --delete-after --exclude ext-xdebug.ini conf.d/ conf-without-xdebug.d/)
PHP_INI_SCAN_DIR=$conf/conf-without-xdebug.d php =composer "$@"

View file

@ -0,0 +1,2 @@
#! zsh
cat $argv | php -r 'echo serialize( json_decode( file_get_contents( "php://stdin" ) ) );'

View file

@ -0,0 +1,2 @@
#! zsh
cat $argv | php -r 'echo json_encode( unserialize( file_get_contents( "php://stdin" ) ) );'

View file

@ -0,0 +1,2 @@
#! zsh
fortune ~/.quotes/quotes | ponysay

View file

@ -0,0 +1,26 @@
#! zsh
if [[ ! -f ~/.zplug/repos/zplug/zplug/init.zsh ]]; then
git clone https://github.com/zplug/zplug ~/.zplug/repos/zplug/zplug
fi
source ~/.zplug/repos/zplug/zplug/init.zsh
zplug zplug/zplug
zplug willghatch/zsh-saneopt
zplug bobthecow/git-flow-completion
zplug mafredri/zsh-async
zplug micha/resty
zplug rupa/z, use:z.sh
zplug sharat87/zsh-vim-mode
zplug sindresorhus/pure
zplug supercrabtree/k
zplug zsh-users/zsh-syntax-highlighting, nice:10
zplug zsh-users/zsh-completions, nice:11
zplug zsh-users/zsh-history-substring-search, nice:9
zplug trapd00r/LS_COLORS, hook-load:apply-trapd00r-colors
apply-trapd00r-colors() {
eval $(dircolors -b $ZPLUG_REPOS/trapd00r/LS_COLORS/LS_COLORS)
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
}
zplug check || zplug install
zplug load

View file

@ -0,0 +1,17 @@
#! zsh
alias has_command='whence >/dev/null'
alias ls="ls -F --color=auto"
alias lsl="ls -lh"
alias grep="grep --color=auto"
alias egrep="egrep --color=auto"
alias pseudo="sudo"
if has_command xdg-open; then
alias ]='xdg-open'
else
alias ]='open'
fi
# make sure ELinks can detect when it's in tmux
alias elinks="STY= elinks"
has_command hub && alias git=hub

View file

@ -0,0 +1,12 @@
#! zsh
bindkey $terminfo[kcbt] reverse-menu-complete
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
autoload -Uz url-quote-magic
url-quote-magic-with-highlight() {
url-quote-magic
_zsh_highlight
}
zle -N self-insert url-quote-magic-with-highlight

View file

@ -0,0 +1,3 @@
#! zsh
export FZF_CTRL_R_OPTS="--sort"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

View file

@ -0,0 +1,4 @@
#! zsh
export HISTFILE=~/.zsh/zhistory
export HISTSIZE=50000
export SAVEHIST=$HISTSIZE

View file

@ -0,0 +1 @@
../../../../../../.zsh/../.homesick/repos/homeshick/homeshick.sh

View file

@ -0,0 +1 @@
../../../../../../.zsh/../.iterm2_shell_integration.zsh

View file

@ -0,0 +1,5 @@
#! zsh
setopt correct
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' menu select=2

2
home/.zsh/login/editor Normal file
View file

@ -0,0 +1,2 @@
#! zsh
export EDITOR==vim

5
home/.zsh/login/fpath Normal file
View file

@ -0,0 +1,5 @@
#! zsh
fpath=(~/.zsh/functions ~/.homesick/repos/homeshick/completions $fpath)
# filter out duplicates, nonexistent directories, and . (the current directory)
fpath=(${(u)^fpath:#.}(N))

View file

@ -0,0 +1,3 @@
#! zsh
path+=(~/.homesick/repos/homeshick/bin)
fpath+=(~/.homesick/repos/homeshick/completions)

34
home/.zsh/login/langs Normal file
View file

@ -0,0 +1,34 @@
#! zsh
local newbins=()
# go
[[ -z $GOPATH ]] && export GOPATH=~/.go
newbins+=(~/.go/bin)
# haskell
newbins+=(~/.cabal/bin ~/Library/Haskell/bin)
# ooc
if whence rock >/dev/null; then
export OOC_LIBS=/usr/local/Cellar/rock/0.9.10:~/.ooc
newbins+=(~/.ooc/sam)
fi
# ruby
newbins+=(~/.gem/ruby/*/bin)
# perl
export PERL_LOCAL_LIB_ROOT="$HOME/perl5:$PERL_LOCAL_LIB_ROOT"
export PERL_MB_OPT="--install_base '$HOME/perl5'";
export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5";
export PERL5LIB="$HOME/perl5/lib/perl5:$HOME/.perllibs:$PERL5LIB";
newbins+=(~/perl5/bin)
# php
newbins+=(~/.composer/vendor/bin)
# python
export -UT PYTHONPATH pythonpath
path=($newbins $path)

17
home/.zsh/login/path Normal file
View file

@ -0,0 +1,17 @@
#! zsh
path=(/usr/local/bin $path)
if whence brew >/dev/null; then
path=(
/usr/local/opt/coreutils/libexec/gnubin
/usr/local/sbin
~/Library/Python/*/bin
$path
)
fi
path=(/usr/local/texlive/20*/bin/universal-* $path)
path=(~/bin ~/.bin ~/.local/bin $path)
# filter out duplicates, nonexistent directories, and . (the current directory)
path=(${(u)^path:#.}(N))

3
home/.zsh/login/skip Normal file
View file

@ -0,0 +1,3 @@
#! zsh
skip_global_compinit=1
skip_path_helper=1

1
home/.zshenv Normal file
View file

@ -0,0 +1 @@
for f in ~/.zsh/all/*; source $f

2
home/.zshrc Normal file
View file

@ -0,0 +1,2 @@
for f in ~/.zsh/interactive/*; source $f
[[ -o login ]] && for f in ~/.zsh/interactive+login/*; source $f