Update theme to be independent of oh-my-zsh.

This commit is contained in:
Ivan Bushchik 2023-02-05 12:33:40 +03:00
parent 6af1c38a3f
commit e4bbb17f03
No known key found for this signature in database
GPG key ID: 9F6DDABE11A2674D
4 changed files with 12 additions and 72 deletions

View file

@ -1,25 +1,19 @@
# ivabus-zsh-theme # ivabus-zsh-theme
Clean zsh prompt theme. Clean zsh prompt theme. Does not require oh-my-zsh anymore.
## Inside ## Features
- root indication - root indication
- exit codes - exit codes
- git info - oh-my-zsh independence
![Screenshot](/screenshot.png) ![Screenshot](/screenshot.png)
## How to install ## How to install
Install ivabus-zsh-theme via curl Copy ivabus.zsh-theme file to any location and `source` it in your `.zshrc` or just enable it each time you need it in your shell.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/install.sh)"
Install ivabus-zsh-theme via wget
sh -c "$(wget https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/install.sh -O -)"
## License ## License
[WTFPL](http://www.wtfpl.net) This zsh theme is distributed under Unlicense.

View file

@ -1,45 +0,0 @@
#!/bin/bash
if [ ! -f /bin/zsh ]
then
echo "You need to install zsh."
exit 255
fi
if [ ! -d $ZSH ]
then
echo "You need to install oh-my-zsh first."
read -p "Install (y/N)?: " INSTALL_OHMYZSH
if [[ $INSTALL_OHMYZSH == "n" || $INSTALL_OHMYZSH == "N" || $INSTALL_OHMYZSH == "" ]]
then
echo "Exiting"
exit 255
fi
fi
if [ -f $(which curl) ]
then
if [[ $INSTALL_OHMYZSH = "y" || $INSTALL_OHMYZSH = "Y" ]]
then
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi
curl -fsSL https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/ivabus.zsh-theme > ~/.oh-my-zsh/custom/themes/ivabus.zsh-theme
/usr/bin/env zsh -c "source $ZSH/oh-my-zsh.sh && omz theme set ivabus"
echo "Theme set"
exit 0
fi
if [ -f $(which wget) ]
then
if [[ $INSTALL_OHMYZSH = "y" || $INSTALL_OHMYZSH = "Y" ]]
then
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
fi
wget https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/ivabus.zsh-theme -O ~/.oh-my-zsh/custom/themes/ivabus.zsh-theme
/usr/bin/env zsh -c "source $ZSH/oh-my-zsh.sh && omz theme set ivabus"
echo "Theme set"
exit 0
fi
echo "Could not find a curl or wget. Install one of them, and then restart this script."
exit 255

View file

@ -2,29 +2,20 @@
__zsh_prompt() { __zsh_prompt() {
# set basic prompt with "USERNAME@HOSTNAME " # set basic prompt with "USERNAME@HOSTNAME "
if [[ $UID == 0 || $EUID == 0 ]]; then if [[ $UID == 0 || $EUID == 0 ]]; then
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[red]%}%m " PROMPT="%F{red}%n%f@%F{red}%m "
else else
PROMPT="%{$fg[green]%}%n%{$reset_color%}@%{$fg[cyan]%}%m " PROMPT="%F{green}%n%f@%F{cyan}%m "
fi fi
# add to current prompt arrow or [exitcode] if non 0 # add to current prompt arrow or [exitcode] if non 0
PROMPT+='%(?:%{$reset_color%}➜ :%{$fg_bold[red]%}%(?..[%?]) )' PROMPT+='%(?:%f➜ :%B%F{red}%(?..[%?]) )%b'
# add current working directory # add current working directory
PROMPT+='%{$fg_bold[blue]%}%(5~|%-1~/…/%3~|%4~)%{$reset_color%} ' PROMPT+='%B%F{blue}%(5~|%-1~/…/%3~|%4~)%f%b '
# and git status
PROMPT+='$(git_prompt_info)'
# add $ or # # add $ or #
if [[ $UID == 0 || $EUID == 0 ]]; then if [[ $UID == 0 || $EUID == 0 ]]; then
PROMPT+='%{$fg[red]%}# %{$reset_color%}' PROMPT+='%F{red}# %f'
else else
PROMPT+='%{$fg[white]%}$ %{$reset_color%}' PROMPT+='%F{white}$ %f'
fi fi
unset -f __zsh_prompt unset -f __zsh_prompt
} }
__zsh_prompt
# setup git status
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}(%{$fg_bold[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_bold[yellow]%}✗%{$fg_bold[cyan]%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[cyan]%}"
__zsh_prompt

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 26 KiB