diff --git a/.local/dotfiles/environment/rbenv.zsh b/.local/dotfiles/environment/rbenv.zsh index ae096b9..c70d326 100644 --- a/.local/dotfiles/environment/rbenv.zsh +++ b/.local/dotfiles/environment/rbenv.zsh @@ -1,3 +1,6 @@ -export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$HOME/.rbenv/bin:$PATH" -eval "$(rbenv init -)" +which rbenv &>/dev/null +if [[ $? -eq 0 ]]; then + export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$HOME/.rbenv/bin:$PATH" + eval "$(rbenv init -)" +fi diff --git a/.zimrc b/.zimrc index 06e7b81..2af921d 100644 --- a/.zimrc +++ b/.zimrc @@ -1,96 +1,39 @@ +# Start configuration added by Zim install {{{ +# ------- +# Modules +# ------- - -################# -# CORE SETTINGS # -################# - -# -# Zim settings -# - -# Select what modules you would like enabled. -# The second line of modules may depend on options set by modules in the first -# line. These dependencies are noted on the respective module's README.md. -zmodules=(directory environment git git-info history input utility custom \ - syntax-highlighting history-substring-search prompt completion) - - -################### -# MODULE SETTINGS # -################### +# Sets sane Zsh built-in environment options. +zmodule environment +# Provides handy git aliases and functions. +zmodule git +# Applies correct bindkeys for input events. +zmodule input +# Sets a custom terminal title. +zmodule termtitle +# Utility aliases and functions. Adds colour to ls, grep and less. +zmodule utility # # Prompt # +# Exposes git repository status information to prompts. +zmodule git-info +# A customizable version of steeef's prompt theme. +zmodule eriner -# Set your desired prompt here -zprompt_theme='eriner' - -# -# Completion -# - -# set an optional host-specific filename for the completion cache file -# if none is provided, the default '.zcompdump' is used. -#zcompdump_file=".zcompdump-${HOST}-${ZSH_VERSION}" - -# -# Utility -# - -# Uncomment to enable command correction prompts -# See: http://zsh.sourceforge.net/Doc/Release/Options.html#Input_002fOutput -#setopt CORRECT - -# -# Environment -# - -# Set the string below to the desired terminal title format string. -# The terminal title is redrawn upon directory change, however, variables like -# ${PWD} are only evaluated once. Use prompt expansion strings for dynamic data: -# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes -# The example below uses the following format: 'username@host:/current/directory' -ztermtitle='%n@%m:%~' - -# -# Input -# - -# Uncomment to enable double-dot expansion. -# This appends '../' to your input for each '.' you type after an initial '..' -#zdouble_dot_expand='true' - -# -# Syntax-Highlighting -# - -# This determines what highlighters will be used with the syntax-highlighting module. -# Documentation of the highlighters can be found here: -# https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md -# For (u)rxvt, termite and gnome-terminal users, -# removing the 'cursor' highlighter will fix the disappearing cursor problem -#zhighlighters=(main brackets cursor) -zhighlighters=(main brackets) - - -# -# SSH -# - -# Load these ssh identities with the ssh module -#zssh_ids=(id_rsa) - - -# -# Pacman -# - -# Set (optional) pacman front-end. -#zpacman_frontend='powerpill' -#zpacman_frontend='pacmatic' - -# Load any helper scripts as defined here -#zpacman_helper=(aur) -#zpacman_helper=(aur) +# Additional completion definitions for Zsh. +zmodule zsh-users/zsh-completions +# Enables and configures smart and extensive tab completion. +# completion must be sourced after zsh-users/zsh-completions +zmodule completion +# Fish-like autosuggestions for Zsh. +zmodule zsh-users/zsh-autosuggestions +# Fish-like syntax highlighting for Zsh. +# zsh-users/zsh-syntax-highlighting must be sourced after completion +zmodule zsh-users/zsh-syntax-highlighting +# Fish-like history search (up arrow) for Zsh. +# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting +zmodule zsh-users/zsh-history-substring-search +# }}} End configuration added by Zim install diff --git a/.zlogin b/.zlogin index a9af863..85a9616 100644 --- a/.zlogin +++ b/.zlogin @@ -1,8 +1,9 @@ - - +# Start configuration added by Zim install {{{ # # User configuration sourced by login shells # -# Initialize zim -[[ -s ${ZIM_HOME}/login_init.zsh ]] && source ${ZIM_HOME}/login_init.zsh +# Initialize Zim +source ${ZIM_HOME}/login_init.zsh -q &! +# }}} End configuration added by Zim install + diff --git a/.zshenv b/.zshenv new file mode 100644 index 0000000..121400e --- /dev/null +++ b/.zshenv @@ -0,0 +1,9 @@ +# Start configuration added by Zim install {{{ +# +# User configuration sourced by all invocations of the shell +# + +# Define Zim location +: ${ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim} +# }}} End configuration added by Zim install + diff --git a/.zshrc b/.zshrc index 02722db..9ad8de4 100644 --- a/.zshrc +++ b/.zshrc @@ -1,37 +1,137 @@ +# Start configuration added by Zim install {{{ # # User configuration sourced by interactive shells # + +# ----------------- +# Zsh configuration +# ----------------- + +# +# History +# + +# Remove older command from the history if a duplicate is to be added. +setopt HIST_IGNORE_ALL_DUPS + +# +# Input/output +# + +# Set editor default keymap to emacs (`-e`) or vi (`-v`) +bindkey -e + +# Prompt for spelling correction of commands. +#setopt CORRECT + +# Customize spelling correction prompt. +#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' + +# Remove path separator from WORDCHARS. +WORDCHARS=${WORDCHARS//[\/]} + + +# -------------------- +# Module configuration +# -------------------- + +# +# completion +# + +# Set a custom path for the completion dump file. +# If none is provided, the default ${ZDOTDIR:-${HOME}}/.zcompdump is used. +#zstyle ':zim:completion' dumpfile "${ZDOTDIR:-${HOME}}/.zcompdump-${ZSH_VERSION}" + +# +# git +# + +# Set a custom prefix for the generated aliases. The default prefix is 'G'. +#zstyle ':zim:git' aliases-prefix 'g' + +# +# input +# + +# Append `../` to your input for each `.` you type after an initial `..` +#zstyle ':zim:input' double-dot-expand yes + +# +# termtitle +# + +# Set a custom terminal title format using prompt expansion escape sequences. +# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes +# If none is provided, the default '%n@%m: %~' is used. +#zstyle ':zim:termtitle' format '%1~' + +# +# zsh-autosuggestions +# + +# Customize the style that the suggestions are shown with. +# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style +#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10' + +# +# zsh-syntax-highlighting +# + +# Set what highlighters will be used. +# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md +ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) + +# Customize the main highlighter styles. +# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it +#typeset -A ZSH_HIGHLIGHT_STYLES +#ZSH_HIGHLIGHT_STYLES[comment]='fg=10' + +# ------------------ +# Initialize modules +# ------------------ + +if [[ ${ZIM_HOME}/init.zsh -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then + # Update static initialization script if it's outdated, before sourcing it + source ${ZIM_HOME}/zimfw.zsh init -q +fi +source ${ZIM_HOME}/init.zsh + +# ------------------------------ +# Post-init module configuration +# ------------------------------ + +# +# zsh-history-substring-search +# + +# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init +bindkey '^[[A' history-substring-search-up +bindkey '^[[B' history-substring-search-down + +# Bind up and down keys +zmodload -F zsh/terminfo +p:terminfo +if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then + bindkey ${terminfo[kcuu1]} history-substring-search-up + bindkey ${terminfo[kcud1]} history-substring-search-down +fi + +bindkey '^P' history-substring-search-up +bindkey '^N' history-substring-search-down +bindkey -M vicmd 'k' history-substring-search-up +bindkey -M vicmd 'j' history-substring-search-down +# }}} End configuration added by Zim install + + +# Set Path: typeset -U PATH PATH="$HOME/bin:$HOME/.local/bin:$PATH" export PATH -# Change default zim location -export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim - -# Start zim -[[ -s ${ZIM_HOME}/init.zsh ]] && source ${ZIM_HOME}/init.zsh - -# Fix the ESC+Backspace -#bindkey -e -#bindkey -e "^[[1;5C" forward-word -#bindkey -e "^[[1;5D" backward-word - -# Set GPG TTY -#export GPG_TTY=$(tty) - -# Refresh gpg-agent tty in case user switches into an X session -#gpg-connect-agent updatestartuptty /bye >/dev/null - -# Update SSH Agent Socket -#unset SSH_AGENT_PID -#if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then -# export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" -#fi - # Include local functions/aliases/environments: while read f do - source "$f" + source "$f" done < <(find "${HOME}/.local/dotfiles/" -type f -name '*.zsh') # Disable Ctrl+S Scroll-Locking