Skip to content

Latest commit

 

History

History
93 lines (64 loc) · 2.84 KB

README.md

File metadata and controls

93 lines (64 loc) · 2.84 KB

promptd

What the?

promptd is a set of tools for shell prompts. It currently has two parts:

  • promptd-path, which prints a fish-like shortening of your current directory.

  • promptd-vcs, which uses glyphs to give you a quick overview of your Git repository status. Unlike existing solutions such as the vcs_info plugin for Zsh, promptd-vcs stops running after a user-specified amount of time, so that fetching the status of your repo doesn't make your prompt laggy.

Together, you can use them to build a prompt like this:

animated promptd example

More to follow.

Why is it called promptd?

It's a prompt that gives the current directory. Or it's a prompt written in D. Or I suck at naming things. Take your pick.

How do I get it?

Linux builds can be found at the releases page. They haven't been tested extensively across many distros, but Probably Work™ since they only depend on vanilla C libraries (pthread, libm, librt, libc).

Alternatively, building form source is simple.

How do I build it?

Grab a D compiler and run make release. That's all. There are no dependencies.

promptd will be added as a Dub package soon-ish.

How do I use it for my prompt?

Just invoke the programs with the desired options (see their --help info) in your prompt expression.

In Zsh (for the prompt shown in the demo):

setopt PROMPT_SUBST
setopt PROMPT_PERCENT
PROMPT='%B$(promptd-path) $(promptd-vcs --zsh) %%%b '

In Bash,

PS1="\$(promptd-path) \$(promptd-vcs) % "

It's 2015. Why are you generating a prompt with a compiled program?

I was using Zsh with oh-my-zsh, but it seemed to be really slow in some cases and someone on Reddit raised some concerns about it. I could try the fork, but I figured it wouldn't hurt to slim down my Zsh config to things I actually use. After doing that, all that remained was the need for a decent prompt. I'm allergic to writing a shell script more than five lines long, and some of my goals (like hard time limits) seemed easier in a "real" programming language instead of a Zsh script. So, I started this project.

What additions are planned?

  • Support for additional VCSes, starting with SVN and Mercurial

  • Additional Git info (such as the name of a branch being merged)

  • Colorized path output

License

zlib (Use it for whatever but don't claim you wrote it.) See LICENSE.md