Verified Commit aa419450 authored by Hadrien 'dric0' Patte's avatar Hadrien 'dric0' Patte
Browse files

Feat: add some fusion ;)


Signed-off-by: default avatarHadrien 'dric0' Patte <dric0@larez.fr>
parent d96ef744
VIA theme for ZSH
=================
# ViaRézo ZSH Theme
[![WTFPLv2 License](https://img.shields.io/badge/license-WTFPLv2-blue.svg)](http://www.wtfpl.net)
This is a theme for ZSH which mainly forks the historical theme used on
[VIA Centrale Réseaux](https://via.ecp.fr/) servers. It can be used with
ZSH frameworks such as [Oh-My-ZSH](https://github.com/robbyrussell/oh-my-zsh).
This is a theme for ZSH which mainly forks the historical theme used on VIA Centrale Réseaux servers. It can be used with ZSH frameworks such as [Oh-My-ZSH](https://github.com/robbyrussell/oh-my-zsh).
![General preview](https://cloud.githubusercontent.com/assets/19719047/21297526/3658ab04-c582-11e6-811d-f316d26996b3.png "Oh-My-VIA theme preview")
Testing
-------
## VCS caption
See on [Docker Hub](https://hub.docker.com/r/badouralix/oh-my-via/) for a testing image.
| Color | State | Variable |
|:------:|:--------------------------:|:---------------------------------:|
| red | there are unstaged files | `OHMYVIAREZO_VCS_COLOR_UNSTAGED` |
| yellow | there are staged files | `OHMYVIAREZO_VCS_COLOR_STAGED` |
| blue | there are untracked files | `OHMYVIAREZO_VCS_COLOR_UNTRACKED` |
| cyan | stash stack is not empty | `OHMYVIAREZO_VCS_COLOR_STASH` |
| green | working directory is clean | `OHMYVIAREZO_VCS_COLOR_CLEAN` |
Info
----
## Install for Oh-My-ZSH
### VCS caption
| Color | State | Variable |
|:------:|:--------------------------:|:-----------------------------:|
| red | there are unstaged files | `OHMYVIA_VCS_COLOR_UNSTAGED` |
| yellow | there are staged files | `OHMYVIA_VCS_COLOR_STAGED` |
| blue | there are untracked files | `OHMYVIA_VCS_COLOR_UNTRACKED` |
| cyan | stash stack is not empty | `OHMYVIA_VCS_COLOR_STASH` |
| green | working directory is clean | `OHMYVIA_VCS_COLOR_CLEAN` |
Usage
-----
### Install for Oh-My-ZSH
In order to use this theme, you have to clone this repository in your Oh-My-ZSH
`custom/themes` directory ( usually `~/.oh-my-zsh/custom/themes` ) :
In order to use this theme, you have to clone this repository in your Oh-My-ZSH `custom/themes` directory (usually `~/.oh-my-zsh/custom/themes`):
```
git clone https://github.com/badouralix/oh-my-via.git $ZSH/custom/themes/oh-my-via
```shell
git clone https://gitlab.viarezo.fr/ViaRezo/oh-my-viarezo.git $ZSH/custom/themes/oh-my-viarezo
```
You then need to select this theme in your `~/.zshrc` :
```
ZSH_THEME="oh-my-via/via"
```shell
ZSH_THEME="oh-my-viarezo/viarezo"
```
### Customization
## Customization
Time format defaults to `%D{%H:%M}`, but can be overwritten by setting the variable
`OHMYVIA_TIME_FORMAT` in your `~/.zshrc`.
Time format defaults to `%D{%H:%M}`, but can be overwritten by setting the variable `OHMYVIAREZO_TIME_FORMAT` in your `~/.zshrc`.
Hostname may be printed up to the first `.` or hidden with the variable
`OHMYVIA_CONTEXT_HOSTNAME`.
Hostname may be printed up to the first `.` or hidden with the variable `OHMYVIAREZO_CONTEXT_HOSTNAME`.
VCS theme can be set through the variable `OHMYVIA_VCS_THEME`.
VCS theme can be set through the variable `OHMYVIAREZO_VCS_THEME`.
Unit testing
------------
## Unit testing
Oh-My-VIA uses [ZUnit](https://github.com/molovo/zunit) as unit testing framework.
To run the tests, just run:
```
```shell
zunit test
```
License
-------
## License
Unless explicitly stated to the contrary, all contents licensed under the [WTFPL](LICENSE).
......@@ -9,24 +9,24 @@
# Context: user@hostname (who am I and where am I)
# See https://github.com/bhilburn/powerlevel9k/blob/1ff9da64d974265ce2f22bd1da4a47d0b8f7ca90/powerlevel9k.zsh-theme#L434
prompt_context () {
local username="%(!.$OHMYVIA_CONTEXT_ROOT_COLOR.$OHMYVIA_CONTEXT_USER_COLOR)%n%b%f"
local username="%(!.$OHMYVIAREZO_CONTEXT_ROOT_COLOR.$OHMYVIAREZO_CONTEXT_USER_COLOR)%n%b%f"
# Return only username if $OHMYVIA_CONTEXT_HOSTNAME is empty.
if [[ $OHMYVIA_CONTEXT_HOSTNAME == "empty" ]]; then
# Return only username if $OHMYVIAREZO_CONTEXT_HOSTNAME is empty.
if [[ $OHMYVIAREZO_CONTEXT_HOSTNAME == "empty" ]]; then
echo "${username}"
return
fi
local separator="$OHMYVIA_CONTEXT_SEPARATOR_COLOR@%b%f"
local separator="$OHMYVIAREZO_CONTEXT_SEPARATOR_COLOR@%b%f"
# Handle hostnames containing `.` (defaults to full machine hostname prompt.)
local colorless_hostname="$OHMYVIA_CONTEXT_HOSTNAME"
if [[ $OHMYVIA_CONTEXT_HOSTNAME == 'full' ]]; then
local colorless_hostname="$OHMYVIAREZO_CONTEXT_HOSTNAME"
if [[ $OHMYVIAREZO_CONTEXT_HOSTNAME == 'full' ]]; then
colorless_hostname="%M"
elif [[ $OHMYVIA_CONTEXT_HOSTNAME == 'partial' ]]; then
elif [[ $OHMYVIAREZO_CONTEXT_HOSTNAME == 'partial' ]]; then
colorless_hostname="%m"
fi
local hostname="$OHMYVIA_CONTEXT_HOSTNAME_COLOR${colorless_hostname}%b%f"
local hostname="$OHMYVIAREZO_CONTEXT_HOSTNAME_COLOR${colorless_hostname}%b%f"
echo "${username}${separator}${hostname}"
}
......@@ -34,17 +34,16 @@ prompt_context () {
# Print current directory with ~ instead of $HOME
# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Shell-state
prompt_dir () {
local current_dir="$OHMYVIA_DIR_COLOR%~%b%f"
local current_dir="$OHMYVIAREZO_DIR_COLOR%~%b%f"
echo $current_dir
}
# Print current time
prompt_time () {
local clock="$OHMYVIA_TIME_COLOR$OHMYVIA_TIME_FORMAT%b%f"
local clock="$OHMYVIAREZO_TIME_COLOR$OHMYVIAREZO_TIME_FORMAT%b%f"
echo $clock
}
# vim: ft=zsh fenc=utf-8
......@@ -24,8 +24,8 @@
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"}
OHMYVIAREZO_VCS_PROMPT_NORMAL=${OHMYVIAREZO_VCS_PROMPT_NORMAL:-"$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal"}
OHMYVIAREZO_VCS_PROMPT_ACTION=${OHMYVIAREZO_VCS_PROMPT_ACTION:-"$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action"}
}
+vi-theme-alphabet () {
......@@ -34,8 +34,8 @@
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"
OHMYVIAREZO_VCS_PROMPT_NORMAL="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal"
OHMYVIAREZO_VCS_PROMPT_ACTION="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action"
}
+vi-theme-djou () {
......@@ -44,8 +44,8 @@
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"
OHMYVIAREZO_VCS_PROMPT_NORMAL="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal"
OHMYVIAREZO_VCS_PROMPT_ACTION="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action"
}
+vi-theme-kiwi () {
......@@ -54,8 +54,8 @@
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"
OHMYVIAREZO_VCS_PROMPT_NORMAL="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal"
OHMYVIAREZO_VCS_PROMPT_ACTION="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action"
}
+vi-theme-jon () {
......@@ -64,9 +64,8 @@
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"
OHMYVIAREZO_VCS_PROMPT_NORMAL="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_normal"
OHMYVIAREZO_VCS_PROMPT_ACTION="$vcs_prompt_prefix$vcs_prompt_hyphen$vcs_prompt_action"
}
# vim: ft=zsh fenc=utf-8
......@@ -9,7 +9,7 @@
# Thanks to http://eseth.org/2010/git-in-zsh.html
+vi-git-stash () {
if [[ -s ${hook_com[base]}/.git/refs/stash ]] ; then
hook_com[misc]+=$OHMYVIA_VCS_COLOR_STASH
hook_com[misc]+=$OHMYVIAREZO_VCS_COLOR_STASH
fi
}
......@@ -21,15 +21,14 @@
# 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
hook_com[misc]+=$OHMYVIAREZO_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
+vi-misc-init () {
hook_com[misc]=$OHMYVIA_VCS_COLOR_CLEAN
hook_com[misc]=$OHMYVIAREZO_VCS_COLOR_CLEAN
}
# vim: ft=zsh fenc=utf-8
#
# Oh-My-VIA ZSH Theme
# Oh-My-ViaRézo 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
......@@ -13,10 +13,10 @@
OHMYVIA_INSTALLATION_PATH="$(dirname "$0")"
source $OHMYVIA_INSTALLATION_PATH/functions/prompt_utils.zsh
source $OHMYVIA_INSTALLATION_PATH/functions/utils.zsh
source $OHMYVIA_INSTALLATION_PATH/functions/vcs_themes.zsh
source $OHMYVIA_INSTALLATION_PATH/functions/vcs_utils.zsh
source $OHMYVIAREZO_INSTALLATION_PATH/functions/prompt_utils.zsh
source $OHMYVIAREZO_INSTALLATION_PATH/functions/utils.zsh
source $OHMYVIAREZO_INSTALLATION_PATH/functions/vcs_themes.zsh
source $OHMYVIAREZO_INSTALLATION_PATH/functions/vcs_utils.zsh
#################################################################################
# Variables initialization
......@@ -24,35 +24,35 @@ source $OHMYVIA_INSTALLATION_PATH/functions/vcs_utils.zsh
## Properties
set_default OHMYVIA_CONTEXT_HOSTNAME "full"
set_default OHMYVIA_CONTEXT_HOSTNAME_COLOR "%B%F{white}"
set_default OHMYVIA_CONTEXT_SEPARATOR_COLOR "%B%F{yellow}"
set_default OHMYVIA_CONTEXT_ROOT_COLOR "%B%F{blue}"
set_default OHMYVIA_CONTEXT_USER_COLOR "%B%F{red}"
set_default OHMYVIAREZO_CONTEXT_HOSTNAME "full"
set_default OHMYVIAREZO_CONTEXT_HOSTNAME_COLOR "%B%F{white}"
set_default OHMYVIAREZO_CONTEXT_SEPARATOR_COLOR "%B%F{yellow}"
set_default OHMYVIAREZO_CONTEXT_ROOT_COLOR "%B%F{blue}"
set_default OHMYVIAREZO_CONTEXT_USER_COLOR "%B%F{red}"
set_default OHMYVIA_DIR_COLOR "%B%F{green}"
set_default OHMYVIAREZO_DIR_COLOR "%B%F{green}"
set_default OHMYVIA_STATUS_OK_COLOR "%B%F{yellow}"
set_default OHMYVIA_STATUS_ERROR_COLOR "%B%F{red}"
set_default OHMYVIAREZO_STATUS_OK_COLOR "%B%F{yellow}"
set_default OHMYVIAREZO_STATUS_ERROR_COLOR "%B%F{red}"
set_default OHMYVIA_TIME_COLOR "%B%F{cyan}"
set_default OHMYVIA_TIME_FORMAT "%D{%H:%M}"
set_default OHMYVIAREZO_TIME_COLOR "%B%F{cyan}"
set_default OHMYVIAREZO_TIME_FORMAT "%D{%H:%M}"
set_default OHMYVIA_VCS_COLOR_UNSTAGED "red"
set_default OHMYVIA_VCS_COLOR_STAGE "yellow"
set_default OHMYVIA_VCS_COLOR_UNTRACKED "blue"
set_default OHMYVIA_VCS_COLOR_STASH "cyan"
set_default OHMYVIA_VCS_COLOR_CLEAN "green"
set_default OHMYVIA_VCS_THEME "default"
set_default OHMYVIAREZO_VCS_COLOR_UNSTAGED "red"
set_default OHMYVIAREZO_VCS_COLOR_STAGE "yellow"
set_default OHMYVIAREZO_VCS_COLOR_UNTRACKED "blue"
set_default OHMYVIAREZO_VCS_COLOR_STASH "cyan"
set_default OHMYVIAREZO_VCS_COLOR_CLEAN "green"
set_default OHMYVIAREZO_VCS_THEME "default"
#################################################################################
# Build left & right prompts
#################################################################################
OHMYVIA_EOL="%(?.$OHMYVIA_STATUS_OK_COLOR.$OHMYVIA_STATUS_ERROR_COLOR)%#%f%b"
OHMYVIAREZO_EOL="%(?.$OHMYVIAREZO_STATUS_OK_COLOR.$OHMYVIAREZO_STATUS_ERROR_COLOR)%#%f%b"
PROMPT="$(prompt_time) $(prompt_context) $(prompt_dir)${OHMYVIA_EOL} "
PROMPT="$(prompt_time) $(prompt_context) $(prompt_dir)${OHMYVIAREZO_EOL} "
# Display vcs info
# http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information
......@@ -62,16 +62,16 @@ zstyle ':vcs_info:*' max-exports 1 # vcs_info only sets vcs_info_msg_0_
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true # enable %c and %u sequences usage
zstyle ':vcs_info:*' unstagedstr $OHMYVIA_VCS_COLOR_UNSTAGED
zstyle ':vcs_info:*' stagedstr $OHMYVIA_VCS_COLOR_STAGED
zstyle ':vcs_info:*' unstagedstr $OHMYVIAREZO_VCS_COLOR_UNSTAGED
zstyle ':vcs_info:*' stagedstr $OHMYVIAREZO_VCS_COLOR_STAGED
zstyle ':vcs_info:git*+set-message:*' hooks misc-init git-stash git-untracked
# Load VCS theme
eval +vi-theme-$OHMYVIA_VCS_THEME
eval +vi-theme-$OHMYVIAREZO_VCS_THEME
zstyle ':vcs_info:*' formats " $OHMYVIA_VCS_PROMPT_NORMAL"
zstyle ':vcs_info:*' actionformats " $OHMYVIA_VCS_PROMPT_ACTION"
zstyle ':vcs_info:*' formats " $OHMYVIAREZO_VCS_PROMPT_NORMAL"
zstyle ':vcs_info:*' actionformats " $OHMYVIAREZO_VCS_PROMPT_ACTION"
# Override precmd to update vcs_info_msg_0_ before prompt.
# See http://zsh.sourceforge.net/Doc/Release/Functions.html#Hook-Functions
......@@ -79,4 +79,3 @@ precmd () { vcs_info }
RPROMPT='${vcs_info_msg_0_}'
# vim: ft=zsh fenc=utf-8
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment