dotfiles/zsh/.zshrc

117 lines
3.4 KiB
Bash
Raw Normal View History

2023-09-15 22:59:26 +02:00
# Filename : ~/.zshrc
# Purpose : setup file for zsh
# Author : Jeffrey Serio <hyperreal@fedoraproject.org>
# Homepage : https://hyperreal.coffee
#
# Zsh Manual - https://zsh-manual.netlify.app
# Zsh Guide - https://zsh-guide.netlify.app
2024-07-31 12:49:21 +02:00
2023-09-15 22:59:26 +02:00
# Plugins
2024-10-26 20:30:45 +02:00
if ! test -f "${HOME}/.zplug/init.zsh"; then
export ZPLUG_HOME="${HOME}/.zplug"
2023-09-15 22:59:26 +02:00
git clone https://github.com/zplug/zplug $ZPLUG_HOME
fi
2024-10-26 20:30:45 +02:00
source "${HOME}/.zplug/init.zsh"
2023-09-15 22:59:26 +02:00
# Use autosuggestions when typing commands
zplug "zsh-users/zsh-autosuggestions"
# Use a keybinding to complete parts of command from the history file
zplug "zsh-users/zsh-history-substring-search"
# Use syntax highlighting when typing commands
zplug "zsh-users/zsh-syntax-highlighting", defer:2
# Press escape twice to prepend `sudo` to the command line
zplug "plugins/sudo", from:oh-my-zsh
# extract archives
zplug "plugins/extract", from:oh-my-zsh
# systemd aliases
zplug "plugins/systemd", from:oh-my-zsh
# Load file from ~/.zshrc.d
2024-10-26 20:30:45 +02:00
zplug "${HOME}/.zshrc.d", from:local, use:'*'
2023-09-15 22:59:26 +02:00
if ! zplug check; then
zplug install;
exec $SHELL $SHELL_ARGS "$@"
fi
zplug load
# -----------------------------------------------------------------------------
# ENVIRONMENT VARS
# -----------------------------------------------------------------------------
2024-10-26 20:30:45 +02:00
export PATH="${HOME}/.config/emacs/bin:${PATH}"
export PAGER="less -FRX"
2023-09-15 22:59:26 +02:00
export MANWIDTH="88"
export MANROFFOPT="-c"
2024-10-26 20:30:45 +02:00
export MANPAGER="less -FRX"
export BAT_PAGER="less -FRX"
export BAT_STYLE="plain"
2023-09-15 22:59:26 +02:00
if test -x "$(command -v emacs)"; then
2024-10-26 20:30:45 +02:00
EDITOR="emacsclient"
2023-09-15 22:59:26 +02:00
else
2024-10-26 20:30:45 +02:00
EDITOR="vim"
2023-09-15 22:59:26 +02:00
fi
export EDITOR
# Have less display colours
# from: https://wiki.archlinux.org/index.php/Color_output_in_console#man
export LESS_TERMCAP_mb=$'\e[1;31m' # begin bold
export LESS_TERMCAP_md=$'\e[1;34m' # begin blink
export LESS_TERMCAP_so=$'\e[01;0;33m' # begin reverse video
export LESS_TERMCAP_us=$'\e[01;31m' # begin underline
export LESS_TERMCAP_me=$'\e[0m' # reset bold/blink
export LESS_TERMCAP_se=$'\e[0m' # reset reverse video
export LESS_TERMCAP_ue=$'\e[0m' # reset underline
export GROFF_NO_SGR=1 # for konsole and gnome-terminal
# HISTSIZE is the number of lines of history that is kept within any given
# running zsh instance. SAVEHIST is the number of lines of history that is
# written out to the HISTFILE when that event occurs. If you use the
# HIST_EXPIRE_DUPS_FIRST option, setting this value larger than the SAVEHIST
# size will give you the difference as a cushion for saving duplicated history
# events.
HISTSIZE=100000
SAVEHIST=65536
# Name of the file used to store command history
2024-10-26 20:30:45 +02:00
HISTFILE="${HOME}/.zsh_history"
2023-09-15 22:59:26 +02:00
# Language
export LANG="en_US.UTF-8"
# Manpages
export MANPATH="${MANPATH:-/usr/share/man:/usr/local/share/man}"
2024-10-26 20:30:45 +02:00
# Add ~/.local/bin to PATH
export PATH="${HOME}/.local/bin:${PATH}"
2023-09-15 22:59:26 +02:00
2024-10-26 20:30:45 +02:00
# Add ~/bin to PATH
export PATH="${HOME}/bin:${PATH}"
2023-09-15 22:59:26 +02:00
# Automatically remove duplicates from these arrays
typeset -gU path cdpath manpath fpath
2024-02-01 18:34:16 +01:00
# compatibility with vterm-buffer-name-string in Emacs
autoload -U add-zsh-hook
add-zsh-hook -Uz chpwd() { print -Pn "\e]2;%m:%2~\a" }
2024-07-31 12:49:21 +02:00
2024-10-26 20:30:45 +02:00
# direnv
eval "$(direnv hook zsh)"
2024-11-09 20:30:14 +01:00
# starship.rs
eval "$(starship init zsh)"
2024-10-26 20:30:45 +02:00
# Ensure always loading the latest version of the emacs-vterm-zsh.sh file
if [[ "$INSIDE_EMACS" = 'vterm' ]] \
&& [[ -n ${EMACS_VTERM_PATH} ]] \
&& [[ -f ${EMACS_VTERM_PATH}/etc/emacs-vterm-zsh.sh ]]; then
source ${EMACS_VTERM_PATH}/etc/emacs-vterm-zsh.sh
fi