Zsh Advanced
Advanced Zsh features and customization.
Keyboard Shortcuts
Navigation
Ctrl + A // beginning of line
Ctrl + E // end of line
Ctrl + U // delete line
Ctrl + W // delete word
History
Ctrl + R // search history
!! // repeat last command
!$ // last argument
History Management
Search history
history
history | grep search
Run from history
!123 // run command 123
!git // last git command
History settings (~/.zshrc)
HISTSIZE=10000
SAVEHIST=10000
Custom Prompts
Simple custom prompt
PROMPT=%n@%m %~ $
With git branch
PROMPT=%F{cyan}%n%f at %F{yellow}%m%f in %F{green}%~%f $(git_prompt_info)
Prompt variables
%n // username
%m // hostname
%~ // current directory
%F{color} // color
Environment Variables
Set variable
export MY_VAR=value
Add to PATH
export PATH=$HOME/bin:$PATH
Load env from file
source .env
Show all variables
printenv