useful_linux_scripts/zshrc.zshrc
2026-01-31 09:46:35 +00:00

82 lines
2.1 KiB
Bash

alias pyviz='source ~/pyviz/bin/activate'
export STM32_PRG_PATH=/Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/MacOs/bin
# ------------------------------------------------------------
# Basic environment
# ------------------------------------------------------------
export EDITOR=vi
export PAGER=less
export LANG=en_GB.UTF-8
# ------------------------------------------------------------
# History (zsh-native, better than bash)
# ------------------------------------------------------------
HISTFILE=~/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_REDUCE_BLANKS
# ------------------------------------------------------------
# Completion system
# ------------------------------------------------------------
autoload -Uz compinit
compinit
# ------------------------------------------------------------
# Git branch helper (explicit NO GIT REPO)
# ------------------------------------------------------------
# ------------------------------------------------------------
# Aliases (bash-compatible)
# ------------------------------------------------------------
alias ll='ls -lh'
alias la='ls -A'
alias l='ls -CF'
alias gs='git status'
alias gd='git diff'
# ------------------------------------------------------------
# Path additions (example)
# ------------------------------------------------------------
export PATH="$HOME/bin:$PATH"
# ------------------------------------------------------------
# Git branch helper (branch only, explicit NO GIT REPO)
# ------------------------------------------------------------
git_branch() {
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
git symbolic-ref --short HEAD 2>/dev/null || echo "DETACHED"
else
echo "NO GIT REPO"
fi
}
# ------------------------------------------------------------
# Prompt with colours
# ------------------------------------------------------------
setopt PROMPT_SUBST
setopt NO_NOMATCH
# Colours:
# %F{colour} ... %f = foreground colour on/off
PROMPT='%n@%F{208}%m%f %F{green}%~%f [%F{red}$(git_branch)%f] %# '