Why switch?
At the beginning of the contact oh-my-zsh is honestly just because of its very beautiful theme, such as powerlevel10k theme; this is really very “Sexy” for a person who is always on the terminal to exercise the left and right hand. Later, with the gradual in-depth use, oh-my-zsh deeply integrated with this integrated plug-in solution and so on did bring great convenience; for example, simple command line search, git, docker, kuebctl and other kinds of plug-ins for quick tips and so on.
However, after using the terminal for a long time, I suddenly realized that the fancy terminal themes like powerlevel10k didn’t suit me; when I gradually switched back to some simple themes and jumped left and right in the directories of big projects like Kubernetes, oh-my-zsh’s extremely slow response time started to show its disadvantages; just in the Git repository directory of Kubernetes, holding down the enter key on the terminal could cause animation…
So when you can’t stand the terminal’s responsiveness, I think it’s time to switch to another one.
Prezto Introduction
Prezto has been rewritten by the author who wanted to achieve a good zsh setup by ensuring all the scripts are making use of zsh syntax. It has a few more steps to install but should only take a few minutes extra. —- John Stevenson
Prezto Installation
Prezto installation can be done as described in the repository documentation
zsh installation
First make sure that zsh is already installed, if not, you need to install it through the package manager of the corresponding system:
Clone Repository
There are two general cases of cloning in the repository, one default cloning to the "${ZDOTDIR:-$HOME}/.zprezto"
directory (standard installation):
|
|
Another advanced user may use the XDG_CONFIG_HOME
configuration:
|
|
Create a soft connection
The Prezto installation is easy to customize, after the main repository is cloned, you just need to softlink the relevant initialization load configuration to the $HOME
directory:
However, it should be noted that the above command may have compatibility issues when written directly in some shell scripts, in which case it can be simply handled directly by the command:
At this point, the installation of Prezto is complete and you can log back into the shell to see the results.
Detail adjustment
Change theme
By default Prezto uses the sorin theme, if you are not satisfied with the default theme you can switch it by using the prompt
command:
grep highlight
By default Prezto will highlight the results when executing grep, which may be distracting on some terminal topics:
The grep highlighting is turned on in the utility plugin and can be turned off by adding the following configuration to ~/.zpreztorc
:
|
|
Command, syntax highlighting
Prezto provides various syntax-highlighting configurations via the syntax-highlighting plugin, enable more auto-highlighting by uncommenting the following configurations:
Note that the default root highlighting is on and all commands executed by the root user will be highlighted, which may make it difficult to see the commands entered in the theme color scheme.
Custom command highlighting
After enabling pattern
highlighting in the syntax-highlighting
plugin, you can set some custom command highlighting configurations, such as rm -rf
, with the following configuration:
History Command Search
oh-my-zsh is a very useful feature to quickly search the history of commands by using the up and down arrow keys. After switching to Perzto, you will find that the up and down arrow search becomes a fuzzy match for all commands; for example, typing vim
and paging up and down will match the history of commands with the word vim
in the middle of the command:
To solve this problem, switch the zsh-history-substring-search
plugin dependency to the master branch and add the HISTORY_SUBSTRING_SEARCH_PREFIXED
variable to the configuration:
There is also a problem in the history search that the same command will be matched more than once if it appears more than once, so to solve this problem you need to add the following variables:
|
|
Other plug-ins
For more available plugins please refer to the documentation for each plugin in the modules directory, and how to enable and configure them.
For your own convenience, I created a quick initialization script under my init project, and these adjustments above will be done automatically:
|
|