Simplified option variables for greater flexibility.

main
Sorin Ionescu 13 years ago
parent 8619dd28bc
commit 05c94e2dd5

@ -2,7 +2,7 @@ setopt correct # Correct commands.
setopt correct_all # Correct all arguments. setopt correct_all # Correct all arguments.
# The 'ls' Family # The 'ls' Family
if ! check-bool "$DISABLE_COLOR"; then if check-bool "$COLOR"; then
if [[ -f "$HOME/.dir_colors" ]] && ( (( $+commands[dircolors] )) || ( (( $+plugins[(er)gnu-utils] )) && (( $+commands[gdircolors] )) ) ); then if [[ -f "$HOME/.dir_colors" ]] && ( (( $+commands[dircolors] )) || ( (( $+plugins[(er)gnu-utils] )) && (( $+commands[gdircolors] )) ) ); then
eval $("${commands[dircolors]:-$commands[gdircolors]}" "$HOME/.dir_colors") eval $("${commands[dircolors]:-$commands[gdircolors]}" "$HOME/.dir_colors")
alias ls='ls -hF --group-directories-first --color=auto' alias ls='ls -hF --group-directories-first --color=auto'
@ -80,7 +80,7 @@ else
fi fi
# Diff/Make # Diff/Make
if ! check-bool "$DISABLE_COLOR"; then if check-bool "$COLOR"; then
if (( $+commands[colordiff] )); then if (( $+commands[colordiff] )); then
alias diff='colordiff -u' alias diff='colordiff -u'
compdef colordiff=diff compdef colordiff=diff

