Options
Command Prompt
Completion
Change Directory
Auto cd
Named Directories
Directory Stack
Aliases
Command History
Key Bindings
Shortcuts
Startup and Termination
Update List of Commands
References
zsh
options are case insensitive and underscores are ignored. An option name may be inverted by preceding it with ‘no’, so setopt No_Beep
is equivalent to unsetopt beep
. [Manual]
autoload -Uz promptinit
promptinit
-U
: suppress alias expansion when the function is loaded-z
: mark the function to be autoloaded using the zsh style$ prompt adam1
adam1
prompt scheme$ prompt -l
$ whence -f promptinit
To load completion:
autoload -Uz compinit
compinit
zstyle ':completion:*' menu select=3
zstyle ':completion:*:correct:*' insert-unambiguous true
setopt auto_cd
cd
to that directoryFrequently used directories can be abbreviated.
hash -d ff=$HOME/soft/firefox/
ff
for directory $HOME/soft/firefox/
$ cd ~ff
$ hash -Ld
setopt auto_pushd
cd dir-name
results in adding dir-name
onto the directory stacksetopt pushd_ignore_dups
dirs -v
pushd dir-name
dir-name
to the stackpopd +2
Frequently used commands can be abbreviated.
alias ll='ls -al --color --group-directories-first'
ll
$ alias
setopt share_history
setopt hist_ignore_all_dups
setopt hist_ignore_space
setopt hist_reduce_blanks
HISTSIZE=2000
SAVEHIST=2000
HISTFILE=$HOME/.zsh_history
bindkey
command manipulates keymaps and key bindings.
bindkey "^[[1;5D" backward-word
Ctrl
+←: move to the beginning of the previous wordbindkey "^[[1;5C" forward-word
Ctrl
+→: move to the beginning of the next wordread
shows what key is typed.
User's Guide: All the startup files
Order of initialization files:
/etc/zsh/zshenv
$HOME/.zshenv
/etc/zsh/zprofile
$HOME/.zprofile
/etc/zsh/zshrc
$HOME/.zshrc
/etc/zsh/zlogin
$HOME/.zlogin
Termination:
$HOME/.zlogout
/etc/zsh/zlogout
zsh
does not automatically recognize new commands after installation of new packages.
$ rehash