mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
Merge branch 'master' into dritter/mercurial_support
This commit is contained in:
commit
3b6402d9b1
2 changed files with 42 additions and 29 deletions
23
README.md
23
README.md
|
@ -41,25 +41,30 @@ here](https://powerline.readthedocs.org/en/latest/installation/linux.html#fonts-
|
||||||
You can also find the raw font files [in this Github
|
You can also find the raw font files [in this Github
|
||||||
repository](https://github.com/powerline/fonts).
|
repository](https://github.com/powerline/fonts).
|
||||||
|
|
||||||
To install this theme, drop the `.zsh-theme` file into your `.oh-my-zsh/themes`
|
To install this theme, drop the `.zsh-theme` file into your `.oh-my-zsh/custom/themes`
|
||||||
directory. A better form of installation is to clone this repository and then
|
directory:
|
||||||
create a symlink in your 'themes' directory:
|
|
||||||
|
|
||||||
$ git clone https://github.com/bhilburn/powerlevel9k.git powerlevel9k.git
|
$ cd ~/.oh-my-zsh/custom/themes
|
||||||
$ ln -s powerlevel9k.git/powerlevel9k.zsh-theme ~/.oh-my-zsh/themes/powerlevel9k.zsh-theme
|
$ git clone https://github.com/bhilburn/powerlevel9k.git powerlevel9k
|
||||||
|
|
||||||
Note that *you cannot clone this repository into your `~/.oh-my-zsh/themes/` directory*.
|
|
||||||
Oh-My-Zsh does not traverse subdirectories for themes, and will not find your theme.
|
|
||||||
|
|
||||||
You then need to select it in your `~/.zshrc`:
|
You then need to select it in your `~/.zshrc`:
|
||||||
|
|
||||||
ZSH_THEME="powerlevel9k"
|
ZSH_THEME="powerlevel9k/powerlevel9k"
|
||||||
|
|
||||||
If you do not want to display the `user@host` string, you should also put this
|
If you do not want to display the `user@host` string, you should also put this
|
||||||
in your `~/.zshrc`:
|
in your `~/.zshrc`:
|
||||||
|
|
||||||
export DEFAULT_USER=<your username>
|
export DEFAULT_USER=<your username>
|
||||||
|
|
||||||
|
### Customization
|
||||||
|
|
||||||
|
You can choose which segments are shown on each side. Just add the following variables to
|
||||||
|
your `~/.zshrc`. The below also shows the default settings if you don't define
|
||||||
|
your own.
|
||||||
|
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir git)
|
||||||
|
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time)
|
||||||
|
|
||||||
### Bugs / Contact
|
### Bugs / Contact
|
||||||
|
|
||||||
If you have any requests or bug reports, please use the tracker in this Github
|
If you have any requests or bug reports, please use the tracker in this Github
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#
|
#
|
||||||
# This theme was inspired by agnoster's Theme:
|
# This theme was inspired by agnoster's Theme:
|
||||||
# https://gist.github.com/3712874
|
# https://gist.github.com/3712874
|
||||||
#
|
#
|
||||||
# The `vcs_info` hooks in this file are from Tom Upton:
|
# The `vcs_info` hooks in this file are from Tom Upton:
|
||||||
# https://github.com/tupton/dotfiles/blob/master/zsh/zshrc
|
# https://github.com/tupton/dotfiles/blob/master/zsh/zshrc
|
||||||
#
|
#
|
||||||
|
@ -91,7 +91,7 @@ right_prompt_segment() {
|
||||||
# Note that if $DEFAULT_USER is not set, this prompt segment will always print
|
# Note that if $DEFAULT_USER is not set, this prompt segment will always print
|
||||||
prompt_context() {
|
prompt_context() {
|
||||||
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
||||||
left_prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
|
$1_prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,9 +102,9 @@ prompt_git() {
|
||||||
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||||
dirty=$(parse_git_dirty)
|
dirty=$(parse_git_dirty)
|
||||||
if [[ -n $dirty ]]; then
|
if [[ -n $dirty ]]; then
|
||||||
left_prompt_segment yellow black
|
$1_prompt_segment yellow black
|
||||||
else
|
else
|
||||||
left_prompt_segment green black
|
$1_prompt_segment green black
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "${vcs_info_msg_0_}"
|
echo -n "${vcs_info_msg_0_}"
|
||||||
|
@ -162,7 +162,7 @@ function +vi-git-tagname() {
|
||||||
|
|
||||||
# Dir: current working directory
|
# Dir: current working directory
|
||||||
prompt_dir() {
|
prompt_dir() {
|
||||||
left_prompt_segment blue black '%~'
|
$1_prompt_segment blue black '%~'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Virtualenv: current working virtualenv
|
# Virtualenv: current working virtualenv
|
||||||
|
@ -171,7 +171,7 @@ prompt_dir() {
|
||||||
prompt_virtualenv() {
|
prompt_virtualenv() {
|
||||||
local virtualenv_path="$VIRTUAL_ENV"
|
local virtualenv_path="$VIRTUAL_ENV"
|
||||||
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
|
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
|
||||||
left_prompt_segment blue black "(`basename $virtualenv_path`)"
|
$1_prompt_segment blue black "(`basename $virtualenv_path`)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,13 +184,13 @@ prompt_status() {
|
||||||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
||||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||||
|
|
||||||
[[ -n "$symbols" ]] && left_prompt_segment black default "$symbols"
|
[[ -n "$symbols" ]] && $1_prompt_segment black default "$symbols"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Right Status: (return code, root status, background jobs)
|
# Right Status: (return code, root status, background jobs)
|
||||||
# This creates a status segment for the *right* prompt. Exact same thing as
|
# This creates a status segment for the *right* prompt. Exact same thing as
|
||||||
# above - just other side.
|
# above - just other side.
|
||||||
rprompt_status() {
|
prompt_longstatus() {
|
||||||
local symbols bg
|
local symbols bg
|
||||||
symbols=()
|
symbols=()
|
||||||
|
|
||||||
|
@ -205,17 +205,17 @@ rprompt_status() {
|
||||||
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
|
||||||
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
|
||||||
|
|
||||||
[[ -n "$symbols" ]] && right_prompt_segment $bg default "$symbols"
|
[[ -n "$symbols" ]] && $1_prompt_segment $bg default "$symbols"
|
||||||
}
|
}
|
||||||
|
|
||||||
# System time
|
# System time
|
||||||
prompt_time() {
|
prompt_time() {
|
||||||
right_prompt_segment white black '%D{%H:%M:%S} '
|
$1_prompt_segment white black '%D{%H:%M:%S} '
|
||||||
}
|
}
|
||||||
|
|
||||||
# Command number (in local history)
|
# Command number (in local history)
|
||||||
prompt_history() {
|
prompt_history() {
|
||||||
right_prompt_segment "244" black '%h'
|
$1_prompt_segment "244" black '%h'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ruby Version Manager information
|
# Ruby Version Manager information
|
||||||
|
@ -223,26 +223,34 @@ prompt_rvm() {
|
||||||
local rvm_prompt
|
local rvm_prompt
|
||||||
rvm_prompt=`rvm-prompt`
|
rvm_prompt=`rvm-prompt`
|
||||||
if [ "$rvm_prompt" != "" ]; then
|
if [ "$rvm_prompt" != "" ]; then
|
||||||
left_prompt_segment "240" white "$rvm_prompt "
|
$1_prompt_segment "240" white "$rvm_prompt "
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main prompt
|
# Main prompt
|
||||||
build_left_prompt() {
|
build_left_prompt() {
|
||||||
#prompt_virtualenv
|
if (( ${#POWERLEVEL9K_LEFT_PROMPT_ELEMENTS} == 0 )); then
|
||||||
prompt_context
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir git)
|
||||||
prompt_dir
|
fi
|
||||||
prompt_git
|
|
||||||
#prompt_rvm
|
for element in $POWERLEVEL9K_LEFT_PROMPT_ELEMENTS; do
|
||||||
|
prompt_$element "left"
|
||||||
|
done
|
||||||
|
|
||||||
left_prompt_end
|
left_prompt_end
|
||||||
}
|
}
|
||||||
|
|
||||||
# Right prompt
|
# Right prompt
|
||||||
build_right_prompt() {
|
build_right_prompt() {
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
rprompt_status
|
|
||||||
prompt_history
|
if (( ${#POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS} == 0 )); then
|
||||||
prompt_time
|
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(longstatus history time)
|
||||||
|
fi
|
||||||
|
|
||||||
|
for element in $POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS; do
|
||||||
|
prompt_$element "right"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create the prompts
|
# Create the prompts
|
||||||
|
|
Loading…
Reference in a new issue