@ -64,7 +64,7 @@ export VISUAL="vim"
export PAGER='less' export PAGER='less'
# Grep # Grep
if ! check-bool "$DISABLE_COLOR"; then if check-bool "$COLOR"; then
export GREP_COLOR='37;45' export GREP_COLOR='37;45'
export GREP_OPTIONS='--color=auto' export GREP_OPTIONS='--color=auto'
fi fi
@ -89,7 +89,7 @@ if (( $+commands[lesspipe.sh] )); then
fi fi
# Termcap # Termcap
if ! check-bool "$DISABLE_COLOR"; then if check-bool "$COLOR"; then
export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[01;31m' # begin bold export LESS_TERMCAP_md=$'\E[01;31m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode export LESS_TERMCAP_me=$'\E[0m' # end mode

@ -67,7 +67,7 @@ if [[ "$KEYMAP" == (emacs|) ]]; then
bindkey "${keys[Control]}x${keys[Control]}e" edit-command-line bindkey "${keys[Control]}x${keys[Control]}e" edit-command-line
# Expand .... to ../.. # Expand .... to ../..
if ! check-bool "$DISABLE_DOT_EXPANSION"; then if check-bool "$DOT_EXPANSION"; then
bindkey "." expand-dot-to-parent-directory-path bindkey "." expand-dot-to-parent-directory-path
fi fi
@ -132,7 +132,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then
bindkey -M vicmd "${keys[Control]}r" redo bindkey -M vicmd "${keys[Control]}r" redo
# Expand .... to ../.. # Expand .... to ../..
if ! check-bool "$DISABLE_DOT_EXPANSION"; then if check-bool "$DOT_EXPANSION"; then
bindkey -M viins "." expand-dot-to-parent-directory-path bindkey -M viins "." expand-dot-to-parent-directory-path
fi fi
@ -233,7 +233,7 @@ bindkey '^[[Z' reverse-menu-complete
bindkey "${keys[Control]}i" expand-or-complete-prefix bindkey "${keys[Control]}i" expand-or-complete-prefix
# Convert .... to ../.. automatically. # Convert .... to ../.. automatically.
if ! check-bool "$DISABLE_DOT_EXPANSION"; then if check-bool "$DOT_EXPANSION"; then
function expand-dot-to-parent-directory-path() { function expand-dot-to-parent-directory-path() {
if [[ $LBUFFER = *.. ]]; then if [[ $LBUFFER = *.. ]]; then
LBUFFER+=/.. LBUFFER+=/..
@ -247,7 +247,7 @@ if ! check-bool "$DISABLE_DOT_EXPANSION"; then
fi fi
# Display an indicator when completing. # Display an indicator when completing.
if ! check-bool "$DISABLE_COMPLETION_INDICATOR"; then if check-bool "$COMPLETION_INDICATOR"; then
function expand-or-complete-prefix-with-indicator() { function expand-or-complete-prefix-with-indicator() {
echo -n "\e[31m...\e[0m" echo -n "\e[31m...\e[0m"
zle expand-or-complete-prefix zle expand-or-complete-prefix

@ -69,7 +69,7 @@ autoload -Uz add-zsh-hook
# Sets the tab and window titles before the prompt is displayed. # Sets the tab and window titles before the prompt is displayed.
function set-title-precmd { function set-title-precmd {
if ! check-bool "$DISABLE_AUTO_TITLE"; then if check-bool "$AUTO_TITLE"; then
set-window-title "${(%):-%~}" set-window-title "${(%):-%~}"
for kind in tab screen; do for kind in tab screen; do
# Left-truncate the current working directory to 15 characters. # Left-truncate the current working directory to 15 characters.
@ -81,7 +81,7 @@ add-zsh-hook precmd set-title-precmd
# Sets the tab and window titles before command execution. # Sets the tab and window titles before command execution.
function set-title-preexec { function set-title-preexec {
if ! check-bool "$DISABLE_AUTO_TITLE"; then if check-bool "$AUTO_TITLE"; then
set-title-by-command "$2" set-title-by-command "$2"
fi fi
} }

@ -2,7 +2,7 @@
# Disable color in dumb terminals. # Disable color in dumb terminals.
if [[ "$TERM" == 'dumb' ]]; then if [[ "$TERM" == 'dumb' ]]; then
DISABLE_COLOR='true' COLOR='false'
fi fi
# Add functions to fpath. # Add functions to fpath.

@ -2,11 +2,11 @@
source "${0:r:r}.zsh" source "${0:r:r}.zsh"
if test "$CASE_SENSITIVE" = true; then if check-bool "$CASE_SENSITIVE"; then
unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS
fi fi
if test "$DISABLE_COLOR" = true; then if ! check-bool "$COLOR"; then
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND
unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND
fi fi

@ -11,7 +11,7 @@ alias sn="screen -U -S"
alias sr="screen -a -A -U -D -R" alias sr="screen -a -A -U -D -R"
# Auto # Auto
if (( $SHLVL == 1 )) && ! check-bool "$DISABLE_AUTO_SCREEN"; then if (( $SHLVL == 1 )) && check-bool "$AUTO_SCREEN"; then
(( SHLVL += 1 )) && export SHLVL (( SHLVL += 1 )) && export SHLVL
session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)" session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)"
if [[ -n "$session" ]]; then if [[ -n "$session" ]]; then

@ -40,7 +40,7 @@ function _ssh-agent-start() {
# Test if agent-forwarding is enabled. # Test if agent-forwarding is enabled.
zstyle -b :omz:plugins:ssh-agent agent-forwarding _ssh_agent_forwarding zstyle -b :omz:plugins:ssh-agent agent-forwarding _ssh_agent_forwarding
if [[ "${_ssh_agent_forwarding}" == "yes" && -n "$SSH_AUTH_SOCK" ]]; then if check-bool "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then
# Add a nifty symlink for screen/tmux if agent forwarding. # Add a nifty symlink for screen/tmux if agent forwarding.
[[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen [[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
elif [ -f "${_ssh_agent_env}" ]; then elif [ -f "${_ssh_agent_env}" ]; then

@ -10,7 +10,7 @@ alias ta="tmux attach-session"
alias tl="tmux list-sessions" alias tl="tmux list-sessions"
# Auto # Auto
if (( $SHLVL == 1 )) && ! check-bool "$DISABLE_AUTO_TMUX"; then if (( $SHLVL == 1 )) && check-bool "$AUTO_TMUX"; then
(( SHLVL += 1 )) && export SHLVL (( SHLVL += 1 )) && export SHLVL
session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)" session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)"
if [[ -n "$session" ]]; then if [[ -n "$session" ]]; then

@ -4,20 +4,20 @@ OMZ="$HOME/.oh-my-zsh"
# Set the key mapping style to 'emacs' or 'vi'. # Set the key mapping style to 'emacs' or 'vi'.
KEYMAP='emacs' KEYMAP='emacs'
# Set to 'true' to enable case-sensitivity. # Set case-sensitivity for completion, history lookup, etc.
CASE_SENSITIVE='false' CASE_SENSITIVE='false'
# Set to 'true' to disable color (auto set on dumb terminals). # Color output (auto set to 'false' on dumb terminals).
DISABLE_COLOR='false' COLOR='true'
# Set to 'true' to disable auto setting the tab and window titles. # Auto set the tab and window titles.
DISABLE_AUTO_TITLE='false' AUTO_TITLE='true'
# Set to 'false' to enable converting .... to ../.. automatically. # Auto convert .... to ../..
DISABLE_DOT_EXPANSION='true' DOT_EXPANSION='false'
# Set to 'false' to enable the completion indicator. # Indicate that completions are being generated.
DISABLE_COMPLETION_INDICATOR='true' COMPLETION_INDICATOR='false'
# Set the plugins to load (see $OMZ/plugins/). # Set the plugins to load (see $OMZ/plugins/).
# Example: plugins=(git lighthouse rails ruby textmate) # Example: plugins=(git lighthouse rails ruby textmate)

Loading…
Cancel
Save