Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Oh my ViaRézo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ViaRézo
Oh my ViaRézo
Commits
79cca5a8
Commit
79cca5a8
authored
8 years ago
by
Ayaz Badouraly
Browse files
Options
Downloads
Patches
Plain Diff
Introducing themes
parent
11adab31
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+6
-5
6 additions, 5 deletions
README.md
functions/vcs_themes.zsh
+72
-0
72 additions, 0 deletions
functions/vcs_themes.zsh
functions/vcs_utils.zsh
+35
-0
35 additions, 0 deletions
functions/vcs_utils.zsh
via.zsh-theme
+33
-51
33 additions, 51 deletions
via.zsh-theme
with
146 additions
and
56 deletions
README.md
+
6
−
5
View file @
79cca5a8
...
@@ -14,11 +14,11 @@ Info
...
@@ -14,11 +14,11 @@ Info
| Color | State | Variable |
| Color | State | Variable |
|:------:|:--------------------------:|:-----------------------------:|
|:------:|:--------------------------:|:-----------------------------:|
| red | there are unstaged files |
`OHMYVIA_VCS_UNSTAGED
_COLOR
`
|
| red | there are unstaged files |
`OHMYVIA_VCS_
COLOR_
UNSTAGED`
|
| yellow | there are staged files |
`OHMYVIA_VCS_STAGED
_COLOR
`
|
| yellow | there are staged files |
`OHMYVIA_VCS_
COLOR_
STAGED`
|
| blue | there are untracked files |
`OHMYVIA_VCS_UNTRACKED
_COLOR
`
|
| blue | there are untracked files |
`OHMYVIA_VCS_
COLOR_
UNTRACKED`
|
| cyan | stash stack is not empty |
`OHMYVIA_VCS_
STASH_COLOR
`
|
| cyan | stash stack is not empty |
`OHMYVIA_VCS_
COLOR_STASH
`
|
| green | working directory is clean |
`OHMYVIA_VCS_C
LEAN_COLOR
`
|
| green | working directory is clean |
`OHMYVIA_VCS_C
OLOR_CLEAN
`
|
Usage
Usage
...
@@ -44,6 +44,7 @@ ZSH_THEME="oh-my-via/via"
...
@@ -44,6 +44,7 @@ ZSH_THEME="oh-my-via/via"
Time format defaults to
`%D{%H:%M}`
, but can be overwritten by setting the variable
Time format defaults to
`%D{%H:%M}`
, but can be overwritten by setting the variable
`OHMYVIA_TIME_FORMAT`
in your
`~/.zshrc`
.
`OHMYVIA_TIME_FORMAT`
in your
`~/.zshrc`
.
VCS theme can be set through the variable
`OHMYVIA_VCS_THEME`
.
Testing
Testing
-------
-------
...
...
This diff is collapsed.
Click to expand it.
functions/vcs_themes.zsh
0 → 100644
+
72
−
0
View file @
79cca5a8
#
# functions/vcs_themes.zsh - provide sample themes for VCS prompt
#
# This work is free. You can redistribute it and/or modify it under the terms of
# the Do What The Fuck You Want To Public License, Version 2, as published by Sam
# Hocevar. See the COPYING file or http://www.wtfpl.net/ for more details.
#
# In normal formats and actionformats the following replacements are done:
#› %s : The VCS in use (git, hg, svn, etc.).
#› %b : Information about the current branch.
#› %a : An identifier that describes the action. Only makes sense in actionformats.
#› %i : The current revision number or identifier. For hg the hgrevformat style may be used to customize the output.
#› %c : The string from the stagedstr style if there are staged changes in the repository.
#› %u : The string from the unstagedstr style if there are unstaged changes in the repository.
#› %R : The base directory of the repository.
#› %r : The repository name. If %R is /foo/bar/repoXY, %r is repoXY.
#› %S : A subdirectory within a repository. If $PWD is /foo/bar/repoXY/beer/tasty, %S is beer/tasty.
#› %m : A "misc" replacement. It is at the discretion of the backend to decide what this replacement expands to.
function
+vi-theme-default
()
{
local
vcs_prompt_prefix
=
"%F{magenta}(%F{white}%s%F{magenta})%f"
local
vcs_prompt_hyphen
=
"%F{yellow}-%f"
local
vcs_prompt_normal
=
"%F{magenta}[%m%c%u%b%F{magenta}]%f"
local
vcs_prompt_action
=
"%F{magenta}[%m%c%u%b%F{magenta}|%F{red}%a%F{magenta}]%f"
OHMYVIA_VCS_PROMPT_NORMAL
=
${
OHMYVIA_VCS_PROMPT_NORMAL
:-
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal
"
}
OHMYVIA_VCS_PROMPT_ACTION
=
${
OHMYVIA_VCS_PROMPT_ACTION
:-
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action
"
}
}
function
+vi-theme-alphabet
()
{
local
vcs_prompt_prefix
=
"%F{magenta}(%F{white}%s%F{magenta})%f"
local
vcs_prompt_hyphen
=
"%F{yellow}-%f"
local
vcs_prompt_normal
=
"%F{magenta}[%m%c%u%b%F{magenta}]%f"
local
vcs_prompt_action
=
"%F{magenta}[%m%c%u%b %F{magenta}| %F{red}%a%F{magenta}]%f"
OHMYVIA_VCS_PROMPT_NORMAL
=
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal
"
OHMYVIA_VCS_PROMPT_ACTION
=
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action
"
}
function
+vi-theme-djou
()
{
local
vcs_prompt_prefix
=
"%F{white}%s%f"
local
vcs_prompt_hyphen
=
" %F{yellow}-%f "
local
vcs_prompt_normal
=
"%m%c%u%b%f"
local
vcs_prompt_action
=
"%m%c%u%b %F{magenta}| %F{red}%a%f"
OHMYVIA_VCS_PROMPT_NORMAL
=
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal
"
OHMYVIA_VCS_PROMPT_ACTION
=
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action
"
}
function
+vi-theme-kiwi
()
{
local
vcs_prompt_prefix
=
"%F{magenta}(%F{white}%s%F{magenta})%f"
local
vcs_prompt_hyphen
=
"%F{yellow}-%f"
local
vcs_prompt_normal
=
"%F{magenta}[%m%c%u%b%F{magenta}]%f"
local
vcs_prompt_action
=
"%F{magenta}[%m%c%u%b%F{yellow}|%F{red}%a%F{magenta}]%f"
OHMYVIA_VCS_PROMPT_NORMAL
=
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal
"
OHMYVIA_VCS_PROMPT_ACTION
=
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action
"
}
function
+vi-theme-jon
()
{
local
vcs_prompt_prefix
=
""
local
vcs_prompt_hyphen
=
""
local
vcs_prompt_normal
=
"%F{magenta}[%m%c%u%b%F{magenta}]%f"
local
vcs_prompt_action
=
"%F{magenta}[%m%c%u%b%F{magenta}|%F{red}%a%F{magenta}]%f"
OHMYVIA_VCS_PROMPT_NORMAL
=
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal
"
OHMYVIA_VCS_PROMPT_ACTION
=
"
$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action
"
}
# vim: ft=zsh fenc=utf-8
This diff is collapsed.
Click to expand it.
functions/vcs_utils.zsh
0 → 100644
+
35
−
0
View file @
79cca5a8
#
# functions/vcs_utils.zsh - provide supplemental VCS functions
#
# This work is free. You can redistribute it and/or modify it under the terms of
# the Do What The Fuck You Want To Public License, Version 2, as published by Sam
# Hocevar. See the COPYING file or http://www.wtfpl.net/ for more details.
#
# Thanks to http://eseth.org/2010/git-in-zsh.html
function
+vi-git-stash
()
{
if
[[
-s
${
hook_com
[base]
}
/.git/refs/stash
]]
;
then
hook_com[misc]+
=
$OHMYVIA_VCS_COLOR_STASH
fi
}
# Thanks to https://github.com/sunaku/home/
function
+vi-git-untracked
()
{
if
[[
$(
git rev-parse
--is-inside-work-tree
2> /dev/null
)
==
'true'
]]
&&
\
git status
--porcelain
| fgrep
'??'
&> /dev/null
;
then
# This will show the marker if there are any untracked files in repo.
# If instead you want to show the marker only if there are untracked
# files in $PWD, use:
#[[ -n $(git ls-files --others --exclude-standard) ]] ; then
hook_com[misc]+
=
$OHMYVIA_VCS_COLOR_UNTRACKED
fi
}
# Erase hook_com[misc] ( ie. %m ) to avoid dealing with backends info outputs
# Add $vcs_clean_color to setup default %b coloring in vcs prompt
function
+vi-misc-init
()
{
hook_com[misc]
=
$OHMYVIA_VCS_COLOR_CLEAN
}
# vim: ft=zsh fenc=utf-8
This diff is collapsed.
Click to expand it.
via.zsh-theme
+
33
−
51
View file @
79cca5a8
#
# VIA ZSH Theme - Preview: ASAP
# VIA ZSH Theme - Preview: ASAP
# Fork from the historical VIA Centrale Réseaux ZSH Theme
# Fork from the historical VIA Centrale Réseaux ZSH Theme
#
# This work is free. You can redistribute it and/or modify it under the terms of
# the Do What The Fuck You Want To Public License, Version 2, as published by Sam
# Hocevar. See the COPYING file or http://www.wtfpl.net/ for more details.
#
#################################################################################
# Source functions
#################################################################################
OHMYVIA_INSTALLATION_PATH
=
"
$(
dirname
"
$0
"
)
"
source
$OHMYVIA_INSTALLATION_PATH
/functions/vcs_themes.zsh
source
$OHMYVIA_INSTALLATION_PATH
/functions/vcs_utils.zsh
#################################################################################
# Setup prompts
#################################################################################
local
time_format
=
${
OHMYVIA_TIME_FORMAT
:-
"%D{%H:%M}"
}
local
time_format
=
${
OHMYVIA_TIME_FORMAT
:-
"%D{%H:%M}"
}
local
clock
=
"%B%F{cyan}
$time_format
%f%b"
local
clock
=
"%B%F{cyan}
$time_format
%f%b"
...
@@ -30,60 +49,23 @@ zstyle ':vcs_info:*' max-exports 1 # vcs_info only sets vcs_info_msg_0_
...
@@ -30,60 +49,23 @@ zstyle ':vcs_info:*' max-exports 1 # vcs_info only sets vcs_info_msg_0_
zstyle
':vcs_info:*'
enable
git
zstyle
':vcs_info:*'
enable
git
zstyle
':vcs_info:*'
check-for-changes
true
# enable %c and %u sequences usage
zstyle
':vcs_info:*'
check-for-changes
true
# enable %c and %u sequences usage
local
vcs_unstaged_color
=
${
OHMYVIA_VCS_UNSTAGED_COLOR
:-
"%F{red}"
}
OHMYVIA_VCS_COLOR_UNSTAGED
=
${
OHMYVIA_VCS_COLOR_UNSTAGED
:-
"%F{red}"
}
local
vcs_staged_color
=
${
OHMYVIA_VCS_STAGED_COLOR
:-
"%F{yellow}"
}
OHMYVIA_VCS_COLOR_STAGED
=
${
OHMYVIA_VCS_COLOR_STAGED
:-
"%F{yellow}"
}
local
vcs_untracked_color
=
${
OHMYVIA_VCS_UNTRACKED_COLOR
:-
"%F{blue}"
}
OHMYVIA_VCS_COLOR_UNTRACKED
=
${
OHMYVIA_VCS_COLOR_UNTRACKED
:-
"%F{blue}"
}
local
vcs_stash_color
=
${
OHMYVIA_VCS_STASH_COLOR
:-
"%F{cyan}"
}
OHMYVIA_VCS_COLOR_STASH
=
${
OHMYVIA_VCS_COLOR_STASH
:-
"%F{cyan}"
}
local
vcs_clean_color
=
${
OHMYVIA_VCS_CLEAN_COLOR
:-
"%F{green}"
}
OHMYVIA_VCS_COLOR_CLEAN
=
${
OHMYVIA_VCS_COLOR_CLEAN
:-
"%F{green}"
}
zstyle
':vcs_info:*'
unstagedstr
$vcs_unstaged_color
zstyle
':vcs_info:*'
stagedstr
$vcs_staged_color
# Thanks to https://github.com/sunaku/home/
function
+vi-git-untracked
()
{
if
[[
$(
git rev-parse
--is-inside-work-tree
2> /dev/null
)
==
'true'
]]
&&
\
git status
--porcelain
| fgrep
'??'
&> /dev/null
;
then
# This will show the marker if there are any untracked files in repo.
# If instead you want to show the marker only if there are untracked
# files in $PWD, use:
#[[ -n $(git ls-files --others --exclude-standard) ]] ; then
hook_com[misc]+
=
$vcs_untracked_color
fi
}
# Thanks to http://eseth.org/2010/git-in-zsh.html
function
+vi-git-stash
()
{
if
[[
-s
${
hook_com
[base]
}
/.git/refs/stash
]]
;
then
hook_com[misc]+
=
$vcs_stash_color
fi
}
# Erase hook_com[misc] ( ie. %m ) to avoid dealing with backends info outputs
zstyle
':vcs_info:*'
unstagedstr
$OHMYVIA_VCS_COLOR_UNSTAGED
# Add $vcs_clean_color to setup default %b coloring in vcs prompt
zstyle
':vcs_info:*'
stagedstr
$OHMYVIA_VCS_COLOR_STAGED
function
+vi-misc-init
()
{
hook_com[misc]
=
$vcs_clean_color
}
zstyle
':vcs_info:git*+set-message:*'
hooks misc-init git-stash git-untracked
zstyle
':vcs_info:git*+set-message:*'
hooks misc-init git-stash git-untracked
# In normal formats and actionformats the following replacements are done:
# Load VCS theme
# %s : The VCS in use (git, hg, svn, etc.).
OHMYVIA_VCS_THEME
=
${
OHMYVIA_VCS_THEME
:-
"default"
}
# %b : Information about the current branch.
eval
+vi-theme-
$OHMYVIA_VCS_THEME
# %a : An identifier that describes the action. Only makes sense in actionformats.
# %i : The current revision number or identifier. For hg the hgrevformat style may be used to customize the output.
zstyle
':vcs_info:*'
formats
"
$OHMYVIA_VCS_PROMPT_NORMAL
"
# %c : The string from the stagedstr style if there are staged changes in the repository.
zstyle
':vcs_info:*'
actionformats
"
$OHMYVIA_VCS_PROMPT_ACTION
"
# %u : The string from the unstagedstr style if there are unstaged changes in the repository.
# %R : The base directory of the repository.
# %r : The repository name. If %R is /foo/bar/repoXY, %r is repoXY.
# %S : A subdirectory within a repository. If $PWD is /foo/bar/repoXY/beer/tasty, %S is beer/tasty.
# %m : A "misc" replacement. It is at the discretion of the backend to decide what this replacement expands to.
local
vcs_formats_prefix
=
"%F{magenta}(%F{white}%s%F{magenta})%f"
local
vcs_formats_hyphen
=
"%F{yellow}-%f"
local
vcs_formats_normal
=
"%F{magenta}[%m%c%u%b%F{magenta}]%f"
local
vcs_formats_action
=
"%F{magenta}[%m%c%u%b%F{magenta}|%F{red}%a%F{magenta}]%f"
zstyle
':vcs_info:*'
formats
"
$vcs_formats_prefix$vcs_formats_hyphen$vcs_formats_normal
"
zstyle
':vcs_info:*'
actionformats
"
$vcs_formats_prefix$vcs_formats_hyphen$vcs_formats_action
"
precmd
()
{
vcs_info
}
precmd
()
{
vcs_info
}
RPROMPT
=
'${vcs_info_msg_0_}'
RPROMPT
=
'${vcs_info_msg_0_}'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment