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 163 additions and 156 deletions
File deleted
File deleted
File deleted
File deleted
File deleted
Subproject commit 5c047ae8ba54577f7e7471094bbce375339559ab
Subproject commit 13b0e383a066c9c37d5cf71d4af521f9b73a173e
Subproject commit 02a37dd919dc48e0821186e5f20e78bd0215f86a
# We need to enable extended globbing here for the below source inclusion
setopt EXTENDED_GLOB
# Source in resources
find ~/.zsh/zshrc{,_local}.d/([a-zA-Z0-9-]##).zsh | sort -t/ -k6,6 | while read LINE; do
DIR="${LINE%/*}"
FILE="${LINE##*/}"
# If there's a file in zshrc_local.d with the same name as one
# in zshrc.d, ignore the file in zshrc.d
if [[ "$DIR" =~ "zshrc.d" ]] && [ -e "~/.zsh/zshrc_local.d/$FILE" ]; then
# Do nothing
:
# Set the directory where we're being loaded from
AZS_DIR="$0:h"
## Home bin path
# Override first bin directory
if [ -d "$HOME/.local/bin" ]
then
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
source "$LINE"
echo "[awit-zsh-superawesome] NOTICE: You're using the plasma desktop, but you don't have ksshaskpass installed?"
fi
done
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
# NB: Note that precedence matters, so some settings will not yield the
# expected results when put into ~/.zsh/zshrc.local. In that case you need
# to figure out the file number and put it into ~/.zsh/zshrc_local.d/
# A handy-dandy function for reloading completions we might hack on
function compreload() {
ARG="$1"
unfunction _$ARG
autoload _$ARG
}
# Source in local stuff
if [ -f ~/.zsh/zshrc.local ]
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
source ~/.zsh/zshrc.local
# 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 --stop others --quiet --inherit local-once --agents gpg,ssh`
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'
# Add custom completion scripts
fpath=(~/.zsh/completion $fpath)
# Oh My ZSH plugins to load
plugins=(colored-man-pages colorize command-not-found gitfast screen zsh-syntax-highlighting)
# 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
# Use instant selects
znt_list_instant_select=1