mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-25 04:51:31 +01:00
97 lines
3.2 KiB
Bash
Executable File
97 lines
3.2 KiB
Bash
Executable File
# Check for update, set DISABLE_UPDATE_PROMPT=yes to disable the prompt and automatically update
|
|
env DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f "$DOTFILES/check_for_update.sh"
|
|
|
|
# theme-related variables
|
|
export ZSH_CUSTOM="$DOTFILES"
|
|
export ZSH_THEME="brethil"
|
|
export DISABLE_UNTRACKED_FILES_DIRTY=true
|
|
export VIRTUAL_ENV_DISABLE_PROMPT=true
|
|
|
|
|
|
_ZSH_CACHE="${HOME}/.cache/zsh"
|
|
if [[ ! -d "${_ZSH_CACHE}" ]]; then mkdir -p "${_ZSH_CACHE}"; fi
|
|
|
|
# Source all zsh plugins
|
|
source <(antibody init)
|
|
export ANTIBODY="$(antibody home)"
|
|
antibody bundle < "$DOTFILES/antibody_plugins.txt"
|
|
uname="$(uname -a)"
|
|
if [[ $uname == *"ARCH"* || $uname == *"MANJARO"* ]]; then
|
|
antibody bundle < "$DOTFILES/antibody_plugins_arch.txt"
|
|
fi
|
|
|
|
# Setup oh-my-zsh path
|
|
export ZSH="$(antibody path robbyrussell/oh-my-zsh)"
|
|
|
|
# Enable zsh autocorrection
|
|
setopt CORRECT_ALL
|
|
|
|
# share history across multiple zsh sessions
|
|
setopt SHARE_HISTORY
|
|
# append to history
|
|
setopt APPEND_HISTORY
|
|
|
|
# adds commands as they are typed, not at shell exit
|
|
setopt INC_APPEND_HISTORY
|
|
|
|
# Execute commands without verifying after prompt substitution (!!, !$, etc)
|
|
setopt NO_HIST_VERIFY
|
|
|
|
## Misc environment variables
|
|
|
|
# https://www.xkcd.com/378/
|
|
export EDITOR="vim" # if antibody_plugins.txt includes robbyrussell/oh-my-zsh path:plugins/vi-mode, this also sets `bindkey -v`
|
|
export VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true # refresh prompt on every mode change
|
|
# Fix delete (delete! not backspace) key
|
|
bindkey -a '^[[3~' delete-char
|
|
|
|
export KEYTIMEOUT=1 # reduce the transition time between vim modes to 0.1s
|
|
|
|
export HISTSIZE=100000
|
|
export LANG=en_US.UTF-8
|
|
export LC_ALL=en_US.UTF-8
|
|
|
|
# less options
|
|
export LESS='-xRF-j12' # -j12: displays 12 lines before search results with / and ?
|
|
if [[ "$(command -v bat)" ]]; then
|
|
alias cat=bat
|
|
export BAT_PAGER="less $LESS"
|
|
export PAGER=bat
|
|
fi
|
|
|
|
if [[ $SSH_CLIENT ]]; then
|
|
export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock
|
|
fi
|
|
|
|
# pip completion. Cache output since pip takes 0.4s to run
|
|
if [[ ${commands[pip]} ]]; then
|
|
pip_cache_file="${_ZSH_CACHE}/pip_completion_cache.zsh"
|
|
if [[ "${commands[pip]}" -nt "${pip_cache_file}" || ! -s "$pip_cache_file" ]]; then
|
|
pip completion --zsh | sed -e "s|compctl -K [-_[:alnum:]]* pip|& pip2 pip3|" >! "$pip_cache_file" 2> /dev/null
|
|
fi
|
|
source "${pip_cache_file}"
|
|
unset pip_cache_file
|
|
fi
|
|
|
|
alias esource='$EDITOR $HOME/.zshrc'
|
|
alias resource='source $HOME/.zshrc'
|
|
alias dotedit='$EDITOR $DOTFILES/brethil_dotfile.sh'
|
|
# Custom definitions files
|
|
alias funedit='$EDITOR ~/.dotfiles_functions.sh'
|
|
alias aledit='$EDITOR ~/.dotfiles_aliases.sh'
|
|
|
|
export p="${HOME}/projects"
|
|
|
|
# Extras
|
|
functions_file=$DOTFILES/functions.sh # Function definitions
|
|
aliases_file=$DOTFILES/aliases.sh # Aliases definitions
|
|
colors_file=$DOTFILES/colors.sh # Colors definitions
|
|
|
|
# Source extras
|
|
if [ -f "$functions_file" ]; then source "$functions_file"; else echo "[brethil-dotfiles] Couldn't load functions: $functions_file"; fi
|
|
if [ -f "$aliases_file" ]; then source "$aliases_file"; else echo "[brethil-dotfiles] Couldn't load aliases: $aliases_file"; fi
|
|
if [ -f "$colors_file" ]; then source "$colors_file"; else echo "[brethil-dotfiles] Couldn't load colors: $colors_file";fi
|
|
|
|
### SETUP PATHS ####
|
|
export PATH=$PATH:$HOME/bin
|