Nerd prompt for bash/ksh/zsh (mksh/ash)
Light version of nerdps1 local nerd prompt w/o psudo/pssh (as thefly is doing plugin teleportation)
For better experience, install a Nerd font on your system/console (Windows console / Windows terminal / putty / git-bash / CmdEr / iTerm2 / Terminator / MobaXterm / VScode terminal / Pycharm terminal...):
Consolas NF
Nerd Fonts
on Unix, copy to ~/.fonts
and run fc-cache -fv
then relaunch your terminal and set the font
-
You can install using a plugin manager like sheldon / zgenom ... : plugin joknarf/nerdp
-
Or you can activate the nerdp prompt directly using:
$ . <(curl -s https://raw.githubusercontent.com/joknarf/nerdp/main/nerdp)
-
Or you can get your local copy using:
$ curl -sL -o ~/nerdp https://raw.githubusercontent.com/joknarf/nerdp/main/nerdp
then source it in your profile/rcfile:
. ~/nerdp
Following information displayed:
- exit code if command returns code is not 0
- elapse time during command if command lasts more than 1s (bash / zsh / ksh >2012)
- user@hostname
- current working directory
- git branch if in git directory (colorized according to git status)
- python VIRTUAL_ENV and other variables values with name in
ps1_info
variable - filesystem usage check of
ps1_fslist
(default "/ /tmp") according tops1_fslimits
(default "95 100") - 1min cpu load (colorized default
ps1_loadlimits
"10 20") - Available memory (colorized default
ps1_memlimits
"300 100" MB) - Time
set ps1_style
variable to available styles in your .nerdrc
You can test using ps1_style
function:
If your terminal does not manage correctly nerd font symbols, you may switch to more commonly supported powerline font symbols, or even disable the segment separator symbols.
You can use : ps1_display
function/var to switch prompt display symbol characters:
$ ps1_display -h
usage: ps1_display <option>
<option>: nerdicons, nerd, powerline, nofont, ascii
You can add informations on the prompt using ps1_info variable:
ps1_info="MYVAR MYVAR2..."
: will display content of variablesps1_info="(myfunc) (myfunc2)"
: will display output of functions myfunc myfunc2
You can add custom colorized segment defining ps1_addon()
function:
ps1_addon() { pgrep rsyslogd >/dev/null || echo 'red:syslog'; }
output format of function:<bgcolor>[/<fgcolor>/<sepcolor>]:<message>[|message]
empty output discards the segment.
Changing prompt powerline, ps1_powerline variable represents the prompt:
- segment setting :
symbol/bgcolor/fgcolor/sepcolor:function
- function called is
ps1_function
(ps1_ prefixed) - colors :
black red green yellow blue magenta cyan white
, prefixl
for light color - symbols :
< > ( )
- when color is set to auto, the function output must be
<color>:<text>
else only<text>
- function called is
- right alignment separator :
|
ps1_powerline="(/auto:exit_status (/blue:userhost )/auto:git_branch )/lblack:cwd > | (/lblue/black/blue:info (/auto:freemem (/blue:time )"
ps1_powerline="auto:exit_status blue:userhost >/auto:git_branch >/lblack:cwd > | </lblue/black/blue:info </auto:freemem </blue:time"
used terminal colors in example:
{
"name": "NerdPS1",
"background": "#000000",
"foreground": "#D3D7CF",
"black": "#000000",
"blue": "#2760AA",
"cyan": "#06989A",
"green": "#088A5B",
"purple": "#4c3d80",
"red": "#BA1611",
"white": "#D3D7CF",
"yellow": "#CF8700",
"brightBlack": "#243C4F",
"brightBlue": "#729FCF",
"brightCyan": "#34E2E2",
"brightGreen": "#59c566",
"brightPurple": "#AD7FA8",
"brightRed": "#EF2929",
"brightWhite": "#EEEEEC",
"brightYellow": "#FCE94F"
}