2022-09-13 15:37:45 +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
|
|
|
|
#
|
|
|
|
# ,----[ man -k zsh ]
|
|
|
|
# |
|
|
|
|
# | zsh (1) - the Z shell
|
|
|
|
# | zshall (1) - the Z shell meta-man page
|
|
|
|
# | zshbuiltins (1) - zsh builtin commands
|
|
|
|
# | zshcalsys (1) - zsh calendar system
|
|
|
|
# | zshcompctl (1) - zsh programmable completion
|
|
|
|
# | zshcompsys (1) - zsh completion system
|
|
|
|
# | zshcompwid (1) - zsh completion widgets
|
|
|
|
# | zshcontrib (1) - user contributions to zsh
|
|
|
|
# | zshexpn (1) - zsh expansion and substitution
|
|
|
|
# | zshmisc (1) - everything and then some
|
|
|
|
# | zshmodules (1) - zsh loadable modules
|
|
|
|
# | zshoptions (1) - zsh options
|
|
|
|
# | zshparam (1) - zsh parameters
|
|
|
|
# | zshroadmap (1) - informal introduction to the zsh manual
|
|
|
|
# | zshtcpsys (1) - zsh tcp system
|
|
|
|
# | zshzftpsys (1) - zftp function front-end
|
|
|
|
# | zshzle (1) - zsh command line editor
|
|
|
|
# `----
|
|
|
|
#
|
|
|
|
# Zsh startup sequence
|
|
|
|
# 1) /etc/zshenv -> Always run for every zsh. (login + interactive + other)
|
|
|
|
# 2) ~/.zshenv -> Usually run for every zsh. (login + interactive + other)
|
|
|
|
# 3) /etc/zprofile -> Run for login shells. (login)
|
|
|
|
# 4) ~/.zprofile -> Run for login shells. (login)
|
|
|
|
# 5) /etc/zshrc -> Run for interactive shells. (login + interactive)
|
|
|
|
# 6) ~/.zshrc -> Run for interactive shells. (login + interactive)
|
|
|
|
# 7) /etc/zlogin -> Run for login shells. (login)
|
|
|
|
# 8) ~/.zlogin -> Run for login shells. (login)
|
|
|
|
#
|
|
|
|
# This file is based on Christian Schneider's zsh configuration
|
|
|
|
# https://www.strcat.de/dotfiles
|
2022-07-17 04:25:55 +02:00
|
|
|
|
2022-09-13 15:37:45 +02:00
|
|
|
# Plugins
|
2022-07-17 04:25:55 +02:00
|
|
|
if ! test -f ~/.zplug/init.zsh; then
|
|
|
|
export ZPLUG_HOME=~/.zplug
|
|
|
|
git clone https://github.com/zplug/zplug $ZPLUG_HOME
|
|
|
|
fi
|
|
|
|
|
|
|
|
source ~/.zplug/init.zsh
|
|
|
|
|
2022-09-13 15:37:45 +02:00
|
|
|
# Use autosuggestions when typing commands
|
2022-07-17 04:25:55 +02:00
|
|
|
zplug "zsh-users/zsh-autosuggestions"
|
2022-09-13 15:37:45 +02:00
|
|
|
|
|
|
|
# Use a keybinding to complete parts of command from the history file
|
2022-07-17 04:25:55 +02:00
|
|
|
zplug "zsh-users/zsh-history-substring-search"
|
2022-09-13 15:37:45 +02:00
|
|
|
|
|
|
|
# Use syntax highlighting when typing commands
|
2022-07-19 15:04:00 +02:00
|
|
|
zplug "zsh-users/zsh-syntax-highlighting", defer:2
|
2022-09-13 15:37:45 +02:00
|
|
|
|
|
|
|
# Press escape twice to prepend `sudo` to the command line
|
2022-07-17 04:25:55 +02:00
|
|
|
zplug "plugins/sudo", from:oh-my-zsh
|
2022-09-13 15:37:45 +02:00
|
|
|
|
2022-12-28 04:10:44 +01:00
|
|
|
# extract archives
|
|
|
|
zplug "plugins/extract", from:oh-my-zsh
|
|
|
|
|
2022-09-13 15:37:45 +02:00
|
|
|
# systemd aliases
|
2022-07-17 04:25:55 +02:00
|
|
|
zplug "plugins/systemd", from:oh-my-zsh
|
2022-09-13 15:37:45 +02:00
|
|
|
|
2022-11-05 20:57:02 +01:00
|
|
|
# Load file from ~/.zshrc.d
|
|
|
|
zplug "~/.zshrc.d", from:local, use:'*'
|
|
|
|
|
2023-05-18 17:04:51 +02:00
|
|
|
# starship.rs
|
|
|
|
eval "$(starship init zsh)"
|
|
|
|
|
2022-07-17 04:25:55 +02:00
|
|
|
if ! zplug check; then
|
|
|
|
zplug install;
|
|
|
|
exec $SHELL $SHELL_ARGS "$@"
|
|
|
|
fi
|
|
|
|
|
|
|
|
zplug load
|
|
|
|
|
2023-05-18 17:04:51 +02:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# ENVIRONMENT VARS
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
2022-07-19 15:04:00 +02:00
|
|
|
export LS_COLORS=$(cat ~/.lscolors.sh)
|
2023-05-18 17:04:51 +02:00
|
|
|
export PAGER="less -X"
|
|
|
|
export MANWIDTH="88"
|
|
|
|
export MANROFFOPT="-c"
|
|
|
|
export MANPAGER="less -X"
|
2022-11-24 18:24:20 +01:00
|
|
|
|
2023-05-18 17:04:51 +02:00
|
|
|
if test -x "$(command -v emacS)"; then
|
|
|
|
EDITOR="emacs"
|
|
|
|
else
|
|
|
|
EDITOR="nvim"
|
|
|
|
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
|
|
|
|
|
|
|
|
# Cargo/Rust
|
|
|
|
[[ -f "${HOME}/.cargo/env" ]] && source "${HOME}/.cargo/env"
|
|
|
|
|
|
|
|
# Format of process time reports with 'time'
|
|
|
|
# %% A '%'
|
|
|
|
# %U CPU seconds spent in user mode
|
|
|
|
# %S CPU seconds spent in kernel mode
|
|
|
|
# %E Elapsed time in seconds
|
|
|
|
# %P CPU percentage, computed as (%U+%S)/%E
|
|
|
|
# %J The name of this job
|
|
|
|
# Default is:
|
|
|
|
# %E real %U user %S system %P %J
|
|
|
|
TIMEFMT="\
|
|
|
|
|
|
|
|
The name of this job : %J
|
|
|
|
CPU seconds spent in user mode : %U
|
|
|
|
CPU seconds spent in kernel mode : %S
|
|
|
|
Elapsed time in seconds : %E
|
|
|
|
CPU percentage : %P"
|
|
|
|
|
|
|
|
# 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=~/.zsh_history
|
|
|
|
|
|
|
|
# If nonnegative, commands whose combined user and system execution times
|
|
|
|
# (measured in seconds) are greater than this value have timing stats printed
|
|
|
|
# for them.
|
|
|
|
REPORTTIME=10
|
|
|
|
|
|
|
|
# Language
|
|
|
|
export LANG="en_US.UTF-8"
|
|
|
|
|
|
|
|
# Manpages
|
|
|
|
export MANPATH="${MANPATH:-/usr/share/man:/usr/local/share/man}"
|
|
|
|
|
|
|
|
if [ -d "${HOME}/.fzf/man" ]; then
|
|
|
|
export MANPATH="${MANPATH}:${HOME}/.fzf/man"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Bat theme
|
|
|
|
export BAT_THEME="Catppuccin-mocha"
|
|
|
|
|
|
|
|
# Automatically remove duplicates from these arrays
|
|
|
|
typeset -gU path cdpath manpath fpath
|
|
|
|
|