• Stars
    star
    154
  • Rank 234,458 (Top 5 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Pretty, minimal, one-line, fast ZSH prompt

About

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.

When lean starts, only 2 characters show on the screen '%' on the left and '~' on the right.

lean example gif

So lean is an evolution of pure, with the following changes:

  • Defaults to a very sparse setup, only showing information you need at the moment.
  • Comes with the perfect prompt character. Author went through the entire ASCII range to find it (and found it pretty quickly!)
  • Never displays your username (assuming you know who you are).
  • When tmux is active it shows a yellow 't' (I disabled the tmux bar, so this is some visual indication that tmux is active). If you don't want this indicator, you can always set PROMPT_LEAN_TMUX="" prior to loading this plugin (or prior to sourcing zgen, etc.).
  • Show remote host if logged in through SSH.
  • All in one line, most stuff in the right prompt, leaving the left prompt nice and clean
  • Shows background jobs (in the left prompt)
  • Show (dirty) git repos (can be disabled by setting PROMPT_LEAN_VCS to 0)
  • Shortens path if needed (longer then 70% of your screen). Two methods are provided: 'truncate' and 'shrink' (fish-style working directory). Set PROMPT_LEAN_ABBR_METHOD to choose the one you like the most (default is 'truncate'). Set PROMPT_LEAN_PWD to 0 to disable showing the path altogether.
  • Uses PROMPT_LEAN_LEFT and PROMPT_LEAN_RIGHT to allow customization of the left and/or right side of the prompt.
  • For a configurable insertmode indicator, set the PROMPT_LEAN_VIMODE and PROMPT_LEAN_VIMODE_FORMAT variables. PROMPT_LEAN_VIMODE_FORMAT defaults to "%F{red}[NORMAL]%f"
  • Configurable colors to match your preferred scheme, by setting PROMPT_LEAN_COLOR1 and PROMPT_LEAN_COLOR2
  • Use PROMPT_LEAN_NOTITLE to customize when the title should not be displayed. Useful for terminals that can not show title properly.
  • Use PROMPT_LEAN_VCS and PROMPT_LEAN_PWD to disable showing VCS info or the current working directory.

Installation

zgen

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).

prezto

If you use prezto you should do the following:

cd $ZPREZTODIR && git clone --recurse-submodules https://github.com/belak/prezto-contrib contrib

Then in ~/.zpreztorc add contrib-prompt to module load list and select lean as a theme:

zstyle ':prezto:load' pmodule \
  ... \
  'contrib-prompt' \
  'prompt' \
  ...

zstyle ':prezto:module:prompt' theme 'lean'

PROMPT_LEAN_LEFT and PROMPT_LEAN_RIGHT should be customized in ~/.zshrc. The rest variables should be customized in ~/.zshenv.

Development

If you make any changes please run make test to ensure the (little) test suite is succesfull.

More Repositories

1

dns

DNS library in Go
Go
7,768
star
2

gobook

A complete introduction into Go, superseded by https://github.com/miekg/learninggo
TeX
877
star
3

learninggo

Learning Go Book in mmark
Go
533
star
4

pkcs11

pkcs11 wrapper for Go
Go
355
star
5

exdns

Go DNS example programs
Go
289
star
6

rdup

The only backup program that doesn't make backups!
C
107
star
7

unbound

A Go wrapper for libunbound
Go
98
star
8

pandoc2rfc

Use pandoc to create XML suitable for xml2rfc
Python
81
star
9

dinit

An init for use inside Docker containers
Go
67
star
10

skydns2

Development is taking place: https://github.com/skynetservices/skydns2
Go
63
star
11

dnsv2

Go
44
star
12

bgp

BGP implementation in Go
Go
41
star
13

gitopper

Gitops for non-Kubernetes folks
Go
38
star
14

xds

command line interface for Envoy xDS endpoint
Go
35
star
15

block

Proof of concept CoreDNS plugin that implements a block list
Go
23
star
16

yamlfmt

Format YAML
Go
21
star
17

dnsfs

A DNS filesystem
Go
20
star
18

redis

CoreDNS plugin implementing a shared cache using Redis
Go
14
star
19

dnsrouter

Route DNS packets
Go
14
star
20

bitradix

A radix tree that branches on the bits in a key
Go
14
star
21

dreck

Bot to help with GitHub chores
Go
12
star
22

pgo

container gitops in a simple way
Go
10
star
23

rip

RIP protocol implementation in Go
Go
10
star
24

lg-dns

DNS Looking Glass
Go
9
star
25

mutfs

A filesystem where you can create, but not alter files, imMUTable FS.
Go
8
star
26

ssd

Go
7
star
27

nxdomain

CoreDNS plugin: return NXDOMAIN for configured domains
Go
7
star
28

dump

dump all incoming request in coredns
Go
5
star
29

lboverlay

Go
5
star
30

local

CoreDNS plugin that answers "local" queries
Go
5
star
31

caddy-debian

Create debian package for Caddy
Makefile
5
star
32

cf

CFEngine formatter
Go
4
star
33

nsec4

authenticated denial of existence
Shell
4
star
34

denialid

Authenticated Denial of Existence in the DNS
XSLT
4
star
35

access

why - explain why a user can or cannot access a file
Go
4
star
36

debian

Small CI to create debian packages for various (Go) binaries
Shell
3
star
37

nlgids

caddy middleware for nlgids.london
Go
2
star
38

a

2
star
39

rota

generate oncall rotations
Go
2
star
40

mmark.nl

mmark.miek.nl website
HTML
2
star
41

dname

HTML
2
star
42

coderemarks

Annotate source code with remarks in LaTeX
2
star
43

kubeadam

TeX
1
star
44

xdoc

Go
1
star
45

corecheck

Utility to check Markdown files for valid Corefile snippets.
Go
1
star
46

signalds

1
star
47

caddy-user

Caddy module that changes to a different user before serving the request
Go
1
star