zsh: clean up zshrc

This commit is contained in:
Nico 2025-11-01 14:58:55 +11:00
parent 3d7a4ba0c2
commit b88339dae6
Signed by: nico
SSH key fingerprint: SHA256:XuacYOrGqRxC3jVFjfLROn1CSvLz85Dec6N7O9Gwu/0

View file

@ -1,12 +1,14 @@
# z shell configuration
OSICON="?"
#
# prompt
#
# set prompt icon
# set icon
if [ -e /System ]; then
OSICON=""
eval "$(/opt/homebrew/bin/brew shellenv)"
else
elif [ -f /etc/os-release ]; then
. /etc/os-release &> /dev/null
if [ "$ID" = "nixos" ]; then
@ -18,21 +20,20 @@ else
elif [ "$ID" = "arch" ]; then
OSICON=""
fi
else
OSICON="$"
fi
# set prompt colours
HOSTNAME="$(hostname)"
if [ -f ~/.cache/zsh_colours.sh ]; then
source ~/.cache/zsh_colours.sh
else
PRIMARY_COLOUR="{blue}"
SECONDARY_COLOUR="{red}"
SECONDARY_COLOUR="{yellow}"
TEXT_COLOUR="{black}"
fi
PROMPT="%F$PRIMARY_COLOUR%~ %F$SECONDARY_COLOUR$OSICON %k%F$TEXT_COLOUR"
RPROMPT=""
bindkey -e
@ -41,13 +42,13 @@ zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
# hist
#
# history
#
HISTFILE="$HOME/.local/share/zsh_hist"
HISTSIZE=10000000
SAVEHIST=$HISTSIZE
HOMEBREW_NO_AUTO_UPDATE=1
setopt appendhistory
setopt sharehistory
setopt hist_save_no_dups
@ -55,13 +56,19 @@ setopt hist_ignore_all_dups
setopt hist_find_no_dups
setopt hist_ignore_space
#
# shell alias
#
alias ls="ls -h --color=auto"
alias la="ls -ah --color=auto"
alias ll="ls -ahl --color=auto"
alias cat="bat"
alias rm="trash"
alias v="nvim"
alias vi="nvim"
alias vim="nvim"
alias ssh="TERM=xterm-256color ssh" # fix ssh not recognising terminal and remote shell being somewhat broken
alias tmux="tmux -f $HOME/.config/tmux/tmux.conf" # needed for osx systems for some reason
@ -72,12 +79,17 @@ export PATH="$PATH:$GOPATH/bin"
export EDITOR="nvim"
# plugins
#
plugindir="$HOME/.local/share/zsh_plug"
func plugInstall() {
# clones a repo and then sources it.
# first arg is git url, second is source
# location
if [ ! command -v "git" &> /dev/null ]; then
exit 1
fi
foldername=$(basename $1)
clonepath="$plugindir/$foldername"
sourcefile="$clonepath/$2"