diff --git a/zprofile b/zprofile index c03ee3d4..86554df3 100644 --- a/zprofile +++ b/zprofile @@ -1,7 +1,5 @@ # Executes commands at login pre-zshrc. -autoload -Uz command_exists - # Browser [[ "$OSTYPE" == darwin* ]] && export BROWSER='open' @@ -22,7 +20,6 @@ typeset -gU cdpath fpath mailpath path # Set the list of directories that Zsh searches for programs. path=( - $HOME/.{py,rb}env/shims $HOME/.{py,rb}env/bin $HOME/.dotfiles/bin /usr/local/{bin,sbin} @@ -54,18 +51,3 @@ fi TMPPREFIX="${TMPDIR%/}/zsh" [[ ! -d "$TMPPREFIX" ]] && mkdir -p "$TMPPREFIX" - -# Init extra niceties -command_exists "rbenv" && eval "$(rbenv init - --no-rehash)" -if command_exists "pyenv"; then - eval "$(pyenv init -)" - eval "$(pyenv virtualenv-init -)" -fi -if command_exists "go"; then - export GOPATH="$HOME/Dropbox/Projects/dev/go" - export PATH="$GOPATH/bin:$PATH" -fi - -if [ -n "$EMACS" ]; then - source ~/.zsh/aliases -fi diff --git a/zsh/aliases b/zsh/aliases index 021ed74e..ae160ac2 100644 --- a/zsh/aliases +++ b/zsh/aliases @@ -1,75 +1,14 @@ #!/bin/zsh +# ZSH-specific aliases. Find the rest in ~/.bash/aliases + +source ~/.bash/aliases # GIT -if command_exists 'git'; then - alias gi='git init' - alias ga='git add' - alias gap='git add --patch' - alias gt='git tag' - alias gtl='git describe --tags --abbrev=0' - - git-move-root() { - git filter-branch --subdirectory-filter "$@" --prune-empty -- --all - } - - git-undo-commit() { - git reset --soft "HEAD^" - } -fi - -# Tmux -if command_exists 'tmux'; then - alias t='tmux new -s x || tmux attach -t x' - alias tl='tmux list-sessions' - alias ts='tmux switch' - - function tmux-send { - tmux send-keys -s "x" $1 Enter - } -fi - -# OS-specific aliases -if [[ "$OSTYPE" == darwin* ]]; then - alias codekit='open -a CodeKit' - alias b='brew' - alias v='vim' - alias e="emacsclient -n" # Emacs server must be running! -else - alias ipt='sudo iptables' -fi - -# transmission-remote -if command_exists 'transmission-remote'; then - alias bt="transmission-remote server" - alias btl="bt -l" - alias bta="bt --add" - - btr() { bt -t$1 -r } - bts() { bt -t$1 -S } -fi - -alias va='vagrant' -alias r='noglob rake -g' - -# Interpreters -alias rbe='rbenv' -alias rb='ruby' -alias pye='pyenv' -alias py='python' -alias be='bundle exec' -[ -e /Applications/love.app ] && alias love="/Applications/love.app/Contents/MacOS/love" - -# Shell conveniences -alias wget='wget -c' # Resume download if possible - -alias ls=' ls -G' # Hide from history +alias ag='nocorrect noglob ag' +alias rk='noglob rake' +alias rkg='noglob rake -g' +alias rename='noglob rename' zman() { PAGER="less -g -s '+/^ "$1"'" man zshall } - -# Make a directory and change to it -function mkd { mkdir "$@" && cd "$@" } - -alias q='exit' -alias clr='clear' diff --git a/zsh/config b/zsh/config index 73f0bf7f..7dc80b13 100644 --- a/zsh/config +++ b/zsh/config @@ -1,3 +1,5 @@ +export GIT_MERGE_AUTOEDIT=no + # Disable autocorrect behavior, very annoying! # unsetopt correct_all diff --git a/zsh/functions/command_exists b/zsh/functions/command_exists deleted file mode 100644 index 17ef379c..00000000 --- a/zsh/functions/command_exists +++ /dev/null @@ -1,2 +0,0 @@ -# Detect if a command exists -command -v "$1" &> /dev/null diff --git a/zsh/preztorc b/zsh/preztorc index 19294a68..450fae27 100644 --- a/zsh/preztorc +++ b/zsh/preztorc @@ -18,21 +18,30 @@ zstyle ':prezto:*:*' color 'yes' # Set the Prezto modules to load (browse modules). # The order matters. -zstyle ':prezto:load' pmodule \ - 'environment' \ - 'terminal' \ - 'editor' \ - 'opp' \ - 'history' \ - 'history-substring-search' \ - 'directory' \ - 'spectrum' \ - 'utility' \ - 'completion' \ - 'prompt' \ - 'git' \ - 'syntax-highlighting' \ - 'osx' +if [[ -z "$EMACS" ]]; then + zstyle ':prezto:load' pmodule \ + 'environment' \ + 'terminal' \ + 'editor' \ + 'opp' \ + 'history' \ + 'history-substring-search' \ + 'directory' \ + 'spectrum' \ + 'utility' \ + 'completion' \ + 'prompt' \ + 'syntax-highlighting' \ + 'osx' +else + zstyle ':prezto:load' pmodule \ + 'environment' \ + 'history' \ + 'directory' \ + 'spectrum' \ + 'utility' \ + 'osx' +fi # Editor diff --git a/zshenv b/zshenv index c23f284c..c14c0acf 100644 --- a/zshenv +++ b/zshenv @@ -2,3 +2,7 @@ if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then source "${ZDOTDIR:-$HOME}/.zprofile" fi + +if [[ -n "$EMACS" ]]; then + source "${ZDOTDIR:-$HOME}/.zshrc" +fi diff --git a/zshrc b/zshrc index 5db676af..d536209b 100644 --- a/zshrc +++ b/zshrc @@ -5,8 +5,23 @@ if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then fi # Source component rcfiles -source ~/.zsh/config +if [[ -z "$EMACS" ]]; then + source ~/.zsh/config + is-callable 'fasd' && eval "$(fasd --init auto)" +fi + source ~/.zsh/aliases # Init extra niceties -command_exists "fasd" && eval "$(fasd --init auto)" +is-callable 'rbenv' && eval "$(rbenv init - --no-rehash)" +if is-callable 'pyenv'; then + eval "$(pyenv init - --no-rehash)" + eval "$(pyenv virtualenv-init -)" +fi +if is-callable 'go'; then + export GOPATH="$HOME/Dropbox/Projects/dev/go" + export PATH="$GOPATH/bin:$PATH" +fi + +# Restore git completion with g() +compdef g=git