Arch
paru -S --needed --skipreview --noconfirm zsh fzf fd tree eza zoxide neovim wl-clipboard trash-cli github-cli keychain fnm-bin ttf-meslo-nerd
git clone --recurse-submodules https://github.com/drowning-cat/zsh "${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
ln -sf "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/zshenv" "$HOME/.zshenv"
chsh -s $(which)
Ubuntu
sudo apt update
sudo apt install -y zsh fzf fd-find tree eza zoxide neovim wl-clipboard trash-cli gh keychain
curl -fsSL https://fnm.vercel.app/install | bash
git clone --recurse-submodules https://github.com/drowning-cat/zsh "${XDG_CONFIG_HOME:-$HOME/.config}/zsh"
ln -sf "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/zshenv" "$HOME/.zshenv"
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/fonts"
cp -r "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/other/fonts/MesloLGS NF" "${XDG_DATA_HOME:-$HOME/.local/share}/fonts/MesloLGS NF"
fc-cache -f
chsh -s $(which)
Click to expand
paru -S --needed --skipreview --noconfirm\
zsh fzf fd tree eza zoxide neovim wl-clipboard trash-cli github-cli keychain fnm-bin ttf-meslo-nerd
or using pacman
sudo pacman -S zsh fzf fd tree eza zoxide neovim wl-clipboard trash-cli github-cli keychain
Click to expand
sudo apt install zsh fzf fd-find tree eza zoxide neovim wl-clipboard trash-cli gh keychain
git clone --recurse-submodules https://github.com/drowning-cat/zsh "${XDG_CONFIG_HOME:-$HOME/.config}/zsh" &&\
ln -sf "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/zshenv" "$HOME/.zshenv"
Skip this step if ttf-meslo-nerd
is installed (Arch repository: Extra).
mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/fonts" &&\
cp -r "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/other/fonts/MesloLGS NF" "${XDG_DATA_HOME:-$HOME/.local/share}/fonts/MesloLGS NF" &&\
fc-cache -f
[!CAUTION] Do not forget to set
MesloLGS NF
in your terminal of choice.
Any Nerd font is supported.
If necessary, migrate your Bash configuration files to zsh. You can read this arcticle: The right way to migrate your bash_profile to zsh.
sudo chsh --shell $(which) $USER
sudo reboot
Click to expand
Fzf is a general-purpose command-line fuzzy finder.
Trigger search:
vim **
+ TAB
Key Combination | Description |
---|---|
CTRL + t |
Fuzzy find all files and subdirectories of the working directory, and output the selection to STDOUT. |
ALT + c |
Fuzzy find all subdirectories of the working directory, and run the command “cd” with the output as argument. |
CTRL + r |
Fuzzy find through your shell history, and output the selection to STDOUT. |
Meta characters table (search syntax):
Name | Example |
---|---|
End of line | .tex$ |
Beginning of line | ^./explorer |
The OR operator | .xml$ | .yml$ | .tex$ |
The AND operator | .tex$ /headers/ |
The NOT operator | .yml$ | .xml$ | .tex$ !/headers/ |
Exact Match | 'ti |
~/.config/zsh/plugins/fzf.zsh
File itself
~/.config/zsh/zshrc
41: source "$ZFOLDER/plugins/fzf.zsh"
Click to expand
fd
is a program to find entries in your filesystem. It is a simple, fast and user-friendly alternative tofind
. While it does not aim to support all offind
powerful functionality, it provides sensible (opinionated) defaults for a majority of use cases. Used by fzf.
~/.config/zsh/plugins/fzf.zsh
1: @fd() {
2: print -rn "fd . --hidden --exclude .git $@ | sed 's|^$HOME|~|;s|^./||'"
3: }
Click to expand
Recursive directory listing program that produces a depth-indented listing of files.
~/.config/zsh/plugins/fzf.zsh
35: export FZF_CTRL_T_OPTS="--preview '[[ -d {} ]] && tree -C {} || bat --style numbers --color always --line-range :500 {}'"
36: export FZF_ALT_C_OPTS="--preview 'tree -C {}'"
37: export FZF_COMPLETION_DIR_COMMANDS="cd pushd rmdir tree ls"
Click to expand
eza
is a modern, maintained replacement for the venerable file-listing command-line programls
. It uses colours to distinguish file types and metadata. It knows about symlinks, extended attributes, and Git. And it’s small, fast, and just one single binary. It is a maintained fork of exa.
~/.config/zsh/zshrc
60: alias ls='eza --icons auto'
61: alias ll='eza --icons auto --long --all'
62: alias lt='eza --icons auto --tree --level=5'
Click to expand
zoxide
is a smartercd
command, inspired byz
and autojump. It remembers which directories you use most frequently, so you can "jump" to them in just a few keystrokes.zoxide
works on all major shells.
~/.config/zsh/zshrc
52: eval "$(zoxide init zsh)"
Click to expand
Fast Node Manager - faster alternative to nvm.
~/.config/zsh/zshrc
49: path+=("$HOME/.local/share/fnm")
...
51: eval "$(fnm env --use-on-cd)"
Click to expand
github-cli
is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code.
~/.config/zsh/zshrc
53: eval "$(gh completion -s zsh)"
Click to expand
Keychain helps you to manage
SSH
andGPG
keys in a convenient and secure manner. It acts as a frontend tossh-agent
andssh-add
, but allows you to easily have one long runningssh-agent
process per system.
~/.config/zsh/zprofile
1: eval "$(keychain --eval --quiet --timeout 60)"
Click to expand
Modern version of
vim
.
~/.config/zsh/zshrc
4: export EDITOR='nvim'
...
67: alias v='nvim'; alias vi='v'; alias vim='v'
68: alias svim='sudo -Es nvim'; alias sv='svim'
Click to expand
Chezmoi helps you manage your personal configuration files (dotfiles, like ~/.gitconfig) across multiple machines.
~/.config/zsh/zshrc
65: alias ch='chezmoi'
Click to expand
Command-line copy/paste utilities for Wayland.
~/.config/zsh/zshrc
66: alias wl='wl-copy'
Click to expand
Alternative to
rm
that uses trash can.
~/.config/zsh/zshrc
69: alias t='trash'
- File
~/.zshenv
(symlink to$XDG_CONFIG_HOME/zsh/zshenv
) is the entry point to the configuration. - zsh config files are placed in
$XDG_CONFIG_HOME/zsh/.zdotdir/
(zsh configuration files in the home directory are also sourced):.zprofile
.zshrc
.zlogin
.zlogout
- zsh history file is located in
$XDG_STATE_HOME/.zsh_history
. - zsh cache files are located in
$XDG_CACHE_HOME
.
XDG directory | Default path |
---|---|
$XDG_CONFIG_HOME |
~/.config |
$XDG_STATE_HOME |
~/.local/state |
XDG_CACHE_HOME |
~/.cache |
git submodule update --recursive --remote
Click to expand
rm -rf "${ZFOLDER:-${XDG_CONFIG_HOME:-$HOME/.config}/zsh}/"
rm "$HOME/.zshenv"
rm .zprofile
rm .zshrc
rm .zlogin
rm .zlogout
rm "${HISTFILE:-${XDG_STATE_HOME:-$HOME/.local/state}/.zsh_history}"
rm -rf "$HOME/.local/share/fonts/MesloLGS NF/"
for pathname in \
"${ZCOMPCACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/.zcompcache}" \
"${ZCOMPDUMP:-${XDG_CACHE_HOME:-$HOME/.cache}/.zcompdump}" \
"${XDG_CACHE_HOME:-$HOME/.cache}/p10k-"*; do
rm -rf "$pathname"
done
paru -Rns zsh fzf fd tree eza zoxide neovim wl-clipboard trash-cli github-cli keychain fnm
or using pacman
sudo pacman -Rns zsh fzf fd tree eza zoxide neovim wl-clipboard trash-cli github-cli keychain
Remove fnm manually:
rm -rf ".fnm/"
Click to expand
sudo apt-get purge --auto-remove zsh fzf fd-find tree eza zoxide neovim wl-clipboard trash-cli gh keychain
Remove fnm manually:
rm -rf ".fnm/"
Key Combination | Command | Description |
---|---|---|
Ctrl + l , F1 |
clear-screen-and-scrollback |
Clears screen and scrollback |
Ctrl + z |
fancy-ctrl-z |
Collapse/expand terminal |
Ctrl + Down |
subdir.prev |
Moves to the parent subdirectory |
Ctrl + Up |
subdir.next |
Moves back to the child subdirectory |
Right |
smart-partial-accept-completion |
Partially accepts completion |
Ctrl + Right , Ctrl + Space |
autosuggest-accept |
Accepts autosuggestion |
Ctrl + y |
autosuggest-execute |
Executes the autosuggestion |
Ctrl + n |
expand-or-complete |
Expands or completes the command |
Ctrl + p |
reverse-menu-complete |
Completes in reverse order through options |
Alias | Command |
---|---|
.. , ... , .... , ..1 , ..2 , ..3 etc. |
subdir.prev |
ls |
eza --icons |
ll |
eza --icons --long --all |
lt |
eza --icons --tree --level=5 |
- |
cd - |
ch |
chezmoi |
wl |
wl-copy |
t |
trash |
q |
exit |
v , vi , vim |
nvim |
svim , sv |
sudo -Es nvim |
lvim , lv |
vim -c "normal '\''0" (last opened file) |
g |
git , ... |
The full list of aliases can be found in $ZFOLDER/zalias.zsh
.