1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-16 16:51:30 +01:00
dotfiles/brethil_dotfile.sh
2021-12-09 00:02:38 +01:00

85 lines
2.5 KiB
Bash
Executable File

# vim:ft=zsh ts=2 sw=2 sts=2
export LANG=en_US.UTF-8
# Check for update, set DISABLE_UPDATE_PROMPT=true to disable the prompt and automatically update
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
source "${DOTFILES}/check_for_update.zsh"
fi
# theme-related variables
export ZSH_CUSTOM="$DOTFILES"
export ZSH_THEME="brethil"
export DISABLE_UNTRACKED_FILES_DIRTY=true
export VIRTUAL_ENV_DISABLE_PROMPT=true
# Source all zsh plugins
source <(antibody init)
export ANTIBODY="$(antibody home)"
antibody bundle < "$DOTFILES/antibody_plugins.txt"
if [[ "$(command -v systemctl)" ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/systemd
fi
if [[ "$(command -v pacman)" ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/archlinux
elif [[ "$(command -v apt-get)" ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/debian
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=50 # reduce the transition time between vim modes to 0.1s
# bindkey -M vicmd 'V' edit-command-line # this remaps `vv` to `V` (but overrides `visual-mode`) # add this if the keytimeout is too slow
export HISTSIZE=10000000
# 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_THEME="gruvbox-dark"
export BAT_PAGER="less $LESS"
export PAGER=bat
fi
if [[ $SSH_CLIENT ]]; then
export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock
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"
### SETUP PATHS ####
export PATH=$PATH:$HOME/bin
autoload -U compinit && compinit