|
@@ -15,9 +15,9 @@ fi
|
|
|
# Homebrew
|
|
|
if [ "$OS" = "Darwin" ]; then
|
|
|
export PATH="$PATH:$HOME/homebrew/bin"
|
|
|
- BREW_BIN=$(which brew)
|
|
|
- BREW_PREFIX=$(which brew &>/dev/null && brew --prefix || echo "")
|
|
|
+ BREW_BIN=$(command -v brew 2>/dev/null)
|
|
|
if [ "$BREW_BIN" ]; then
|
|
|
+ BREW_PREFIX=$(brew --prefix)
|
|
|
export HOMEBREW_CASK_OPTS="--appdir=$HOME/Applications --require-sha"
|
|
|
export HOMEBREW_NO_INSECURE_REDIRECT=1
|
|
|
fi
|
|
@@ -55,48 +55,98 @@ export LESS="-FRX"
|
|
|
|
|
|
# tweak history behavior a bit
|
|
|
HISTSIZE=50000
|
|
|
-HISTFILESIZE=500000
|
|
|
-HISTCONTROL="ignoreboth"
|
|
|
-shopt -s histappend
|
|
|
+if [ ! "$ZSH_VERSION" ]; then
|
|
|
+ HISTFILESIZE=500000
|
|
|
+ HISTCONTROL="ignoreboth"
|
|
|
+ shopt -s histappend
|
|
|
+ PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
|
|
|
+else
|
|
|
+ SAVEHIST=500000
|
|
|
+ # https://www.refining-linux.org/archives/49-ZSH-Gem-15-Shared-history.html
|
|
|
+ setopt inc_append_history
|
|
|
+ setopt share_history
|
|
|
+
|
|
|
+fi
|
|
|
|
|
|
# check window size after each command
|
|
|
-shopt -s checkwinsize
|
|
|
+if [ ! "$ZSH_VERSION" ]; then
|
|
|
+ shopt -s checkwinsize
|
|
|
+fi
|
|
|
|
|
|
# Custom shell aliases
|
|
|
if [ "$OS" = "Darwin" ]; then
|
|
|
- export CLICOLOR="1"
|
|
|
+ export CLICOLOR=1
|
|
|
else
|
|
|
alias ls="ls --color=auto"
|
|
|
fi
|
|
|
+alias la="ls -Fa"
|
|
|
+alias ll="ls -Fla"
|
|
|
+alias l="ls -FC"
|
|
|
alias d="l"
|
|
|
-alias l="ls -CF"
|
|
|
-alias la="ls -A"
|
|
|
-alias ll="ls -alF"
|
|
|
alias tree="tree -CF"
|
|
|
-alias grep="grep --color --exclude-dir=.svn --exclude-dir=.git --exclude-dir=node_modules"
|
|
|
+alias grep="grep --color --exclude-dir={.svn,.git,node_modules}"
|
|
|
|
|
|
# color diffs
|
|
|
-! which colordiff &>/dev/null || alias diff="colordiff"
|
|
|
+! command -v colordiff &>/dev/null || alias diff="colordiff"
|
|
|
|
|
|
# color json
|
|
|
-! which json &>/dev/null || alias json="json -o inspect"
|
|
|
+! command -v json &>/dev/null || alias json="json -o inspect"
|
|
|
|
|
|
# MacVim shell aliases
|
|
|
if [ "$OS" = "Darwin" ]; then
|
|
|
alias gvim="mvim"
|
|
|
fi
|
|
|
|
|
|
-# bash completion FTW
|
|
|
+# tab completion FTW
|
|
|
if [ "$OS" = "Darwin" ]; then
|
|
|
- F="$BREW_PREFIX/etc/bash_completion"; ! [ -f "$F" ] || . "$F"
|
|
|
- F="$(xcode-select -p)/usr/share/git-core/git-completion.bash"; ! [ -f "$F" ] || . "$F"
|
|
|
+ F="$BREW_PREFIX/etc/bash_completion"; ! [ -f "$F" ] || source "$F"
|
|
|
+ #F="$(xcode-select -p)/usr/share/git-core/git-completion.$SHELL_NAME"; ! [ -f "$F" ] || source "$F"
|
|
|
else
|
|
|
- F="/etc/bash_completion"; ! [ -f "$F" ] || . "$F"
|
|
|
+ F="/etc/bash_completion"; ! [ -f "$F" ] || source "$F"
|
|
|
fi
|
|
|
|
|
|
-# Liquid Prompt
|
|
|
-F="$HOME/.liquidprompt/liquidprompt"; ! [ -f "$F" ] || . "$F"
|
|
|
+# fancy shell prompts
|
|
|
+if [ "$ZSH_VERSION" ]; then
|
|
|
+
|
|
|
+ ANTIGEN_BIN="$HOME/.antigen.zsh"
|
|
|
+ [ -f "$ANTIGEN_BIN" ] || curl -L git.io/antigen > "$ANTIGEN_BIN"
|
|
|
+ source "$ANTIGEN_BIN"
|
|
|
+
|
|
|
+ BUNDLES=(
|
|
|
+ zsh-users/zsh-syntax-highlighting
|
|
|
+ mafredri/zsh-async
|
|
|
+ sindresorhus/pure
|
|
|
+ ael-code/zsh-colored-man-pages
|
|
|
+ )
|
|
|
+ for B in ${=BUNDLES}; do
|
|
|
+ antigen bundle "$B"
|
|
|
+ done
|
|
|
+ antigen apply
|
|
|
+
|
|
|
+ # use emacs-style for most defaults
|
|
|
+ bindkey -e
|
|
|
+
|
|
|
+ # jump more like bash did
|
|
|
+ bindkey "^[f" vi-forward-word
|
|
|
+ bindkey "^[b" vi-backward-word
|
|
|
+
|
|
|
+ # editor
|
|
|
+ autoload -z edit-command-line
|
|
|
+ zle -N edit-command-line
|
|
|
+ bindkey "^X^E" edit-command-line
|
|
|
+
|
|
|
+ # enable completion menu
|
|
|
+ zstyle ':completion:*' menu select
|
|
|
+
|
|
|
+ # allow trailing slashes on ".."
|
|
|
+ zstyle ':completion:*' special-dirs true
|
|
|
+
|
|
|
+ # ensure proper ls-style colors in completion
|
|
|
+ zstyle ':completion:*' list-colors 'di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
|
|
|
+else
|
|
|
+ F="$HOME/.liquidprompt/liquidprompt"; ! [ -f "$F" ] || source "$F"
|
|
|
+fi
|
|
|
|
|
|
# gimme gimme
|
|
|
[ -d "$HOME/.gimme" ] || curl -fsSL "https://github.com/KylePDavis/gimme/raw/master/gimme" | bash -
|
|
|
-F="$HOME/.gimme/gimme"; ! [ -f "$F" ] || . "$F"
|
|
|
+F="$HOME/.gimme/gimme"; ! [ -f "$F" ] || source "$F"
|