Skip to content

Commit

Permalink
Make zsh load less when not interactive
Browse files Browse the repository at this point in the history
  • Loading branch information
cehoffman committed Aug 9, 2010
1 parent cbb2f53 commit 9cafa32
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 52 deletions.
6 changes: 0 additions & 6 deletions zsh/aliases
Expand Up @@ -20,12 +20,6 @@ if [[ -f /Library/Application\ Support/VMware\ Fusion/vmrun ]]; then
}
fi

if [[ ! $TERM =~ ^screen ]]; then
alias screen="screen -dRaA"
else
export TERM="screen-256color"
fi

# Create a tmux session if there isn't one to attach to
alias tmux="tmux attach-session"

33 changes: 33 additions & 0 deletions zsh/bindings
@@ -0,0 +1,33 @@
# Use vi keybindings to edit command line
bindkey -v

# Make backspace work
bindkey '^?' backward-delete-char
bindkey '^H' backward-delete-char

# Make sure that C-a and C-e do the appropriate things
# Discovered this when using zsh inside a tmux that was inside
# another tmux. It would just print ^A or ^E instead of doing
# the action
bindkey '^A' beginning-of-line
bindkey '^E' end-of-line

# Look in history for a line that matches the current up
# to where the cursor currently is, uses up/down arrow keys
bindkey '^[[A' history-beginning-search-backward
bindkey '^[[B' history-beginning-search-forward

# Search in history for a command that begins with the first
# word of the current line, uses up/down arrow keys
# bindkey '^[[A' up-line-or-search
# bindkey '^[[B' down-line-or-search

# Expansion of history
bindkey ' ' magic-space # also do history expansion on space

# Better movement on the line
# bindkey '^b' backward-word
# bindkey '^f' forward-word
# bindkey '^d' delete-word
# bindkey '^u' kill-whole-line

33 changes: 0 additions & 33 deletions zsh/completion
@@ -1,39 +1,6 @@
autoload -U compinit
compinit -i

# Use vi keybindings to edit command line
bindkey -v

# Make backspace work
bindkey '^?' backward-delete-char
bindkey '^H' backward-delete-char

# Make sure that C-a and C-e do the appropriate things
# Discovered this when using zsh inside a tmux that was inside
# another tmux. It would just print ^A or ^E instead of doing
# the action
bindkey '^A' beginning-of-line
bindkey '^E' end-of-line

# Look in history for a line that matches the current up
# to where the cursor currently is, uses up/down arrow keys
bindkey '^[[A' history-beginning-search-backward
bindkey '^[[B' history-beginning-search-forward

# Search in history for a command that begins with the first
# word of the current line, uses up/down arrow keys
# bindkey '^[[A' up-line-or-search
# bindkey '^[[B' down-line-or-search

# Expansion of history
bindkey ' ' magic-space # also do history expansion on space

# Better movement on the line
# bindkey '^b' backward-word
# bindkey '^f' forward-word
# bindkey '^d' delete-word
# bindkey '^u' kill-whole-line

zmodload -i zsh/complist

# matches case insensitive for lowercase
Expand Down
21 changes: 17 additions & 4 deletions zsh/config
Expand Up @@ -10,11 +10,13 @@ typeset -ga chpwd_functions
autoload -U ~/.zsh/functions/*(:t)

## smart urls
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
if [[ -o interactive ]]; then
autoload -U url-quote-magic
zle -N self-insert url-quote-magic

# Colorize me
autoload colors; colors;
# Colorize me
autoload colors; colors;
fi

HISTFILE=~/.zsh_history
HISTSIZE=10000
Expand All @@ -28,6 +30,7 @@ setopt LOCAL_OPTIONS # allow functions to have local options
setopt LOCAL_TRAPS # allow functions to have local traps
setopt CORRECT
setopt COMPLETE_IN_WORD
setopt CORRECT_ALL
setopt COMPLETE_ALIASES # Treat aliases as unique entities viable for completion
setopt LIST_ROWS_FIRST # Order completion by row instead of column
setopt IGNORE_EOF
Expand Down Expand Up @@ -71,6 +74,10 @@ export LC_ALL='en_US.UTF-8'
export LANG='en_US.UTF-8'
export LC_CTYPE='en_US.UTF-8'

## grep
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;32'

export EDITOR='vim'

# Load all of your custom configurations from custom/
Expand All @@ -81,5 +88,11 @@ if [[ $(uname) =~ Darwin ]]; then
export __CF_USER_TEXT_ENCODING="$(printf '0x%X' $(id -u)):0x08000100:0"
fi

if [[ ! $TERM =~ ^screen ]]; then
alias screen="screen -dRaA"
else
export TERM="screen-256color"
fi

# Remove duplicates in paths
typeset -gU path cdpath manpath fpath
4 changes: 1 addition & 3 deletions zsh/corrections
@@ -1,8 +1,6 @@
setopt correct_all

alias man='nocorrect man'
alias mv='nocorrect mv'
alias mkdir='nocorrect mkdir -p'

## SPROMPT - the spelling prompt
SPROMPT='zsh: correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) '
SPROMPT='zsh: correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) '
2 changes: 0 additions & 2 deletions zsh/envs/brew
Expand Up @@ -3,8 +3,6 @@ if [[ -a ~/.homebrew/bin/brew ]]; then
path=($(brew --prefix)/sbin $path)
manpath=($(brew --prefix)/share/man $manpath)

hash -d homebrew=$(brew --prefix)

# Homebrew Python setup
path=($(python -c "from sys import prefix; print prefix")/bin $path)
fi
2 changes: 0 additions & 2 deletions zsh/envs/grep

This file was deleted.

File renamed without changes.
9 changes: 7 additions & 2 deletions zshrc
@@ -1,7 +1,12 @@
. ~/.zsh/config
. ~/.zsh/aliases
. ~/.zsh/completion
. ~/.zsh/corrections

if [[ -o interactive ]]; then
. ~/.zsh/completion
. ~/.zsh/corrections
. ~/.zsh/bindings
. ~/.zsh/prompt
fi

# use .localrc for settings specific to one system
[[ -f ~/.localrc ]] && . ~/.localrc
Expand Down

0 comments on commit 9cafa32

Please sign in to comment.