Pretty, minimal, one-line, fast ZSH prompt
After having used prompt pure for about a year, I felt that a two-line prompt was not for me. Also not utilizing the right side of the terminal seemed a missed opportunity. Still there is much to like: the elapsed time of a process, the coloring of the prompt if the exit code of the process isn't 0, git integration. So I took "pure", mixed in my ideas of what a prompt should look like and came up with "lean" - a 1 line prompt that stays out of your face.
So lean is an evolution of pure, with the following changes:
PROMPT_LEAN_TMUX=""prior to loading this plugin (or prior to sourcing
zgen, etc.).
PROMPT_LEAN_ABBR_METHODto choose the one you like the most (default is 'truncate').
PROMPT_LEAN_LEFTand
PROMPT_LEAN_RIGHTto allow customization of the left and/or right side of the prompt.
PROMPT_LEAN_VIMODEand
PROMPT_LEAN_VIMODE_FORMATvariables.
PROMPT_LEAN_VIMODE_FORMATdefaults to
"%F{red}[NORMAL]%f"
PROMPT_LEAN_COLOR1and
PROMPT_LEAN_COLOR2
PROMPT_LEAN_NOTITLEto customize when the title should not be display. Useful for terminals can not show title properly, for example terminals under Emacs (already considered by default). Write your own conditions for this variable and make sure it is 1 when you don't want title.
When lean starts, only 2 characters show on the screen '%' on the left and '~' on the right. All other info is omitted (like the user and system you are on), and shown only when needed.
If you use zgen you can add the following to your
~/.zshrc:
zgen load miekg/lean
and force reload with
zgen reset && source ~/.zshrc.
Note you must have the option PROMPT_SUBST set, see zshoptions(1).
If you use prezto you should do the following:
cd $ZPREZTODIR && git clone --recurse-submodules https://github.com/belak/prezto-contrib contrib
Then in
~/.zpreztorcadd
contrib-promptto module load list and select
leanas a theme: ``` zstyle ':prezto:load' pmodule \ ... \ 'contrib-prompt' \ 'prompt' \ ...
zstyle ':prezto:module:prompt' theme 'lean' ```
PROMPT_LEAN_LEFTand
PROMPT_LEAN_RIGHTshould be customized in
~/.zshrc. The rest variables should be customized in
~/.zshenv.
If you make any changes please run
make testto ensure the (little) test suite is succesfull.