ZSH Config


zsh

Apple changed the default shell to zsh from bash for quite sometime. let’s customize it.People often use OH MY ZSH, I used it for a year but it seems bloated to me. Below is my simple and effective configuration.

Changing the shell prompt to Starship

add_newline = false

[character]
success_symbol = "[➜](bold green)"

# Clear visibility for exit codes
[status]
style = "bg:red"
symbol = "💣 "
format = '[\[$symbol$status\]]($style) '
disabled = false

# These symbols will only show when battery levels are 20% or less
[battery]
charging_symbol = "⚡️ "
discharging_symbol = "💀 "

[[battery.display]]  # "bold red" style when capacity is between 0% and 20%
threshold = 40
style = "bold red"

#[python]
#python_binary = "python3"

[swift]
symbol = "ﯣ (orange)"
eval "$(starship init zsh)"

Key Bindings Changes

export EDITOR=nvim
bindkey '^X^e' edit-command-line
bindkey -e
bindkey | less

reference: https://matija.suklje.name/zsh-vi-and-emacs-modes

ZSH autosuggestion

source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh

Z Script Integration

. /Users/sample/Scripts/Production/z.sh

History override

HIST_STAMPS="dd.mm.yyyy"
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=100000

FZF Integration

[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

NeoVim as Manpager [Optional]

export MANPAGER="nvim -c 'set ft=man' -"

Alias

alias zshcnf="nvim ~/.zshrc"
alias zshsrc="source ~/.zshrc"