This commit is contained in:
Andrew Schwartzmeyer 2017-05-02 02:20:23 +00:00 committed by GitHub
commit 9fd0e0bb16
7 changed files with 203 additions and 9 deletions

View file

@ -5,9 +5,19 @@
#
# Debian-related zsh aliases and functions for zsh
# Function to check if a command exists
exists() {
if command -v $1 >/dev/null 2>&1
then
return 0
else
return 1
fi
}
# Use aptitude if installed, or apt-get if not.
# You can just set apt_pref='apt-get' to override it.
if [[ -e $( which -p aptitude 2>&1 ) ]]; then
if exists aptitude; then
apt_pref='aptitude'
apt_upgr='safe-upgrade'
else
@ -16,7 +26,7 @@ else
fi
# Use sudo by default if it's installed
if [[ -e $( which -p sudo 2>&1 ) ]]; then
if exists sudo; then
use_sudo=1
fi

View file

@ -0,0 +1,4 @@
if type fortune &> /dev/null; then
fortune
echo
fi

View file

@ -0,0 +1,6 @@
if type dircolors &> /dev/null; then
eval `dircolors ~/.dir_colors`
fi
# Temporary workaround for tab completion LS_COLORS; Issue #1563
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}

View file

@ -34,7 +34,7 @@ if which tmux &> /dev/null
# The TERM to use for 256 color terminals.
# Tmux states this should be screen-256color, but you may need to change it on
# systems without the proper terminfo
[[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color"
[[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="xterm-256color"
# Get the absolute path to the current directory
@ -49,7 +49,7 @@ if which tmux &> /dev/null
fi
# Set the correct local config file to use.
if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]]
if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -e "$HOME/.tmux.conf" ]]
then
#use this when they have a ~/.tmux.conf
export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf"
@ -61,19 +61,37 @@ if which tmux &> /dev/null
# Wrapper function for tmux.
function _zsh_tmux_plugin_run()
{
if [[ "$ZSH_TMUX_ITERM2" == "true" ]]
then _fix='-CC'
else _fix=''
fi
if [[ "$ZSH_TMUX_FIXTERM" == "true" && "$ZSH_TMUX_ITERM2" == "false" ]]
then _file="-f $_ZSH_TMUX_FIXED_CONFIG"
else _file='' # Can't use -f with -CC
fi
if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]
then _exit='exit'
else _exit=''
fi
# We have other arguments, just run them
if [[ -n "$@" ]]
then
\tmux $@
tmux "$@"
# Try to connect to an existing session.
elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]]
then
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` attach || \tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
if (tmux has)
then
\tmux $_fix attach
$_exit
else
\tmux $_fix $_file new
$_exit
fi
# Just run tmux, fixing the TERM variable if requested.
else
\tmux `[[ "$ZSH_TMUX_ITERM2" == "true" ]] && echo '-CC '` `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG`
[[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit
\tmux $_fix $_file new
$_exit
fi
}