https://github.com/joknarf/nerdp
Nerd powerline prompt for bash/ksh/zsh
https://github.com/joknarf/nerdp
Last synced: 9 months ago
JSON representation
Nerd powerline prompt for bash/ksh/zsh
- Host: GitHub
- URL: https://github.com/joknarf/nerdp
- Owner: joknarf
- License: mit
- Created: 2024-09-22T11:10:29.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-29T21:09:21.000Z (about 1 year ago)
- Last Synced: 2025-01-07T15:43:03.782Z (11 months ago)
- Size: 52.7 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-zsh-plugins - nerdp - Nerd powerline-style prompt. Requires a [Nerd Font](https://github.com/ryanoasis/nerd-fonts). Includes decorators for `git` status, username@hostname, current directory, Python virtualenv, filesystem usage check, 1 minute CPU load, available memory and the time. (Themes / ZSH on Windows)
- fucking-awesome-zsh-plugins - nerdp - Nerd powerline-style prompt. Requires a <b><code> 60453⭐</code></b> <b><code> 3832🍴</code></b> [Nerd Font](https://github.com/ryanoasis/nerd-fonts)). Includes decorators for `git` status, username@hostname, current directory, Python virtualenv, filesystem usage check, 1 minute CPU load, available memory and the time. (Themes / ZSH on Windows)
README
# nerdp
Nerd prompt for bash/ksh/zsh (mksh/ash)
Light version of [nerdps1](https://github.com/joknarf/nerdps1) local nerd prompt w/o psudo/pssh (as [thefly](https://github.com/joknarf/thefly) is doing plugin teleportation)
## Font for prompt
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](https://github.com/wclr/my-nerd-fonts/raw/master/Consolas%20NF/Consolas%20Nerd%20Font%20Complete%20Mono%20Windows%20Compatible.ttf)
[Nerd Fonts](https://www.nerdfonts.com/)
on Unix, copy to `~/.fonts` and run `fc-cache -fv` then relaunch your terminal and set the font
## Installation
* 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 to `ps1_fslimits` (default "95 100")
* 1min cpu load (colorized default `ps1_loadlimits` "10 20")
* Available memory (colorized default `ps1_memlimits` "300 100" MB)
* Time
## choose your style
set `ps1_style` variable to available styles in your .nerdrc
You can test using `ps1_style` function:

## Font rendering
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
: nerdicons, nerd, powerline, nofont, ascii
```
## Customizing prompt
You can add informations on the prompt using ps1_info variable:
* `ps1_info="MYVAR MYVAR2..."` : will display content of variables
* `ps1_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:
`[//]:[|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`, prefix `l` for light color
* symbols : `< > ( )`
* when color is set to auto, the function output must be `:` else only ``
* 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 > |