61 lines
2.2 KiB
Bash
61 lines
2.2 KiB
Bash
# The mesh's block (module zsh, novox/hq ADR 0204): the defaults every machine shares, and the code
|
|
# other modules contribute in three slots. It is replaced at every push. Everything below it is
|
|
# yours, kept as you wrote it, and runs after it, so your lines win.
|
|
${shell:zsh:first}
|
|
# History, kept across sessions and shared between open shells. Without these zsh saves none:
|
|
# SAVEHIST defaults to 0 (novox/hq to-be 41, found on review 2026-10-04).
|
|
HISTFILE="$HOME/.zsh_history"
|
|
HISTSIZE=100000
|
|
SAVEHIST=100000
|
|
setopt EXTENDED_HISTORY SHARE_HISTORY HIST_IGNORE_DUPS HIST_IGNORE_SPACE HIST_REDUCE_BLANKS
|
|
|
|
# The completion system. Nothing initialised it, so only zsh's basic completion ran. Its cache
|
|
# goes under ~/.cache rather than beside ~/.zshrc.
|
|
[[ -d "$HOME/.cache/zsh" ]] || mkdir -p "$HOME/.cache/zsh"
|
|
autoload -Uz compinit && compinit -d "$HOME/.cache/zsh/zcompdump"
|
|
zstyle ':completion:*' menu select
|
|
|
|
# Terminal title: host, directory, git branch
|
|
function set_terminal_title() {
|
|
local git_branch=""
|
|
if git rev-parse --is-inside-work-tree &>/dev/null; then
|
|
git_branch=" ($(git branch --show-current 2>/dev/null))"
|
|
fi
|
|
print -Pn "\e]2;%m: %~${git_branch}\a"
|
|
}
|
|
precmd_functions+=(set_terminal_title)
|
|
|
|
# Keybindings
|
|
bindkey "^[[H" beginning-of-line # Home
|
|
bindkey "^[OH" beginning-of-line # Home
|
|
bindkey "^A" beginning-of-line # Ctrl + A
|
|
bindkey "^[[F" end-of-line # End
|
|
bindkey "^[OF" end-of-line # End
|
|
bindkey "^E" end-of-line # Ctrl + E
|
|
bindkey "^[[3~" delete-char # Del
|
|
|
|
# Colour support of ls and friends
|
|
if [ -x /usr/bin/dircolors ]; then
|
|
test -r $HOME/.dircolors && eval "$(dircolors -b $HOME/.dircolors)" || eval "$(dircolors -b)"
|
|
alias ls='ls --color=auto'
|
|
alias dir='dir --color=auto'
|
|
alias vdir='vdir --color=auto'
|
|
alias grep='grep --color=auto'
|
|
alias fgrep='fgrep --color=auto'
|
|
alias egrep='egrep --color=auto'
|
|
fi
|
|
alias ll='ls -alhF'
|
|
alias la='ls -Ah'
|
|
alias l='ls -CFh'
|
|
|
|
# A throwaway container, and what takes the space under a directory
|
|
alias drun='docker run -it --rm'
|
|
disksize() {
|
|
du -h --max-depth=1 "${1:-.}" | sort -h
|
|
}
|
|
sudo-disksize() {
|
|
sudo du -h --max-depth=1 "${1:-.}" | sort -h
|
|
}
|
|
|
|
${shell:zsh:normal}${shell:zsh:last}
|