Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added powerline theme #402

Closed
wants to merge 2 commits into from

6 participants

@lepht

Screenshot:

powerline theme screenshot

@Fl4t

I can't disagree this :+1:

Maybe it's redundant with : https://github.com/Lokaltog/powerline. Current user and right prompt are duplicated with the tmux theme. Using the right prompt of sorin would be great (all symbols I mean).

@lepht

@Fl4t this is a zsh prompt theme, whereas Lokaltog/powerline is a vim plugin, so there's definitely no redundancy there.

re: tmux duplication of info: While it's true you can get the same information in the tmux status bar, you could say the same of any of the prompt themes, and they're still handy for those of us not using tmux.

@ColinHebert

I'm not sure I follow, is it a real powerline (sitting at the bottom of the window) in ZSH? Or is just a prompt line that looks like the Vim powerline (and will appear on each new line)?

@Fl4t

@lepht This is not only a vim plugin, there is tmux theme, vim plugin, zsh theme, bash theme...

@ColinHebert His prompt appear one each command. This is not a "Real powerline". That's why - imho - the right prompt take too many space for nothing.

@lepht

Or is just a prompt line that looks like the Vim powerline (and will appear on each new line)?

That one ;)

As noted in the file's comments at the top, this was a straight port from https://github.com/jeremyFreeAgent/oh-my-zsh-powerline-theme

@sorin-ionescu

The problem with Powerline is that it requires special, hacked fonts. I also agree that it wastes too much space.

@ColinHebert

I'm not too fond of it either, it doesn't work well out of the box.


It's slightly off-topic, but I was wondering if it was possible to have a proper ZSH Powerline (not a prompt theme). I know tmux can do it (badly IMHO) but it would be nice to have a module to have a real powerline without the need of a multiplexer.

@sorin-ionescu

@ColinHebert It's possible, but it requires quite a bit of code to get it to work right in most, but not all, instances. See Status Line prompt, for example; the author abandoned it.

@DaveC0DE

@sorin-ionescu Only old-school terminals lacking fontconfig (urxvt) need special fonts. LilyTerm, Konsole, and others modern do not. I'd agree on screen real estate, except when used as a separate line above the actual command prompt. Then it nicely divides commands into blocks. That's how I tweak it.

@DaveC0DE

Powerline did change Unicode assignments. I believe lepht's U+2B80 and U+2B82 are now wrong. https://powerline.readthedocs.org/en/latest/fontpatching.html#font-patching

@sorin-ionescu

Mac OS X requires fonts to be installed.

@nasenatmer

Though I like the looks and especially that it actually is different from the zsh prompt theme included in powerline, I agree that the font-patching thing (which is necessary in some modern terminals still, such as xfce4-terminal in order to avoid tiny gaps between the arrows which are also used in this theme) is a clear downside to it which actually stops me — although a daily powerline lover — from voting for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 101 additions and 0 deletions.
  1. +101 −0 modules/prompt/functions/prompt_powerline_setup
