mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Merge branch 'master' into rkj-repos-24hr-clock
This commit is contained in:
commit
a176f03572
61 changed files with 2089 additions and 905 deletions
|
|
@ -27,7 +27,7 @@ else
|
|||
fi
|
||||
|
||||
# git settings
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075](branch:"
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ else
|
|||
local user_symbol='$'
|
||||
fi
|
||||
|
||||
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
|
||||
local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}'
|
||||
local rvm_ruby=''
|
||||
if which rvm-prompt &> /dev/null; then
|
||||
rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ setopt prompt_subst
|
|||
autoload -U add-zsh-hook
|
||||
autoload -Uz vcs_info
|
||||
|
||||
#use extended color pallete if available
|
||||
#use extended color palette if available
|
||||
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
|
||||
turquoise="%F{81}"
|
||||
orange="%F{166}"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ else
|
|||
fi
|
||||
|
||||
# Get the host name (first 4 chars)
|
||||
HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,4] ➜ %{$fg_bold[cyan]%}%c "
|
||||
HOST_PROMPT_="%{$fg_bold[red]%}@$HOST ➜ %{$fg_bold[cyan]%}%c "
|
||||
GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}"
|
||||
PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,106 +1,10 @@
|
|||
#!/usr/bin/env zsh
|
||||
print -P '%F{yellow}'Oh My Zsh pure theme:
|
||||
cat <<-EOF
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# Pure - A minimal and beautiful theme for oh-my-zsh
|
||||
#
|
||||
# Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge
|
||||
# thanks goes out to him for designing the fantastic Pure prompt in the first
|
||||
# place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from
|
||||
# which I've borrowed both some ideas and some actual code. You can find out
|
||||
# more about both of these fantastic two people here:
|
||||
#
|
||||
# Sindre Sorhus
|
||||
# Github: https://github.com/sindresorhus
|
||||
# Twitter: https://twitter.com/sindresorhus
|
||||
#
|
||||
# Julien Nicoulaud
|
||||
# Github: https://github.com/nicoulaj
|
||||
# Twitter: https://twitter.com/nicoulaj
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
The pure theme has been renamed as 'refined' as per the original author's
|
||||
request. Change your ZSH_THEME to 'refined' to avoid seeing this warning.
|
||||
|
||||
# Set required options
|
||||
#
|
||||
setopt prompt_subst
|
||||
EOF
|
||||
print -P '%f'
|
||||
|
||||
# Load required modules
|
||||
#
|
||||
autoload -Uz vcs_info
|
||||
|
||||
# Set vcs_info parameters
|
||||
#
|
||||
zstyle ':vcs_info:*' enable hg bzr git
|
||||
zstyle ':vcs_info:*:*' unstagedstr '!'
|
||||
zstyle ':vcs_info:*:*' stagedstr '+'
|
||||
zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c"
|
||||
zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)"
|
||||
zstyle ':vcs_info:*:*' nvcsformats "%~" "" ""
|
||||
|
||||
# Fastest possible way to check if repo is dirty
|
||||
#
|
||||
git_dirty() {
|
||||
# Check if we're in a git repo
|
||||
command git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
# Check if it's dirty
|
||||
command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo "*"
|
||||
}
|
||||
|
||||
# Display information about the current repository
|
||||
#
|
||||
repo_information() {
|
||||
echo "%F{blue}${vcs_info_msg_0_%%/.} %F{8}$vcs_info_msg_1_`git_dirty` $vcs_info_msg_2_%f"
|
||||
}
|
||||
|
||||
# Displays the exec time of the last command if set threshold was exceeded
|
||||
#
|
||||
cmd_exec_time() {
|
||||
local stop=`date +%s`
|
||||
local start=${cmd_timestamp:-$stop}
|
||||
let local elapsed=$stop-$start
|
||||
[ $elapsed -gt 5 ] && echo ${elapsed}s
|
||||
}
|
||||
|
||||
# Get the intial timestamp for cmd_exec_time
|
||||
#
|
||||
preexec() {
|
||||
cmd_timestamp=`date +%s`
|
||||
}
|
||||
|
||||
# Output additional information about paths, repos and exec time
|
||||
#
|
||||
precmd() {
|
||||
vcs_info # Get version control info before we start outputting stuff
|
||||
print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f"
|
||||
}
|
||||
|
||||
# Define prompts
|
||||
#
|
||||
PROMPT="%(?.%F{magenta}.%F{red})❯%f " # Display a red prompt char on failure
|
||||
RPROMPT="%F{8}${SSH_TTY:+%n@%m}%f" # Display username if connected via SSH
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# List of vcs_info format strings:
|
||||
#
|
||||
# %b => current branch
|
||||
# %a => current action (rebase/merge)
|
||||
# %s => current version control system
|
||||
# %r => name of the root directory of the repository
|
||||
# %S => current path relative to the repository root directory
|
||||
# %m => in case of Git, show information about stashes
|
||||
# %u => show unstaged changes in the repository
|
||||
# %c => show staged changes in the repository
|
||||
#
|
||||
# List of prompt format strings:
|
||||
#
|
||||
# prompt:
|
||||
# %F => color dict
|
||||
# %f => reset color
|
||||
# %~ => current path
|
||||
# %* => time
|
||||
# %n => username
|
||||
# %m => shortname host
|
||||
# %(?..) => prompt conditional - %(condition.true.false)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
source ${0:h:A}/refined.zsh-theme
|
||||
|
|
|
|||
106
themes/refined.zsh-theme
Normal file
106
themes/refined.zsh-theme
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# Pure - A minimal and beautiful theme for oh-my-zsh
|
||||
#
|
||||
# Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge
|
||||
# thanks goes out to him for designing the fantastic Pure prompt in the first
|
||||
# place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from
|
||||
# which I've borrowed both some ideas and some actual code. You can find out
|
||||
# more about both of these fantastic two people here:
|
||||
#
|
||||
# Sindre Sorhus
|
||||
# Github: https://github.com/sindresorhus
|
||||
# Twitter: https://twitter.com/sindresorhus
|
||||
#
|
||||
# Julien Nicoulaud
|
||||
# Github: https://github.com/nicoulaj
|
||||
# Twitter: https://twitter.com/nicoulaj
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Set required options
|
||||
#
|
||||
setopt prompt_subst
|
||||
|
||||
# Load required modules
|
||||
#
|
||||
autoload -Uz vcs_info
|
||||
|
||||
# Set vcs_info parameters
|
||||
#
|
||||
zstyle ':vcs_info:*' enable hg bzr git
|
||||
zstyle ':vcs_info:*:*' unstagedstr '!'
|
||||
zstyle ':vcs_info:*:*' stagedstr '+'
|
||||
zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c"
|
||||
zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)"
|
||||
zstyle ':vcs_info:*:*' nvcsformats "%~" "" ""
|
||||
|
||||
# Fastest possible way to check if repo is dirty
|
||||
#
|
||||
git_dirty() {
|
||||
# Check if we're in a git repo
|
||||
command git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
# Check if it's dirty
|
||||
command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo "*"
|
||||
}
|
||||
|
||||
# Display information about the current repository
|
||||
#
|
||||
repo_information() {
|
||||
echo "%F{blue}${vcs_info_msg_0_%%/.} %F{8}$vcs_info_msg_1_`git_dirty` $vcs_info_msg_2_%f"
|
||||
}
|
||||
|
||||
# Displays the exec time of the last command if set threshold was exceeded
|
||||
#
|
||||
cmd_exec_time() {
|
||||
local stop=`date +%s`
|
||||
local start=${cmd_timestamp:-$stop}
|
||||
let local elapsed=$stop-$start
|
||||
[ $elapsed -gt 5 ] && echo ${elapsed}s
|
||||
}
|
||||
|
||||
# Get the initial timestamp for cmd_exec_time
|
||||
#
|
||||
preexec() {
|
||||
cmd_timestamp=`date +%s`
|
||||
}
|
||||
|
||||
# Output additional information about paths, repos and exec time
|
||||
#
|
||||
precmd() {
|
||||
vcs_info # Get version control info before we start outputting stuff
|
||||
print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f"
|
||||
}
|
||||
|
||||
# Define prompts
|
||||
#
|
||||
PROMPT="%(?.%F{magenta}.%F{red})❯%f " # Display a red prompt char on failure
|
||||
RPROMPT="%F{8}${SSH_TTY:+%n@%m}%f" # Display username if connected via SSH
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# List of vcs_info format strings:
|
||||
#
|
||||
# %b => current branch
|
||||
# %a => current action (rebase/merge)
|
||||
# %s => current version control system
|
||||
# %r => name of the root directory of the repository
|
||||
# %S => current path relative to the repository root directory
|
||||
# %m => in case of Git, show information about stashes
|
||||
# %u => show unstaged changes in the repository
|
||||
# %c => show staged changes in the repository
|
||||
#
|
||||
# List of prompt format strings:
|
||||
#
|
||||
# prompt:
|
||||
# %F => color dict
|
||||
# %f => reset color
|
||||
# %~ => current path
|
||||
# %* => time
|
||||
# %n => username
|
||||
# %m => shortname host
|
||||
# %(?..) => prompt conditional - %(condition.true.false)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
@ -23,22 +23,22 @@ function mygit() {
|
|||
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then
|
||||
ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX "
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)$(git_prompt_status)%{$fg_bold[blue]%}$ZSH_THEME_GIT_PROMPT_SUFFIX "
|
||||
fi
|
||||
}
|
||||
|
||||
function hour_format() {
|
||||
if [[ -z "${ISO8601_HOURS+x}" ]]; then
|
||||
echo "%I"
|
||||
function hour_format() {
|
||||
if [[ -z ${ISO8601_HOURS+x} ]]; then
|
||||
echo "I"
|
||||
else
|
||||
echo "%H"
|
||||
echo "H"
|
||||
fi
|
||||
}
|
||||
|
||||
function retcode() {}
|
||||
|
||||
# alternate prompt with git & hg
|
||||
PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d $(hour_format):%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
|
||||
%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b '
|
||||
PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %"$(hour_format)":%M:%S"}%b$'%{$fg_bold[blue]%}]
|
||||
%{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} '
|
||||
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ setopt prompt_subst
|
|||
autoload -U add-zsh-hook
|
||||
autoload -Uz vcs_info
|
||||
|
||||
#use extended color pallete if available
|
||||
#use extended color palette if available
|
||||
if [[ $terminfo[colors] -ge 256 ]]; then
|
||||
turquoise="%F{81}"
|
||||
orange="%F{166}"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ local c12=$(printf "\e[38;5;142m\e[1m")
|
|||
local c13=$(printf "\e[38;5;196m\e[1m")
|
||||
|
||||
|
||||
# We dont want to use the extended colorset in the TTY / VC.
|
||||
# We don't want to use the extended colorset in the TTY / VC.
|
||||
if [ "$TERM" = "linux" ]; then
|
||||
c1=$( printf "\e[34;1m")
|
||||
c2=$( printf "\e[35m")
|
||||
|
|
@ -71,7 +71,7 @@ prompt_jnrowe_precmd () {
|
|||
PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%}
|
||||
> '
|
||||
|
||||
# modified, to be commited
|
||||
# modified, to be committed
|
||||
elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then
|
||||
dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})"
|
||||
PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue