-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a simplified version of the original, with less than half the lines of code. What was simplified: * Only shows full working directory. This is not configurable. * Always shows error return value. This is not configurable. * Does not show editor overwrite indicator. * Does not use `async`. * Uses Zim's `git-info`, which does not have added, deleted, modified, renamed and unmerged indicators. Use indexed and unindexed indicators instead. * As all Zim prompt themes, do not support promptinit. Closes zimfw/zimfw#138
- Loading branch information
0 parents
commit 47f048b
Showing
3 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.swp | ||
*.zwc | ||
*.zwc.old |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
sorin | ||
===== | ||
|
||
A fork of the [sorin] theme. | ||
|
||
<img width="706" src="https://zimfw.github.io/images/prompts/[email protected]"> | ||
|
||
What does it show? | ||
------------------ | ||
|
||
* On the left: | ||
* `username@hostname` when in a ssh session. | ||
* Working directory. | ||
* `#` when you're root. | ||
* Keymap indicator. | ||
* On the right: | ||
* Python [venv] indicator. | ||
* `✘` when there was an error. | ||
* `V` when in a vim terminal. | ||
* Git information: | ||
* Current branch name, position, or commit short hash. | ||
* `⬆` and `⬇` when ahead and behind of remote. | ||
* `✭` when there are stashed states. | ||
* `✚` when there are indexed files. | ||
* `✱` when there are unindexed files. | ||
* `◼` when there are untracked files. | ||
|
||
Requirements | ||
------------ | ||
|
||
Requires Zim's [git-info] module to show git information. | ||
|
||
[sorin]: https://github.com/sorin-ionescu/prezto/blob/master/modules/prompt/functions/prompt_sorin_setup | ||
[venv]: https://docs.python.org/3/library/venv.html | ||
[git-info]: https://github.com/zimfw/git-info |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# vim:et sts=2 sw=2 ft=zsh | ||
# | ||
# A simple theme that displays relevant, contextual information. | ||
# | ||
# A simplified fork of the original sorin theme from | ||
# https://github.com/sorin-ionescu/prezto/blob/master/modules/prompt/functions/prompt_sorin_setup | ||
# | ||
# Requires the `git-info` zmodule to be included in the .zimrc file. | ||
|
||
# | ||
# 16 Terminal Colors | ||
# -- --------------- | ||
# 0 black | ||
# 1 red | ||
# 2 green | ||
# 3 yellow | ||
# 4 blue | ||
# 5 magenta | ||
# 6 cyan | ||
# 7 white | ||
# 8 bright black | ||
# 9 bright red | ||
# 10 bright green | ||
# 11 bright yellow | ||
# 12 bright blue | ||
# 13 bright magenta | ||
# 14 bright cyan | ||
# 15 bright white | ||
# | ||
|
||
_prompt_sorin_vimode() { | ||
case ${KEYMAP} in | ||
vicmd) print -n ' %B%F{2}❮%F{3}❮%F{1}❮%b' ;; | ||
*) print -n ' %B%F{1}❯%F{3}❯%F{2}❯%b' ;; | ||
esac | ||
} | ||
|
||
zle-keymap-select() { | ||
zle reset-prompt | ||
zle -R | ||
} | ||
zle -N zle-keymap-select | ||
|
||
VIRTUAL_ENV_DISABLE_PROMPT=1 | ||
|
||
setopt nopromptbang prompt{cr,percent,sp,subst} | ||
|
||
typeset -gA git_info | ||
if (( ${+functions[git-info]} )); then | ||
# Set git-info parameters. | ||
zstyle ':zim:git-info' verbose yes | ||
zstyle ':zim:git-info:action' format '%F{7}:%F{9}%s' | ||
zstyle ':zim:git-info:ahead' format ' %F{13}⬆' | ||
zstyle ':zim:git-info:behind' format ' %F{13}⬇' | ||
zstyle ':zim:git-info:branch' format ' %F{2}%b' | ||
zstyle ':zim:git-info:commit' format ' %F{3}%c' | ||
zstyle ':zim:git-info:indexed' format ' %F{2}✚' | ||
zstyle ':zim:git-info:unindexed' format ' %F{4}✱' | ||
zstyle ':zim:git-info:position' format ' %F{13}%p' | ||
zstyle ':zim:git-info:stashed' format ' %F{6}✭' | ||
zstyle ':zim:git-info:untracked' format ' %F{7}◼' | ||
zstyle ':zim:git-info:keys' format \ | ||
'status' '%%B$(coalesce "%b" "%p" "%c")%s%A%B%S%i%I%u%f%%b' | ||
|
||
# Add hook for calling git-info before each command. | ||
autoload -Uz add-zsh-hook && add-zsh-hook precmd git-info | ||
fi | ||
|
||
# Define prompts. | ||
PS1='${SSH_TTY:+"%F{9}%n%F{7}@%F{3}%m "}%B%F{4}%~%b%(!. %B%F{1}#%b.)$(_prompt_sorin_vimode)%f ' | ||
RPS1='${VIRTUAL_ENV:+"%F{3}(${VIRTUAL_ENV:t})"}%(?:: %F{1}✘ %?)${VIM:+" %B%F{6}V%b"}${(e)git_info[status]}%f' | ||
SPROMPT='zsh: correct %F{1}%R%f to %F{2}%r%f [nyae]? ' |