From 8d0674865d9c50bece444be7a76f7506307c2b68 Mon Sep 17 00:00:00 2001 From: Trysdyn Black Date: Thu, 1 Apr 2021 16:50:06 -0700 Subject: [PATCH] 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 --- .zshrc | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.zshrc b/.zshrc index 4eed8dd..82506f7 100644 --- a/.zshrc +++ b/.zshrc @@ -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}'