View
101 modules/prompt/functions/prompt_powerline_setup
@@ -0,0 +1,101 @@
+#
+# A [powerline](https://github.com/Lokaltog/vim-powerline) theme for prezto,
+# based on the [oh-my-zsh-powerline-theme](https://github.com/jeremyFreeAgent/oh-my-zsh-powerline-theme)
+#
+# Author:
+# lepht <pete.clark@gmail.com>
+#
+# Screenshots:
+# http://i.imgur.com/Z6XIuT9.png
+
+git_prompt_info () {
+ ref=$(git symbolic-ref HEAD 2> /dev/null) || ref=$(git rev-parse --short HEAD 2> /dev/null) || return
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
+}
+
+parse_git_dirty () {
+ local SUBMODULE_SYNTAX=''
+ if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]
+ then
+ if [[ $POST_1_7_2_GIT -gt 0 ]]
+ then
+ SUBMODULE_SYNTAX="--ignore-submodules=dirty"
+ fi
+ if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]
+ then
+ echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
+ else
+ echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
+ fi
+ fi
+}
+
+function prompt_powerline_setup {
+ # FreeAgent puts the powerline style in zsh !
+
+ if [ "$POWERLINE_RIGHT_B" = "" ]; then
+ POWERLINE_RIGHT_B=%D{%H:%M:%S}
+ fi
+
+ if [ "$POWERLINE_RIGHT_A" = "" ]; then
+ POWERLINE_RIGHT_A=%D{%Y-%m-%d}
+ fi
+
+ POWERLINE_CURRENT_PATH="%d"
+
+ if [ "$POWERLINE_FULL_CURRENT_PATH" = "" ]; then
+ POWERLINE_CURRENT_PATH="%1~"
+ fi
+
+ POWERLINE_GIT_INFO_LEFT=""
+ POWERLINE_GIT_INFO_RIGHT="%F{red}"$'\u2b82'"%F{black}%K{red}"$'$(git_prompt_info)'" %f"
+ if [ "$POWERLINE_SHOW_GIT_ON_RIGHT" = "" ]; then
+ POWERLINE_GIT_INFO_LEFT=$'$(git_prompt_info)'
+ POWERLINE_GIT_INFO_RIGHT=""
+ fi
+
+ POWERLINE_COLOR_BG_GRAY=%K{240}
+ POWERLINE_COLOR_BG_LIGHT_GRAY=%K{240}
+ POWERLINE_COLOR_BG_WHITE=%K{255}
+
+ POWERLINE_COLOR_FG_GRAY=%F{240}
+ POWERLINE_COLOR_FG_LIGHT_GRAY=%F{240}
+ POWERLINE_COLOR_FG_WHITE=%F{255}
+
+ GIT_DIRTY_COLOR=%F{133}
+ GIT_CLEAN_COLOR=%F{118}
+ GIT_PROMPT_INFO=%F{012}
+
+ ZSH_THEME_GIT_PROMPT_PREFIX=" \u2b60 "
+ ZSH_THEME_GIT_PROMPT_SUFFIX="$GIT_PROMPT_INFO"
+ ZSH_THEME_GIT_PROMPT_DIRTY=" $GIT_DIRTY_COLOR✘"
+ ZSH_THEME_GIT_PROMPT_CLEAN=" $GIT_CLEAN_COLOR✔"
+
+ ZSH_THEME_GIT_PROMPT_ADDED="%F{082}✚%f"
+ ZSH_THEME_GIT_PROMPT_MODIFIED="%F{166}✹%f"
+ ZSH_THEME_GIT_PROMPT_DELETED="%F{160}✖%f"
+ ZSH_THEME_GIT_PROMPT_RENAMED="%F{220]➜%f"
+ ZSH_THEME_GIT_PROMPT_UNMERGED="%F{082]═%f"
+ ZSH_THEME_GIT_PROMPT_UNTRACKED="%F{190]✭%f"
+
+ POWERLINE_SEC1_BG=%K{green}
+ POWERLINE_SEC1_FG=%F{green}
+ POWERLINE_SEC1_TXT=%F{black}
+ if [ "$POWERLINE_DETECT_SSH" != "" ]; then
+ if [ -n "$SSH_CLIENT" ]; then
+ POWERLINE_SEC1_BG=%K{red}
+ POWERLINE_SEC1_FG=%F{red}
+ POWERLINE_SEC1_TXT=%F{white}
+ fi
+ fi
+ PROMPT="$POWERLINE_SEC1_BG$POWERLINE_SEC1_TXT %n %k%f$POWERLINE_SEC1_FG%K{blue}"$'\u2b80'"%k%f%F{white}%K{blue} "$POWERLINE_CURRENT_PATH" "$POWERLINE_GIT_INFO_LEFT"%k%f%F{blue}"$'\u2b80'"%f "
+
+ if [ "$POWERLINE_NO_BLANK_LINE" = "" ]; then
+ PROMPT="
+ "$PROMPT
+ fi
+
+ RPROMPT=$POWERLINE_GIT_INFO_RIGHT$POWERLINE_COLOR_FG_WHITE$'\u2b82'"%f$POWERLINE_COLOR_BG_WHITE $POWERLINE_COLOR_FG_GRAY$POWERLINE_RIGHT_B "$'\u2b82'"%f%k$POWERLINE_COLOR_BG_GRAY$POWERLINE_COLOR_FG_WHITE $POWERLINE_RIGHT_A %f%k"
+}
+
+# vim:ft=zsh
Something went wrong with that request. Please try again.