yushakuAugust 22, 2023
Zsh (Z shell) is a command line shell (command processor) for Unix and Linux systems. It is one of the most popular command-line shells available today, offering more convenient features than Bash, the default shell of most Unix and Linux systems.
we will config z-shell more moderm and more powerfull
# update system sudo apt update && sudo apt upgrade # install zsh sudo apt install zsh -y
After the installation finishes, check if it has been installed correctly by checking the program version. Run the following command:
zsh --version
Set Zsh as Default Shell
# Check which shell is the default one in your system: echo $SHELL # Use the chsh (change shell) command to change the default login shell chsh -s $(which zsh)
Oh My Zsh is an open-source framework that adds features and more functionality to the Z Shell. It is designed to enhance the command-line experience and make it more enjoyable and productive. Oh My Zsh provides a collection of themes, plugins, and scripts that can be easily installed and managed.
# Install Oh My Zsh sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
After the installation completes, the installer prompts you to set Zsh as your default shell. Type y if you want to set Zsh as the default shell or n if you want to keep the default one.
i will choose zap - minimal zsh plugin manager
# install zap zsh <(curl -s https://raw.githubusercontent.com/zap-zsh/zap/master/install.zsh) --branch release-v1
and affter that it should be good to add this bash script to your .zshrc. to check if zap installed it will load all plugins and configuration else it will install zap.
[ -f "$HOME/.local/share/zap/zap.zsh" ] && source "$HOME/.local/share/zap/zap.zsh" || zsh <(curl -s https://raw.githubusercontent.com/zap-zsh/zap/master/install.zsh) --branch release-v1
and add funcking cool plugins for zsh
if [[ $(which plug) ]]; then plug "agkozak/zsh-z" plug "hlissner/zsh-autopair" plug "grigorii-zander/zsh-npm-scripts-autocomplete" plug "zdharma-continuum/fast-syntax-highlighting" plug "zsh-users/zsh-autosuggestions" plug "Aloxaf/fzf-tab" plug "romkatv/powerlevel10k" fi
Zsh-z is a command line tool that allows you to jump quickly to directories that you have visited frequently in the past, or recently
no need to use this command cd ./workspace/folder1/folder2/dotfile
just press z dotfile
and you in where you want to be.
A simple plugin that auto-closes, deletes and skips over matching delimiters in zsh intelligently.
This plugin shows autocomplete suggestions for npm
scripts from package.json
at current working directory. Works with npm
, yarn
and pnpm
.
syntax highlighting your command for more readable and prettier
Fish-like fast/unobtrusive autosuggestions for zsh. It suggests commands as you type based on history and completions.
Replace zsh's default completion selection menu with fzf!
fzf-tab ALSO needs fzf installed, otherwise it cannot work!
Powerlevel10k is a theme for Zsh. It emphasizes speed, flexibility and out-of-the-box experience.
bat
supports syntax highlighting for a large number of programming and markup languages then it help alot for preview in fzf search.
bat
communicates with git
to show modifications with respect to the index (see left side bar):
sudo install batcat
exa is a modern replacement for the venerable file-listing command-line program ls
that ships with Unix and Linux operating systems, giving it more features and better defaults. 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.
fd
is a program to find entries in your filesystem. It is a simple, fast and user-friendly alternative to find
. While it does not aim to support all of find
's powerful functionality, it provides sensible (opinionated) defaults for a majority of use cases.
sudo install fd-find
It's an interactive Unix filter for command-line that can be used with any list; files, command history, processes, hostnames, bookmarks, git commits, etc… with its Pros like:
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf ~/.fzf/install
With buildin command that really helpfull like
you can config fzf with preview
export FZF_DEFAULT_COMMAND='fdfind --type f --strip-cwd-prefix --hidden --follow --exclude .git' export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" export FZF_COMPLETION_TRIGGER='?' export FZF_DEFAULT_OPTS=" --preview-window 'right:55%' \ --bind 'ctrl-/:change-preview-window(down|right|hidden|)' \ --bind 'ctrl-u:preview-page-up' \ --bind 'ctrl-d:preview-page-down' \ --height 60%" export FZF_CTRL_T_OPTS=" --preview 'batcat --color=always --style=header,grid --line-range :300 {}'" export FZF_CTRL_R_OPTS=" --bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort' --header 'Press CTRL-Y to copy command into clipboard'" export FZF_ALT_C_OPTS="--preview 'exa --tree -L 2 --icons {}'" [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh ##>>> fzf-tab configuration -------------------------- zstyle ':fzf-tab:complete:nvim:*' fzf-preview 'batcat --color=always --italic-text=always $realpath' zstyle ':fzf-tab:complete:cp:*' fzf-preview 'batcat --color=always --italic-text=always $realpath' zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa -1a --colour-scale --icons --group-directories-first --color=always $realpath'
i hope this blog post can help you config satify terminal
you can check out my config at: https://github.com/yushaku/dotFile/blob/main/shell/zshrc