mirror of
https://codeberg.org/hyperreal/dotfiles
synced 2024-11-01 16:53:07 +01:00
114 lines
3.4 KiB
Bash
114 lines
3.4 KiB
Bash
# 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
|
|
|
|
# Plugins
|
|
if ! test -f "${HOME}/.zplug/init.zsh"; then
|
|
export ZPLUG_HOME="${HOME}/.zplug"
|
|
git clone https://github.com/zplug/zplug $ZPLUG_HOME
|
|
fi
|
|
|
|
source "${HOME}/.zplug/init.zsh"
|
|
|
|
# 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
|
|
zplug "${HOME}/.zshrc.d", from:local, use:'*'
|
|
|
|
if ! zplug check; then
|
|
zplug install;
|
|
exec $SHELL $SHELL_ARGS "$@"
|
|
fi
|
|
|
|
zplug load
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# ENVIRONMENT VARS
|
|
# -----------------------------------------------------------------------------
|
|
export PATH="${HOME}/.config/emacs/bin:${PATH}"
|
|
export PAGER="less -FRX"
|
|
export MANWIDTH="88"
|
|
export MANROFFOPT="-c"
|
|
export MANPAGER="less -FRX"
|
|
export BAT_PAGER="less -FRX"
|
|
export BAT_STYLE="plain"
|
|
|
|
if test -x "$(command -v emacs)"; then
|
|
EDITOR="emacsclient"
|
|
else
|
|
EDITOR="vim"
|
|
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
|
|
HISTFILE="${HOME}/.zsh_history"
|
|
|
|
# Language
|
|
export LANG="en_US.UTF-8"
|
|
|
|
# Manpages
|
|
export MANPATH="${MANPATH:-/usr/share/man:/usr/local/share/man}"
|
|
|
|
# Add ~/.local/bin to PATH
|
|
export PATH="${HOME}/.local/bin:${PATH}"
|
|
|
|
# Add ~/bin to PATH
|
|
export PATH="${HOME}/bin:${PATH}"
|
|
|
|
# Automatically remove duplicates from these arrays
|
|
typeset -gU path cdpath manpath fpath
|
|
|
|
# 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" }
|
|
|
|
# direnv
|
|
eval "$(direnv hook zsh)"
|
|
|
|
# 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
|