Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • rspencer/awit-zsh-superawesome
1 result
Show changes
Showing
with 165 additions and 653 deletions
#!/usr/bin/env zsh
zmodload zsh/datetime
function _current_epoch() {
echo $(( $EPOCHSECONDS / 60 / 60 / 24 ))
}
function _update_zsh_update() {
echo "LAST_EPOCH=$(_current_epoch)" >! ~/.zsh-update
}
function _upgrade_zsh() {
env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
# update the zsh file
_update_zsh_update
}
epoch_target=$UPDATE_ZSH_DAYS
if [[ -z "$epoch_target" ]]; then
# Default to old behavior
epoch_target=13
fi
# Cancel upgrade if the current user doesn't have write permissions for the
# oh-my-zsh directory.
[[ -w "$ZSH" ]] || return 0
# Cancel upgrade if git is unavailable on the system
whence git >/dev/null || return 0
if mkdir "$ZSH/log/update.lock" 2>/dev/null; then
if [ -f ~/.zsh-update ]; then
. ~/.zsh-update
if [[ -z "$LAST_EPOCH" ]]; then
_update_zsh_update && return 0;
fi
epoch_diff=$(($(_current_epoch) - $LAST_EPOCH))
if [ $epoch_diff -gt $epoch_target ]; then
if [ "$DISABLE_UPDATE_PROMPT" = "true" ]; then
_upgrade_zsh
else
echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c"
read line
if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then
_upgrade_zsh
else
_update_zsh_update
fi
fi
fi
else
# create the zsh file
_update_zsh_update
fi
rmdir $ZSH/log/update.lock
fi
main() {
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
BOLD="$(tput bold)"
NORMAL="$(tput sgr0)"
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
BOLD=""
NORMAL=""
fi
# Only enable exit-on-error after the non-critical colorization stuff,
# which may fail on systems lacking tput or terminfo
set -e
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
exit
fi
unset CHECK_ZSH_INSTALLED
if [ ! -n "$ZSH" ]; then
ZSH=~/.oh-my-zsh
fi
if [ -d "$ZSH" ]; then
printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n"
printf "You'll need to remove $ZSH if you want to re-install.\n"
exit
fi
# Prevent the cloned repository from having insecure permissions. Failing to do
# so causes compinit() calls to fail with "command not found: compdef" errors
# for users with insecure umasks (e.g., "002", allowing group writability). Note
# that this will be ignored under Cygwin by default, as Windows ACLs take
# precedence over umasks except for filesystems mounted with option "noacl".
umask g-w,o-w
printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
hash git >/dev/null 2>&1 || {
echo "Error: git is not installed"
exit 1
}
# The Windows (MSYS) Git is not compatible with normal use on cygwin
if [ "$OSTYPE" = cygwin ]; then
if git --version | grep msysgit > /dev/null; then
echo "Error: Windows/MSYS Git is not supported on Cygwin"
echo "Error: Make sure the Cygwin git package is installed and is first on the path"
exit 1
fi
fi
env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
printf "Error: git clone of oh-my-zsh repo failed\n"
exit 1
}
printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n";
mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
fi
printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
sed "/^export ZSH=/ c\\
export ZSH=$ZSH
" ~/.zshrc > ~/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc
# If this user's login shell is not already "zsh", attempt to switch.
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
# If this platform provides a "chsh" command (not Cygwin), do it, man!
if hash chsh >/dev/null 2>&1; then
printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
chsh -s $(grep /zsh$ /etc/shells | tail -1)
# Else, suggest the user do so manually.
else
printf "I can't change your shell automatically because this system does not have chsh.\n"
printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n"
fi
fi
printf "${GREEN}"
echo ' __ __ '
echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
echo ' /____/ ....is now installed!'
echo ''
echo ''
echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.'
echo ''
echo 'p.s. Follow us at https://twitter.com/ohmyzsh.'
echo ''
echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.'
echo ''
printf "${NORMAL}"
env zsh
}
main
__require_tool_version_compare ()
{
(
# Locally ignore failures, otherwise we'll exit whenever $1 and $2
# are not equal!
set +e
awk_strverscmp='
# Use only awk features that work with 7th edition Unix awk (1978).
# My, what an old awk you have, Mr. Solaris!
END {
while (length(v1) || length(v2)) {
# Set d1 to be the next thing to compare from v1, and likewise for d2.
# Normally this is a single character, but if v1 and v2 contain digits,
# compare them as integers and fractions as strverscmp does.
if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
# Split v1 and v2 into their leading digit string components d1 and d2,
# and advance v1 and v2 past the leading digit strings.
for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
if (d1 ~ /^0/) {
if (d2 ~ /^0/) {
# Compare two fractions.
while (d1 ~ /^0/ && d2 ~ /^0/) {
d1 = substr(d1, 2); len1--
d2 = substr(d2, 2); len2--
}
if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
# The two components differ in length, and the common prefix
# contains only leading zeros. Consider the longer to be less.
d1 = -len1
d2 = -len2
} else {
# Otherwise, compare as strings.
d1 = "x" d1
d2 = "x" d2
}
} else {
# A fraction is less than an integer.
exit 1
}
} else {
if (d2 ~ /^0/) {
# An integer is greater than a fraction.
exit 2
} else {
# Compare two integers.
d1 += 0
d2 += 0
}
}
} else {
# The normal case, without worrying about digits.
if (v1 == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = substr(v1,2) }
if (v2 == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = substr(v2,2) }
}
if (d1 < d2) exit 1
if (d1 > d2) exit 2
}
}
'
awk "$awk_strverscmp" v1="$1" v2="$2" /dev/null
case $? in
1) echo '<';;
0) echo '=';;
2) echo '>';;
esac
)
}
__require_tool_fatal ()
{
echo $@ >/dev/stderr
return 1
}
# Usage: require_tool program version
# Returns: 0 if $1 version if greater equals than $2, 1 otherwise.
# In case of error, message is written on error output.
#
# Example: require_tool gcc 4.6
# Use GCC environment variable if defined instead of lookup for the tool
# in the environment.
require_tool ()
{
envvar_name=$(echo $1 | tr '[:lower:]' '[:upper:]')
tool=$(printenv $envvar_name || echo $1)
local version=$($tool --version 2>/dev/null| \
sed -n 's/.*[^0-9.]\([0-9]*\.[0-9.]*\).*/\1/p;q')
if test x"$version" = x ; then
echo "$tool is required" >/dev/stderr
return 1
fi
case $(__require_tool_version_compare "$2" "$version") in
'>')
echo "$1 $2 or better is required: this is $tool $version" >/dev/stderr
return 1
;;
esac
}
usage() {
cat <<EOF
NAME
require_tool.sh - Ensure version of a tool is greater than the one expected
SYNOPSYS
require_tool.sh [ -h ]
[ --help ]
[ TOOL MIN_VERSION ]
DESCRIPTION
TOOL is the name or path of the program to check. If the name is specified, its
path is deduced from PATH environment variable. If environment variable TOOL
(in upper-case characters) is defined, considers its value as path to the tool.
MIN_VERSION is a string representing the minimum required version.
BEHAVIOR
* locate path to the program.
* execute $ TOOL_PATH --version
* extract version from standard output.
* compare this version to the expected one.
OPTIONS
-h --help
Display this message and exit 0
ERRORS
if program is not found or its version is prior to expected version,
a message is written to error output.
EXIT VALUE
returns 0 if program version if greater equals than expected version,
returns 1 otherwise.
EXAMPLE
$ require_tool.sh emacs 23
$ CC=g++ require_tool.sh cc 4.6
$ require_tool.sh zsh 4.5
EOF
}
for arg in $@; do
case $arg in
-h|--help)
usage
exit 0
;;
esac
done
if [ $# -gt 2 ] ; then
echo "ERROR: expecting 2 parameters. Please see option --help"
exit 1
fi
require_tool $@
#!/bin/zsh
# Zsh Theme Chooser by fox (fox91 at anche dot no)
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
THEMES_DIR="$ZSH/themes"
FAVLIST="${HOME}/.zsh_favlist"
source $ZSH/oh-my-zsh.sh
function noyes() {
read "a?$1 [y/N] "
if [[ $a == "N" || $a == "n" || $a = "" ]]; then
return 0
fi
return 1
}
function theme_preview() {
THEME=$1
THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//`
print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color"
source "$THEMES_DIR/$THEME"
cols=$(tput cols)
print -P "$PROMPT $RPROMPT"
}
function banner() {
echo
echo "╺━┓┏━┓╻ ╻ ╺┳╸╻ ╻┏━╸┏┳┓┏━╸ ┏━╸╻ ╻┏━┓┏━┓┏━┓┏━╸┏━┓"
echo "┏━┛┗━┓┣━┫ ┃ ┣━┫┣╸ ┃┃┃┣╸ ┃ ┣━┫┃ ┃┃ ┃┗━┓┣╸ ┣┳┛"
echo "┗━╸┗━┛╹ ╹ ╹ ╹ ╹┗━╸╹ ╹┗━╸ ┗━╸╹ ╹┗━┛┗━┛┗━┛┗━╸╹┗╸"
echo
}
function usage() {
echo "Usage: $0 [options] [theme]"
echo
echo "Options"
echo " -l List available themes"
echo " -s Show all themes"
echo " -h Get this help message"
exit 1
}
function list_themes() {
for THEME in $(ls $THEMES_DIR); do
THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//`
echo $THEME_NAME
done
}
function insert_favlist() {
if grep -q "$THEME_NAME" $FAVLIST 2> /dev/null ; then
echo "Already in favlist"
else
echo $THEME_NAME >> $FAVLIST
echo "Saved to favlist"
fi
}
function theme_chooser() {
for THEME in $(ls $THEMES_DIR); do
echo
theme_preview $THEME
echo
if [[ -z $1 ]]; then
noyes "Do you want to add it to your favourite list ($FAVLIST)?" || \
insert_favlist $THEME_NAME
echo
fi
done
}
while getopts ":lhs" Option
do
case $Option in
l ) list_themes ;;
s ) theme_chooser 0 ;;
h ) usage ;;
* ) usage ;; # Default.
esac
done
if [[ -z $Option ]]; then
if [[ -z $1 ]]; then
banner
echo
theme_chooser
else
theme_preview $1".zsh-theme"
fi
fi
read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
if [ "$confirmation" != y ] && [ "$confirmation" != Y ]; then
echo "Uninstall cancelled"
exit
fi
echo "Removing ~/.oh-my-zsh"
if [ -d ~/.oh-my-zsh ]; then
rm -rf ~/.oh-my-zsh
fi
echo "Looking for original zsh config..."
if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then
echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)";
echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
mv ~/.zshrc ~/"${ZSHRC_SAVE}";
fi
mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
echo "Your original zsh config was restored. Please restart your session."
else
if hash chsh >/dev/null 2>&1; then
echo "Switching back to bash"
chsh -s /bin/bash
else
echo "You can edit /etc/passwd to switch your default shell back to bash"
fi
fi
echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
BOLD="$(tput bold)"
NORMAL="$(tput sgr0)"
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
BOLD=""
NORMAL=""
fi
printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
cd "$ZSH"
if git pull --rebase --stat origin master
then
printf '%s' "$GREEN"
printf '%s\n' ' __ __ '
printf '%s\n' ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
printf '%s\n' ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
printf '%s\n' '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
printf '%s\n' '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
printf '%s\n' ' /____/ '
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: http://shop.planetargon.com/"
else
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
fi
# We need to enable extended globbing here for the below source inclusion
setopt EXTENDED_GLOB
# Set the directory where we're being loaded from
AZS_DIR="$0:h"
# Source in resources
for F in ~/.zsh/zshrc.d/([a-zA-Z0-9-]##).zsh; do
source $F
done
## Home bin path
# Source in local stuff
if [ -f ~/.zsh/zshrc.local ]
# Override first bin directory
if [ -d "$HOME/.local/bin" ]
then
source ~/.zsh/zshrc.local
if ! [[ "$PATH" =~ "$HOME/.local/bin" ]]
then
export PATH="$HOME/.local/bin:$PATH"
fi
else
# We should never need this, but just in case
mkdir -p "$HOME/.local/bin"
if ! [[ "$PATH" =~ "$HOME/.local/bin" ]]
then
export PATH="$HOME/.local/bin:$PATH"
fi
fi
# Remove duplicates in $PATH, if they exist
typeset -U path
## Configure the history
# The following line changes the command execution time stamp shown in
# the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
HIST_STAMPS='%Y-%m-%d'
# Don't store invocations of 'history' in the history
setopt HIST_NO_STORE
# Enable incremental append
setopt INC_APPEND_HISTORY
## Long running
# If a command takes a combined time of > 10 seconds, zsh will report it...
REPORTTIME=10
## Aliases
# Override grml's setting for dir
alias dir='dir --color=auto'
# Add colour
alias vdir='vdir --color=auto'
alias fgrep='fgrep --color=auto'
# Make sure we ask before every use of our key
alias ssh-add='/usr/bin/ssh-add -c -t 1800'
# Use ksshaskpass if it exists and we're using the plasma desktop
if [[ "$DESKTOP_SESSION" =~ "plasma" ]]
then
if [ -x /usr/bin/ksshaskpass ]
then
# Use KDE askpass
export SSH_ASKPASS=/usr/bin/ksshaskpass
echo "[awit-zsh-superawesome] Using ksshaskpass"
else
echo "[awit-zsh-superawesome] NOTICE: You're using the plasma desktop, but you don't have ksshaskpass installed?"
fi
fi
# Use keychain if installed
if [ -x /usr/bin/keychain ]
then
eval `keychain --confirm --clear --noask --timeout 15 --eval --systemd --stop others --quiet --inherit local-once --agents ssh`
echo "[awit-zsh-superawesome] Using keychain (15 min timeout, explicit confirmation)"
fi
## Completion
# A handy-dandy function for reloading completions we might hack on
function compreload() {
ARG="$1"
unfunction _$ARG
autoload _$ARG
}
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' use-compctl false
# Add custom completion scripts
if [ -d "$HOME/.zsh/completion" ]
then
fpath=($HOME/.zsh/completion $fpath)
fi
## Oh-my-zsh
plugins=(
colored-man-pages
colorize
command-not-found
gitfast
screen
virtualenv
zsh-syntax-highlighting
)
# Allow theming if we're running in a desktop session
if [[ "$DESKTOP_SESSION" =~ "plasma" && "$TERM_PROGRAM" != "vscode" ]]
then
# Set oh my zsh theme
ZSH_THEME="powerlevel10k"
# Setup powerlevel9k
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir dir_writable vcs virtualenv)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator command_execution_time background_jobs history time)
POWERLEVEL9K_MODE=awesome-fontconfig
# Shorten directory length
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
# Fix up icons a bit
POWERLEVEL9K_OS_ICON_BACKGROUND="white"
POWERLEVEL9K_OS_ICON_FOREGROUND="blue"
POWERLEVEL9K_DIR_HOME_FOREGROUND="white"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="white"
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="white"
# Add highlight color to prompt
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
typeset -gA ZSH_HIGHLIGHT_STYLES
ZSH_HIGHLIGHT_STYLES[cursor]='bold'
ZSH_HIGHLIGHT_STYLES[alias]='fg=green,bold'
ZSH_HIGHLIGHT_STYLES[suffix-alias]='fg=green,bold'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=green,bold'
ZSH_HIGHLIGHT_STYLES[function]='fg=green,bold'
ZSH_HIGHLIGHT_STYLES[command]='fg=green,bold'
ZSH_HIGHLIGHT_STYLES[precommand]='fg=green,bold'
ZSH_HIGHLIGHT_STYLES[hashed-command]='fg=green,bold'
fi
## Variables
# Useful variables for our ZSH environment
test "x$HOSTNAME" = "x" && export HOSTNAME="$HOST"
export GIT_EDITOR="$EDITOR"
export VISUAL="$EDITOR"
## Load Oh-my-zsh [This needs to be last]
# Path to your oh-my-zsh installation
ZSH=/usr/share/oh-my-zsh/
# Custom directory
ZSH_CUSTOM="$AZS_DIR/custom"
# Disable bi-weekly auto-update checks
DISABLE_AUTO_UPDATE="true"
COMPLETION_WAITING_DOTS="true"
# Stop the annoying habit of creating multiple dump files
ZSH_COMPDUMP="$COMPDUMPFILE"
# Pull in the system oh-my-zsh
source "$ZSH/oh-my-zsh.sh"
# Override first bin dir
export PATH=~/bin:$PATH
HIST_STAMPS="yyyy/mm/dd"
## Configure the history.
# First up, enable extended history mode
setopt EXTENDED_HISTORY
# Now ignore duplicates in the history
setopt HIST_IGNORE_ALL_DUPS
# Ignore gaps too
setopt HIST_IGNORE_SPACE
# Don't store invocations of 'history' in the history
setopt HIST_NO_STORE
# Enable incremental append
setopt INC_APPEND_HISTORY
# Enable zsh history sharing. Scary but fun
setopt SHARE_HISTORY
## Now the history file configuration itself
# The file to store history in
HISTFILE=~/.zsh_history
# Store 2000 commands in memory
HISTSIZE=2000
# Save 1000 commands
SAVEHIST=1000
# Remove / from the default WORDCHARS
WORDCHARS=$(echo $WORDCHARS | tr -d '/')
# If a command takes a combined time of > 10 seconds, zsh will report it...
REPORTTIME=10
# Use a bunch of colors
if [ "$TERM" = "screen" ]
then
export TERM="screen-256color-s"
else
export TERM="xterm-256color"
fi
# Add directory colors
if [ -x /usr/bin/dircolors ]; then
eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# Use ksshaskpass if it exists and we're using the plasma desktop
if [ "$DESKTOP_SESSION" = "/usr/share/xsessions/plasma" ]
then
if [ -x /usr/bin/ksshaskpass ]
then
# Use KDE askpass
export SSH_ASKPASS=/usr/bin/ksshaskpass
echo "zsh: Using ksshaskpass"
else
echo "NOTICE: You're using the plasma desktop, but you don't have ksshaskpass installed?"
fi
fi
# Use keychain if installed
if [ -x /usr/bin/keychain ]
then
eval `keychain --confirm --clear --noask --timeout 15 --eval --systemd others --quiet`
echo "zsh: Using keychain (15 min timeout, explicit confirmation)"
fi
# Use modern completion system
autoload -Uz compinit
compinit
# A handy-dandy function for reloading completions we might hack on
compreload ()
{
ARG="$1"
unfunction _$ARG
autoload _$ARG
}
# Bash-style null glob result -> no error
#setopt null_glob
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
#zstyle ':completion:*' group-name ''
#zstyle ':completion:*' menu select=2
#zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
#zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
#zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
#zstyle ':completion:*' menu select=long
#zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
#zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
#zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# Oh My ZSH plugins to load
plugins=(colored-man-pages command-not-found gitfast screen zsh-navigation-tools safe-paste)
# Bind ^A and ^z to zsh-navigation-tools
zle -N znt-cd-widget
bindkey "^A" znt-cd-widget
zle -N znt-kill-widget
bindkey "^Y" znt-kill-widget
ZSH_THEME="powerline"
# Display date or exit-status
POWERLINE_RIGHT_A="exit-status"
POWERLINE_NO_BLANK_LINE="true"
setopt EXTENDED_GLOB