Last active
August 22, 2020 08:34
-
-
Save thumbnail/6d5566803ddf2bf5a065e85d49717f88 to your computer and use it in GitHub Desktop.
leiningen current verion prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lein_current_version() { | |
command grep defproject project.clj 2> /dev/null | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} -o "\".*"\" | sed "s/\"//g" | |
} | |
function lein_prompt() { | |
cat project.clj &> /dev/null || return 0 | |
ZSH_THEME_LEIN_PROMPT_PREFIX="%{$fg_bold[green]%}" | |
ZSH_THEME_LEIN_PROMPT_SUFFIX="%{$reset_color%} " | |
echo "$ZSH_THEME_LEIN_PROMPT_PREFIX$(lein_current_version)$ZSH_THEME_LEIN_PROMPT_SUFFIX" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adds lein-version of current project to the lein prompt:

Enable by appending
$(lein_prompt)
to your current theme's$ZSH_PROMPT
(located at~/.oh-my-zsh/themes/$ZSH_THEME.zsh-theme
).E.g. like for robbyrussel: