Set up OS-specific zsh configs

- Move keybinds into a match for Darwin systems
- Move BSD-isms into the same match, split off Linux-isms for binutils
  into a match for linux systems
- Add a comment or two for some directives I did not immediately
  remember what they did, so I'll remember next time more easily
This commit is contained in:
Trysdyn Black 2021-04-01 16:50:06 -07:00
parent 098d12d332
commit 8d0674865d

31
.zshrc
View file

@ -1,5 +1,6 @@
export LANG=en_US.UTF-8
# Start keychain only on my personal system
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
SESSION_TYPE=ssh
else
@ -15,11 +16,6 @@ fi
source ~/.p10k/powerlevel10k.zsh-theme
# Make extra keys in MacOSX behave like expected
bindkey "^[[H" beginning-of-line # HOME
bindkey "^[[F" end-of-line # END
bindkey "^[[3~" delete-char # DEL
# Print user@host into title so terminal tabs are correct
# Despite being called precmd() this executes after process exits, before prompt
precmd() { echo -ne "\033]0;${USER}@${HOST}\007" }
@ -34,17 +30,30 @@ if [[ -a /usr/bin/most ]]; then
export PAGER=most
fi
# OS-specific directives
case "$OSTYPE" in
darwin*)
bindkey "^[[H" beginning-of-line # HOME
bindkey "^[[F" end-of-line # END
bindkey "^[[3~" delete-char # DEL
alias ls='ls -G'
;;
linux*)
alias ls='ls --color=auto'
alias diff='diff --color=auto'
;;
esac
# Global aliases
alias ct="clear && task"
alias tt="taskwarrior-tui"
alias grep='grep -EIs --color=auto --exclude-dir=.git'
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory
alias ct="clear && task"
alias tt="taskwarrior-tui"
alias ls='ls --color=auto'
alias grep='grep -EIs --color=auto --exclude-dir=.git'
alias diff='diff --color=auto'
# Case-insensetive tab completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'