User Tools

Site Tools


zsh

Mostly copied from https://scriptingosx.com/2019/06/moving-to-zsh-part-3-shell-options/

Put into ~/.zshrc

  • Prompt:
PROMPT='%(?.%F{green}√.%F{red}?%?)%f %K{81}%B%~ %#%b%K{default} '
  • History:

(See also https://unix.stackexchange.com/a/111777/7286)

HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
setopt EXTENDED_HISTORY
SAVEHIST=5000
HISTSIZE=2000
# share history across multiple zsh sessions
setopt SHARE_HISTORY
# append to history
setopt APPEND_HISTORY
# adds commands as they are typed, not at shell exit
setopt INC_APPEND_HISTORY
# expire duplicates first
setopt HIST_EXPIRE_DUPS_FIRST 
# do not store duplications
setopt HIST_IGNORE_DUPS
#ignore duplicates when searching
setopt HIST_FIND_NO_DUPS
# removes blank lines from history
setopt HIST_REDUCE_BLANKS
alias history='fc -l -i 1'
  • case-insensitive globbing, and don't tab-complete all directly :
setopt NO_CASE_GLOB
setopt GLOB_COMPLETE
  • Allow comments in interactive shells
setopt interactive_comments
# or
set -k
# or 
echo "setopt INTERACTIVE_COMMENTS" >> ~/.zshrc
# or 
echo "setopt INTERACTIVE_COMMENTS" | sudo tee -a /etc/zshrc
  • fix Ctrl-U to delete left
echo 'bindkey \^U backward-kill-line' >> ~/.zshrc

Also try this? (https://superuser.com/questions/187639/zsh-not-hitting-profile) :

[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'
/docs/dokuwiki/data/pages/zsh.txt · Last modified: 2022-05-20 00:58:20 by mi