mirror of
https://gitlab.com/ceda_ei/wish
synced 2025-10-22 22:40:05 +02:00
Compare commits
10 Commits
config-fil
...
869a754ede
Author | SHA1 | Date | |
---|---|---|---|
869a754ede | |||
61ade4610c | |||
4b9c2b6982 | |||
cc5eefb197 | |||
de9e43365f | |||
11ad2e081f | |||
1db62a7be8 | |||
e05f37b5b9 | |||
c53939cdfe | |||
48ff98764d |
100
README.md
100
README.md
@@ -1,24 +1,110 @@
|
||||
# Wish
|
||||
|
||||
A customizable bash prompt.
|
||||
A customizable, extensible, themable bash prompt.
|
||||
|
||||

|
||||
|
||||
## Features
|
||||
|
||||
+ **Extensible**: Parts can be added using simple plugins.
|
||||
+ **Themable**: Choose from an existing theme or create your own.
|
||||
+ **Customizable**: The prompt can be customized via a simple config file.
|
||||
+ **Right Prompt**: Allows for two prompts — one on left, one on right.
|
||||
+ **Auto newline**: Automatically adds a newline if the last output doesn't end with one.
|
||||
+ **Powerline support**: Supports powerline symbols in both prompts.
|
||||
|
||||
# Installation
|
||||
|
||||
## One step Installation
|
||||
|
||||
`curl https://gitlab.com/ceda_ei/wish/raw/master/install.sh | bash`
|
||||
```sh
|
||||
curl https://gitlab.com/ceda_ei/wish/raw/master/install.sh | bash
|
||||
```
|
||||
|
||||
## Manual Installation
|
||||
|
||||
+ `cd ~/.config/`
|
||||
+ `git clone https://gitlab.com/ceda_ei/wish.git`
|
||||
+ Add the following lines to ~/.bashrc
|
||||
+ `cp wish/config.default.gie wish/config.gie`
|
||||
|
||||
# Customization
|
||||
|
||||
Customization of wish is done using a gINIe file (format specific to wish)
|
||||
which is an extended INI config file. The default location for config file is
|
||||
`~/.config/wish/config.gie`. The default config file is automatically copied
|
||||
over. The location can be customized using `WISH_CONFIG_FILE` variable.
|
||||
Multiple config files can be supplied as an array to `WISH_CONFIG_FILE`.
|
||||
|
||||
Comments start with a `#` or `;` and always exist on a line of their own.
|
||||
|
||||
Key value pairs are in the form of `key = value`. Keys cannot have whitespaces
|
||||
or `=` in them. Values can have any character as part of them. Surrounding
|
||||
spaces in values are stripped away. To keep surrounding spaces as a part of
|
||||
the value. Although, keys are case-sensitive in gINIe, wish treats them case-
|
||||
insensitively.
|
||||
|
||||
Block names are enclosed in `[]` (e.g. `[core]`). Block names are case
|
||||
sensitive. All key value pairs after a block starts and before the next block
|
||||
begins are considered a part of that block. All key value pairs must be in a
|
||||
block.
|
||||
|
||||
Available Blocks:
|
||||
|
||||
+ `core`: Core block configures Wish itself. Available keys are:
|
||||
- `auto_newline`: Automatically add a newline if last line of output
|
||||
doesn't end in newline. (0 to disable, 1 to enable)
|
||||
- `theme`: Wish theme.
|
||||
- `powerline`: Enable / Disable powerline. (0 to disable, 1 to enable)
|
||||
+ `plugin`: Adds a plugin to the section the block is added to. All config for
|
||||
that plugin goes there. Check wiki for details on available keys for
|
||||
plugins. The key "name" defines the plugin to use. Plugin blocks
|
||||
outside a section are ignored.
|
||||
|
||||
Section names are enclosed in `||` (e.g. `|left|`). All blocks after a section
|
||||
starts and before the next section begins are considered a part of that
|
||||
section. Blocks don't necessarily need to be in a section.
|
||||
|
||||
Available sections are `left`, `right` for left prompt and right prompt
|
||||
respectively.
|
||||
|
||||
Sample config file
|
||||
|
||||
```bash
|
||||
WISH_PLUGINS=(exit_code_smiley bg_jobs date path newline vcs)
|
||||
WISH_THEME=plain
|
||||
source ~/.config/wish/wish.sh
|
||||
```
|
||||
[core]
|
||||
auto_newline = 1
|
||||
powerline = 1
|
||||
theme = rgb_gradient
|
||||
|
||||
|left|
|
||||
[plugin]
|
||||
name = path_powerline
|
||||
max_perc = 50
|
||||
|
||||
[plugin]
|
||||
name = python_venv
|
||||
|
||||
[plugin]
|
||||
name = newline
|
||||
|
||||
[plugin]
|
||||
name = custom_text
|
||||
text = ' λ '
|
||||
|
||||
[plugin]
|
||||
name = space
|
||||
|
||||
|right|
|
||||
[plugin]
|
||||
name = date
|
||||
format = %a %b %H:%M
|
||||
|
||||
[plugin]
|
||||
name = hostname
|
||||
```
|
||||
|
||||
Which results in the following prompt
|
||||
|
||||

|
||||
|
||||
# Wiki
|
||||
|
||||
|
@@ -24,7 +24,7 @@ function wish_path_lensum() {
|
||||
function wish_path_powerline_shrink() {
|
||||
local IFS='/'
|
||||
local path=( $1 )
|
||||
local max=$2
|
||||
local max=$(( $2 - 3 * ${#path[@]} ))
|
||||
for ((i=0; i <$((${#path[@]} - 1)); i++)); do
|
||||
path[$i]=${path[$i]:0:1}
|
||||
if [[ $(wish_path_lensum ${path[@]}) -lt $max ]]; then
|
||||
|
@@ -13,7 +13,7 @@ function wish_python_venv_set_colors() {
|
||||
|
||||
function wish_python_venv_main() {
|
||||
if [[ -v VIRTUAL_ENV ]]; then
|
||||
local venv=$(echo $VIRTUAL_ENV | sed 's|.*/||')
|
||||
local venv=$(echo $VIRTUAL_ENV | sed ';s|/.venv$||;s|.*/||')
|
||||
wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG " $venv "
|
||||
else
|
||||
wish_append $WISH_PYTHON_VENV_BG $WISH_PYTHON_VENV_FG ""
|
||||
|
@@ -10,7 +10,7 @@ function wish_vcs_set_colors() {
|
||||
WISH_VCS_FG=${WISH_VCS_FG:-$WISH_DEFAULT_FG}
|
||||
WISH_VCS_BG=${WISH_VCS_BG:-$WISH_DEFAULT_BG}
|
||||
WISH_VCS_GIT_SYMBOL=${WISH_VCS_GIT:-}
|
||||
WISH_VCS_DEFAULT=${WISH_VCS_DEFAULT:-$}
|
||||
[[ -v WISH_VCS_DEFAULT ]] || WISH_VCS_DEFAULT="$"
|
||||
WISH_VCS_GIT_UNTRACKED_SYMBOL=${WISH_VCS_GIT_UNTRACKED_SYMBOL:-●}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ function wish_vcs_main() {
|
||||
fi
|
||||
wish_append $WISH_VCS_BG $WISH_VCS_FG "$git"
|
||||
else
|
||||
wish_append $WISH_VCS_BG $WISH_VCS_FG " $WISH_VCS_DEFAULT "
|
||||
wish_append $WISH_VCS_BG $WISH_VCS_FG "$WISH_VCS_DEFAULT"
|
||||
fi
|
||||
}
|
||||
|
||||
|
32
themes/icy_candy.sh
Normal file
32
themes/icy_candy.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function wish_icy_candy_theme {
|
||||
local i
|
||||
local l_gradient=(f5a9b8 f6b7c3 f8c5cf fad4db fbe2e7 fdf0f3 ffffff)
|
||||
local r_gradient=(5bcefa 76d6fa 91defb ade6fc c8eefd e3f6fe ffffff)
|
||||
local fg_gradient=(000000 000000 000000 000000 000000 000000 000000)
|
||||
local j=0
|
||||
for i in "${WISH_PLUGINS[@]}"; do
|
||||
[[ $i =~ newline$ ]] && j=0 && continue
|
||||
eval "WISH_${i^^}_FG=${fg_gradient[$j]}"
|
||||
eval "WISH_${i^^}_BG=${l_gradient[$j]}"
|
||||
((j++))
|
||||
if [[ $j -eq ${#l_gradient[@]} ]]; then
|
||||
j=0
|
||||
fi
|
||||
done
|
||||
|
||||
j=0
|
||||
for ((idx=$((${#WISH_RIGHT_PLUGINS[@]} - 1)); idx >= 0; idx--)); do
|
||||
i=${WISH_RIGHT_PLUGINS[$idx]}
|
||||
[[ $i =~ newline$ ]] && j=0 && continue
|
||||
eval "WISH_${i^^}_BG=${r_gradient[$j]}"
|
||||
eval "WISH_${i^^}_FG=${fg_gradient[$j]}"
|
||||
((j++))
|
||||
if [[ $j -eq ${#r_gradient[@]} ]]; then
|
||||
j=0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
wish_icy_candy_theme
|
31
themes/luminus.sh
Normal file
31
themes/luminus.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function wish_luminous_theme {
|
||||
local i
|
||||
local gradient=(ef7126 f7894c fea16f ffb892 ffd0b5 ffe7da ffffff)
|
||||
local fg_gradient=(000000 000000 000000 000000 000000 000000 000000)
|
||||
local j=0
|
||||
for i in "${WISH_PLUGINS[@]}"; do
|
||||
[[ $i =~ newline$ ]] && j=0 && continue
|
||||
eval "WISH_${i^^}_FG=${fg_gradient[$j]}"
|
||||
eval "WISH_${i^^}_BG=${gradient[$j]}"
|
||||
((j++))
|
||||
if [[ $j -eq ${#gradient[@]} ]]; then
|
||||
j=0
|
||||
fi
|
||||
done
|
||||
|
||||
j=0
|
||||
for ((idx=$((${#WISH_RIGHT_PLUGINS[@]} - 1)); idx >= 0; idx--)); do
|
||||
i=${WISH_RIGHT_PLUGINS[$idx]}
|
||||
[[ $i =~ newline$ ]] && j=0 && continue
|
||||
eval "WISH_${i^^}_BG=${gradient[$j]}"
|
||||
eval "WISH_${i^^}_FG=${fg_gradient[$j]}"
|
||||
((j++))
|
||||
if [[ $j -eq ${#gradient[@]} ]]; then
|
||||
j=0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
wish_luminous_theme
|
Reference in New Issue
Block a user