Giter Site home page Giter Site logo

lean's Introduction

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.

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

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.

lean's People

Contributors

derverrucktefuchs avatar dne avatar doomhammer avatar ericbn avatar erickpintor avatar f440 avatar gilbertw1 avatar gravity-vv avatar hit0ri avatar miekg avatar mikybars avatar sergiorussia avatar sqve avatar tomfitzhenry avatar valinora avatar yujishen avatar yvkschaefer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.