Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
cad48e38
Unverified
Commit
cad48e38
authored
Oct 24, 2019
by
Marc Cornellà
Committed by
GitHub
Oct 24, 2019
Browse files
Merge branch 'master' into fabric_task_description
parents
225425fe
40df67bc
Changes
562
Show whitespace changes
Inline
Side-by-side
plugins/zsh-navigation-tools/NEWS
0 → 100644
View file @
cad48e38
-------------------------------------
CHANGES FROM PREVIOUS VERSIONS OF ZNT
-------------------------------------
Changes from 2.2.1 to 2.2.7
---------------------------
Tmux integration has been added – bind file znt-tmux.zsh in Tmux as
described in README.md and e.g. run local history on remote hosts. Tmux
opens new window with n-history, and pastes selected history entry into
immediate previous window (e.g. a remote session). Fixed plugin.zsh file
to not use (outer scope) positional parameters. This fixes problem with
Grlm's Zsh configuration. The file now doesn't use "test" builtin (but
[[ instead), because it can be shadowed by alias or command. Private
history has been fixed to not overwrite its history file with the same
content. This improves performance when switching to private history
view.
plugins/zsh-navigation-tools/README.md
View file @
cad48e38
...
...
@@ -34,6 +34,60 @@ want to copy your previous data (from e.g. ~/.zhistory) into the new location.
## News
*
06-10-2016
-
Tmux-integration – Ctrl-b-h in Tmux to open n-history in new window.
Then select history entry, it will be copied to the original Tmux window.
Use this to execute local commands on remote hosts. All that is needed is
this line added to ~/.tmux.conf:
bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh"
*
16-05-2016
-
n-kill has completion. It proposes
*words*
from what's in
`ps -A`
. Giving n-kill
arguments means grepping – it will start only with matching
`ps`
entries.
*
15-05-2016
-
Fixed problem where zsh-syntax-highlighting could render n-history slow (for
long history entries).
*
14-05-2016
-
Configuration can be set from zshrc. Example:
znt_list_instant_select=1
znt_list_border=0
znt_list_bold=1
znt_list_colorpair="green/black"
znt_functions_keywords=( "zplg" "zgen" "match" )
znt_cd_active_text="underline"
znt_env_nlist_coloring_color=$'\x1b[00;33m'
znt_cd_hotlist=( "~/.config/znt" "/usr/share/zsh/site-functions" "/usr/share/zsh"
"/usr/local/share/zsh/site-functions" "/usr/local/share/zsh"
"/usr/local/bin" )
*
10-05-2016
-
Search query rotation – use Ctrl-A to rotate entered words right.
Words
`1 2 3`
become
`3 1 2`
.
*
09-05-2016
-
New feature: n-help tool, available also from n-history via H key. It
displays help screen with various information on ZNT.
*
08-05-2016
-
Approximate matching – pressing f or Ctrl-F will enter FIX mode, in
which 1 or 2 errors are allowed in what is searched. This utilizes
original Zsh approximate matching features and is intended to be used
after entering search query, when a typo is discovered.
*
06-05-2016
-
Private history can be edited. Use e key or Ctrl-E for that when in
n-history. Your $EDITOR will start. This is a way to have handy set
of bookmarks prepared in private history's file.
-
Border can be disabled. Use following snippet in ~/.config/znt/n-list.conf
or any other tool-targetted config file:
# Should draw the border?
local border=0
*
30-04-2016
-
New feature: color themes. Use Ctrl-T and Ctrl-G to browse predefined
themes. They are listed in ~/.config/znt/n-list.conf. Use the file to
...
...
plugins/zsh-navigation-tools/_n-kill
View file @
cad48e38
...
...
@@ -10,8 +10,8 @@ integer cygwin=0
local IFS="
"
case "$
(uname)
" in
CYGWIN
*) list=( `command ps -Wa` ); cygwin=1 ;;
case "$
OSTYPE
" in
cygwin
*) list=( `command ps -Wa` ); cygwin=1 ;;
*) list=( `command ps -o pid,uid,command -A` ) ;;
esac
...
...
plugins/zsh-navigation-tools/n-history
View file @
cad48e38
...
...
@@ -307,7 +307,7 @@ while (( 1 )); do
elif
[
"
$active_view
"
=
"1"
]
;
then
if
[
-s
"
$private_history_db
"
]
;
then
local
title
=
$'
\x
1b[00;32m'
"Private history:"
$'
\x
1b[00;00m
\0
'
()
{
fc
-ap
-R
"
$private_history_db
"
;
list
=(
"
$title
"
${
history
[@]
}
)
}
()
{
fc
-
R
ap
"
$private_history_db
"
20000 0
;
list
=(
"
$title
"
${
history
[@]
}
)
}
else
list
=(
"Private history - history entries selected via this tool will be put here"
)
fi
...
...
@@ -335,21 +335,37 @@ done
if
[
"
$REPLY
"
-gt
0
]
;
then
selected
=
"
$reply
[REPLY]"
# Append to private history
if
[[
"
$active_view
"
=
"0"
]]
;
then
local
newline
=
$'
\n
'
local
selected_ph
=
"
${
selected
//
$newline
/\\
$newline
}
"
print
-r
--
"
$selected_ph
"
>>
"
$private_history_db
"
fi
# TMUX?
if
[[
"
$ZNT_TMUX_MODE
"
=
"1"
]]
;
then
tmux send
-t
"
$ZNT_TMUX_ORIGIN_SESSION
:
$ZNT_TMUX_ORIGIN_WINDOW
.
$ZNT_TMUX_ORIGIN_PANE
"
"
$selected
"
tmux kill-window
return
0
# ZLE?
if
[
"
${
(t)CURSOR
}
"
=
"integer-local-special"
]
;
then
el
if
[
"
${
(t)CURSOR
}
"
=
"integer-local-special"
]
;
then
zle .redisplay
zle .kill-buffer
LBUFFER+
=
"
$selected
"
# Append to private history
local
newline
=
$'
\n
'
selected
=
"
${
selected
//
$newline
/\\
$newline
}
"
[
"
$active_view
"
=
"0"
]
&&
print
-r
--
"
$selected
"
>>
"
$private_history_db
"
else
print
-zr
--
"
$selected
"
fi
else
[
"
${
(t)CURSOR
}
"
=
"integer-local-special"
]
&&
zle redisplay
# TMUX?
if
[[
"
$ZNT_TMUX_MODE
"
=
"1"
]]
;
then
tmux kill-window
# ZLE?
elif
[[
"
${
(t)CURSOR
}
"
=
"integer-local-special"
]]
;
then
zle redisplay
fi
fi
return
0
# vim: set filetype=zsh:
plugins/zsh-navigation-tools/n-kill
View file @
cad48e38
...
...
@@ -42,8 +42,8 @@ NLIST_NONSELECTABLE_ELEMENTS=( 1 )
type
ps 2>/dev/null 1>&2
||
{
echo
>
&2
"Error:
\`
ps' not found"
;
return
1
}
case
"
$
(
uname
)
"
in
CYGWIN
*
)
list
=(
`
command
ps
-Wa
`
)
;;
case
"
$
OSTYPE
"
in
cygwin
*
)
list
=(
`
command
ps
-Wa
`
)
;;
*
)
list
=(
`
command
ps
-o
pid,uid,command
-A
`
)
;;
esac
...
...
plugins/zsh-navigation-tools/n-list
View file @
cad48e38
...
...
@@ -310,8 +310,9 @@ while (( 1 )); do
colsearch_pattern
=
"
${
search_buffer
// ##/|(#a2)
}
"
list
=(
"
${
(@M)list
:#
(#ia2)*
$~search_pattern
*
}
"
)
else
# Pattern
s
will be *foo*~^*bar*
and (foo|bar
)
# Pattern will be *foo*~^*bar*
(inventor: Mikael Magnusson
)
search_pattern
=
"
${
search_buffer
// ##/*~^*
}
"
# Pattern will be (foo|bar)
colsearch_pattern
=
"
${
search_buffer
// ##/|
}
"
list
=(
"
${
(@M)list
:#
(#i)*
$~search_pattern
*
}
"
)
fi
...
...
plugins/zsh-navigation-tools/znt-tmux.zsh
0 → 100755
View file @
cad48e38
#!/usr/bin/env zsh
# Copyright (c) 2016, Zsolt Lengyel
# Modifications copyright (c) 2016, Sebastian Gniazdowski
#
# This script opens a new, temporary tmux pane and runs n-history. When
# a selection is made, the result (history entry) is pasted back into
# original tmux pane, and the temporary pane is closed. This allows to
# use local history on remote machines.
#
# To use, put this line to your ~/.tmux.conf. The tool is invoked with:
# Ctrl+b h
#
# bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh"
#
# get and save the current active tmux pane id
active_pane
=
$(
tmux display
-p
-F
':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}'
)
a_active_pane
=(
"
${
(@s/
:/
)active_pane
}
"
)
active_session
=
${
a_active_pane
[2]//
$}
active_window=
$a_active_pane
[3]
active_pane=
$a_active_pane
[4]
# set variables for upcoming window
tmux setenv -t
$active_session
:
$active_window
.
$active_pane
"ZNT_TMUX_MODE"
1
tmux setenv -t
$active_session
:
$active_window
.
$active_pane
"ZNT_TMUX_ORIGIN_SESSION"
"
$active_session
"
tmux setenv -t
$active_session
:
$active_window
.
$active_pane
"ZNT_TMUX_ORIGIN_WINDOW"
"
$active_window
"
tmux setenv -t
$active_session
:
$active_window
.
$active_pane
"ZNT_TMUX_ORIGIN_PANE"
"
$active_pane
"
# create a new window in the active session and call it znt-hist
tmux new-window -t
$active_session
:
-n znt-hist
# unset the variables, so only above single window has them
tmux setenv -u -t
$active_session
:
$active_window
.
$active_pane
"ZNT_TMUX_MODE"
tmux setenv -u -t
$active_session
:
$active_window
.
$active_pane
"ZNT_TMUX_ORIGIN_SESSION"
tmux setenv -u -t
$active_session
:
$active_window
.
$active_pane
"ZNT_TMUX_ORIGIN_WINDOW"
tmux setenv -u -t
$active_session
:
$active_window
.
$active_pane
"ZNT_TMUX_ORIGIN_PANE"
# znt
's session id
znt_active_pane=$(tmux display -p -F '
:#
{session_id
}
:#I:#P:#
{
pane_active
}
:#
{
window_active
}
:#
{
session_attached
}
' )
znt_a_active_pane=("${(@s/:/)znt_active_pane}")
znt_active_session=${znt_a_active_pane[2]//$}
znt_active_window=$znt_a_active_pane[3]
znt_active_pane=$znt_a_active_pane[4]
# call znt
tmux send -t "$znt_active_session:$znt_active_window.$znt_active_pane" n-history ENTER
plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
100755 → 100644
View file @
cad48e38
#!/usr/bin/env zsh
REPO_DIR
=
"
${
0
%/*
}
"
CONFIG_DIR
=
"
$HOME
/.config/znt"
0
=
"
${
(%)
:-
%N
}
"
# this gives immunity to functionargzero being unset
export
ZNT_REPO_DIR
=
"
${
0
%/*
}
"
export
ZNT_CONFIG_DIR
=
"
$HOME
/.config/znt"
#
# Copy configs
#
if
!
test
-d
"
$HOME
/.config"
;
then
mkdir
"
$HOME
/.config"
if
[[
!
-d
"
$HOME
/.config"
]]
;
then
command
mkdir
"
$HOME
/.config"
fi
if
!
test
-d
"
$CONFIG_DIR
"
;
then
mkdir
"
$CONFIG_DIR
"
if
[[
!
-d
"
$
ZNT_
CONFIG_DIR
"
]]
;
then
command
mkdir
"
$
ZNT_
CONFIG_DIR
"
fi
# 9 files
set
n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf
unset
__ZNT_CONFIG_FILES
typeset
-ga
__ZNT_CONFIG_FILES
set
+A __ZNT_CONFIG_FILES n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf
# Check for random 2 files if they exist
# This will shift 0 - 7 elements
shift
$((
RANDOM
%
8
))
if
!
test
-f
"
$CONFIG_DIR
/
$
1
"
||
!
test
-f
"
$CONFIG_DIR
/
$
2
"
;
then
shift
$((
RANDOM
%
8
))
__ZNT_CONFIG_FILES
if
[[
!
-f
"
$
ZNT_
CONFIG_DIR
/
$
{
__ZNT_CONFIG_FILES
[1]
}
"
||
!
-f
"
$
ZNT_
CONFIG_DIR
/
$
{
__ZNT_CONFIG_FILES
[2]
}
"
]]
;
then
# Something changed - examine every file
set
n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf
for
i
;
do
if
!
test
-f
"
$CONFIG_DIR
/
$i
"
;
then
cp
"
$REPO_DIR
/.config/znt/
$i
"
"
$CONFIG_DIR
"
set
+A __ZNT_CONFIG_FILES n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf
unset
__ZNT_CONFIG_FILE
typeset
-g
__ZNT_CONFIG_FILE
for
__ZNT_CONFIG_FILE
in
"
${
__ZNT_CONFIG_FILES
[@]
}
"
;
do
if
[[
!
-f
"
$ZNT_CONFIG_DIR
/
$__ZNT_CONFIG_FILE
"
]]
;
then
command cp
"
$ZNT_REPO_DIR
/.config/znt/
$__ZNT_CONFIG_FILE
"
"
$ZNT_CONFIG_DIR
"
fi
done
unset
__ZNT_CONFIG_FILE
fi
# Don't leave positional parameters being set
set
--
unset
__ZNT_CONFIG_FILES
#
# Load functions
...
...
plugins/zsh_reload/README.md
0 → 100644
View file @
cad48e38
# zsh_reload plugin
The zsh_reload plugin defines a function to reload the zsh session with
just a few keystrokes.
To use it, add
`zsh_reload`
to the plugins array in your zshrc file:
```
zsh
plugins
=(
... zsh_reload
)
```
## Usage
To reload the zsh session, just run
`src`
:
```
zsh
$
vim ~/.zshrc
# enabled a plugin
$
src
re-compiling /home/user/.zshrc.zwc: succeeded
re-compiling /home/user/.oh-my-zsh/cache/zcomp-host.zwc: succeeded
# you now have a fresh zsh session. happy hacking!
```
plugins/zsh_reload/zsh_reload.plugin.zsh
View file @
cad48e38
# reload zshrc
function
src
()
{
local
cache
=
$ZSH_CACHE_DIR
src
()
{
local
cache
=
"
$ZSH_CACHE_DIR
"
autoload
-U
compinit zrecompile
compinit
-d
"
$cache
/zcomp-
$HOST
"
compinit
-i
-d
"
$cache
/zcomp-
$HOST
"
for
f
in
~/.zshrc
"
$cache
/zcomp-
$HOST
"
;
do
zrecompile
-p
$f
&&
command rm
-f
$f
.zwc.old
done
source
~/.zshrc
# Use $SHELL if available; remove leading dash if login shell
[[
-n
"
$SHELL
"
]]
&&
exec
${
SHELL
#-
}
||
exec
zsh
}
templates/zshrc.zsh-template
View file @
cad48e38
...
...
@@ -4,24 +4,37 @@
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
Case
# sensitive completion must be off. _ and - will be interchangeable.
# Uncomment the following line to use hyphen-insensitive completion.
#
Case-
sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
...
...
@@ -41,13 +54,17 @@ ZSH_THEME="robbyrussell"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
...
...
@@ -72,9 +89,6 @@ source $ZSH/oh-my-zsh.sh
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
...
...
themes/3den.zsh-theme
View file @
cad48e38
PROMPT=$'%{$fg[white]%}$(
~/.rvm/bin/rvm-
prompt) %{$fg_bold[cyan]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[cyan]%}%D{[%I:%M:%S]}\
PROMPT=$'%{$fg[white]%}$(
ruby_
prompt
_info
) %{$fg_bold[cyan]%}%~%{$reset_color%}$(git_prompt_info) %{$fg[cyan]%}%D{[%I:%M:%S]}\
%{$fg_bold[green]%}%n$%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}("
...
...
themes/adben.zsh-theme
View file @
cad48e38
...
...
@@ -6,7 +6,7 @@
# # a) displaying a pseudo-random message from a database of quotations
# # (https://en.wikipedia.org/wiki/Fortune_%28Unix%29)
# # b) displaying randomly command line tips from The command line fu
# # (http://www.commandlinefu.com) community: in order to make use of this functionality
# # (http
s
://www.commandlinefu.com) community: in order to make use of this functionality
# # you will need Internet connection.
# # This theme provides as well information for the current user's context, like;
# # branch and status for the current version control system (git and svn currently
...
...
@@ -23,11 +23,11 @@
# # optionally:
# # -Oh-myzsh vcs plug-ins git and svn.
# # -Solarized theme (https://github.com/altercation/solarized/)
# # -OS X: iTerm 2 (http://
www.
iterm2.com/)
# # -OS X: iTerm 2 (http
s
://iterm2.com/)
# # -font Source code pro (https://github.com/adobe/source-code-pro)
# #
# # This theme's look and feel is based on the Aaron Toponce's zsh theme, more info:
# # http://pthree.org/2008/11/23/727/
# # http
s
://pthree.org/2008/11/23/727/
# # enjoy!
########## COLOR ###########
for
COLOR
in
CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY
;
do
...
...
themes/af-magic.zsh-theme
View file @
cad48e38
...
...
@@ -6,9 +6,9 @@ if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
# primary prompt
PROMPT='$FG[237]
------------------------------------------------------------
%{$reset_color%}
PROMPT='$FG[237]
${(l.COLUMNS..-.)}
%{$reset_color%}
$FG[032]%~\
$(git_prompt_info) \
$(git_prompt_info)
$(hg_prompt_info)
\
$FG[105]%(!.#.»)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='${return_code}'
...
...
@@ -21,13 +21,19 @@ eval my_orange='$FG[214]'
# right prompt
if type "virtualenv_prompt_info" > /dev/null
then
RPROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%'
RPROMPT='$
FG[078]$
(virtualenv_prompt_info)
%{$reset_color%}
$my_gray%n@%m%{$reset_color%}%'
else
RPROMPT='$my_gray%n@%m%{$reset_color%}%'
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%}"
# hg settings
ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]"
ZSH_THEME_HG_PROMPT_CLEAN=""
ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
themes/agnoster.zsh-theme
View file @
cad48e38
...
...
@@ -13,9 +13,13 @@
#
# In addition, I recommend the
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're
# using it on Mac OS X, [iTerm 2](http://
www.
iterm2.com/) over Terminal.app -
# using it on Mac OS X, [iTerm 2](http
s
://iterm2.com/) over Terminal.app -
# it has significantly better color fidelity.
#
# If using with "light" variant of the Solarized color schema, set
# SOLARIZED_THEME variable to "light". If you don't specify, we'll assume
# you're using the "dark" variant.
#
# # Goals
#
# The aim of this theme is to only show you *relevant* information. Like most
...
...
@@ -30,6 +34,11 @@
CURRENT_BG
=
'NONE'
case
${
SOLARIZED_THEME
:-
dark
}
in
light
)
CURRENT_FG
=
'white'
;;
*
)
CURRENT_FG
=
'black'
;;
esac
# Special Powerline characters
()
{
...
...
@@ -80,28 +89,31 @@ prompt_end() {
# Context: user@hostname (who am I and where am I)
prompt_context
()
{
if
[[
"
$USER
"
!=
"
$DEFAULT_USER
"
||
-n
"
$SSH_CLIENT
"
]]
;
then
prompt_segment black default
"%(!.%{%F{yellow}%}.)
$USER
@%m"
prompt_segment black default
"%(!.%{%F{yellow}%}.)
%n
@%m"
fi
}
# Git: branch/detached head, dirty status
prompt_git
()
{
((
$+
commands[git]
))
||
return
if
[[
"
$(
git config
--get
oh-my-zsh.hide-status 2>/dev/null
)
"
=
1
]]
;
then
return
fi
local
PL_BRANCH_CHAR
()
{
local
LC_ALL
=
""
LC_CTYPE
=
"en_US.UTF-8"
PL_BRANCH_CHAR
=
$'
\u
e0a0'
#
}
local
ref dirty mode repo_path
repo_path
=
$(
git rev-parse
--git-dir
2>/dev/null
)
if
$(
git rev-parse
--is-inside-work-tree
>
/dev/null 2>&1
)
;
then
repo_path
=
$(
git rev-parse
--git-dir
2>/dev/null
)
dirty
=
$(
parse_git_dirty
)
ref
=
$(
git symbolic-ref HEAD 2> /dev/null
)
||
ref
=
"➦
$(
git rev-parse
--short
HEAD 2> /dev/null
)
"
if
[[
-n
$dirty
]]
;
then
prompt_segment yellow black
else
prompt_segment green
black
prompt_segment green
$CURRENT_FG
fi
if
[[
-e
"
${
repo_path
}
/BISECT_LOG"
]]
;
then
...
...
@@ -140,7 +152,6 @@ prompt_bzr() {
if
[[
$status_all
-gt
0
]]
;
then
prompt_segment yellow black
echo
-n
"bzr@"
$revision
else
prompt_segment green black
echo
-n
"bzr@"
$revision
...
...
@@ -151,7 +162,7 @@ prompt_bzr() {
prompt_hg
()
{
((
$+
commands[hg]
))
||
return
local
rev st
atus
local
rev st
branch
if
$(
hg
id
>
/dev/null 2>&1
)
;
then
if
$(
hg prompt
>
/dev/null 2>&1
)
;
then
if
[[
$(
hg prompt
"{status|unknown}"
)
=
"?"
]]
;
then
...
...
@@ -164,7 +175,7 @@ prompt_hg() {
st
=
'±'
else
# if working copy is clean
prompt_segment green
black
prompt_segment green
$CURRENT_FG
fi
echo
-n
$(
hg prompt
"☿ {rev}@{branch}"
)
$st
else
...
...
@@ -178,7 +189,7 @@ prompt_hg() {
prompt_segment yellow black
st
=
'±'
else
prompt_segment green
black
prompt_segment green
$CURRENT_FG
fi
echo
-n
"☿
$rev
@
$branch
"
$st
fi
...
...
@@ -187,7 +198,7 @@ prompt_hg() {
# Dir: current working directory
prompt_dir
()
{
prompt_segment blue
black
'%~'
prompt_segment blue
$CURRENT_FG
'%~'
}
# Virtualenv: current working virtualenv
...
...
@@ -203,8 +214,8 @@ prompt_virtualenv() {
# - am I root
# - are there background jobs?
prompt_status
()
{
local
symbols
symbols
=()
local
-a
symbols
[[
$RETVAL
-ne
0
]]
&&
symbols+
=
"%{%F{red}%}✘"
[[
$UID
-eq
0
]]
&&
symbols+
=
"%{%F{yellow}%}⚡"
[[
$(
jobs
-l
|
wc
-l
)
-gt
0
]]
&&
symbols+
=
"%{%F{cyan}%}⚙"
...
...
@@ -212,11 +223,25 @@ prompt_status() {
[[
-n
"
$symbols
"
]]
&&
prompt_segment black default
"
$symbols
"
}
#AWS Profile:
# - display current AWS_PROFILE name
# - displays yellow on red if profile name contains 'production' or
# ends in '-prod'
# - displays black on green otherwise
prompt_aws
()
{
[[
-z
"
$AWS_PROFILE
"
]]
&&
return
case
"
$AWS_PROFILE
"
in
*
-prod
|
*
production
*
)
prompt_segment red yellow
"AWS:
$AWS_PROFILE
"
;;
*
)
prompt_segment green black
"AWS:
$AWS_PROFILE
"
;;
esac
}
## Main prompt
build_prompt
()
{
RETVAL
=
$?
prompt_status
prompt_virtualenv
prompt_aws
prompt_context
prompt_dir
prompt_git
...
...
themes/alanpeabody.zsh-theme
View file @
cad48e38
local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
local pwd='%{$fg[blue]%}%~%{$reset_color%}'
local rvm=''
if which rvm-prompt &> /dev/null; then
rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}'
else
if which rbenv &> /dev/null; then
rvm='%{$fg[green]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
fi
fi
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=""
...
...
@@ -24,5 +17,8 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[green]%}‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%{$reset_color%}"
PROMPT="${user} ${pwd}$ "
RPROMPT="${return_code} ${git_branch}
${rvm}
"
RPROMPT="${return_code} ${git_branch}
\$(ruby_prompt_info)
"
themes/amuse.zsh-theme
View file @
cad48e38
# vim:ft=zsh ts=2 sw=2 sts=2
rvm_current
()
{
rvm current 2>/dev/null
}
rbenv_version
()
{
rbenv version 2>/dev/null |
awk
'{print $1}'
}
PROMPT
=
'
%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
$ '
# Must use Powerline font, for \uE0A0 to render.
ZSH_THEME_GIT_PROMPT_PREFIX
=
" on %{
$fg
[magenta]%}
\u
E0A0 "
ZSH_THEME_GIT_PROMPT_SUFFIX
=
"%{
$reset_color
%}"
...
...
@@ -19,11 +7,12 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
ZSH_THEME_GIT_PROMPT_UNTRACKED
=
"%{
$fg
[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN
=
""
if
[
-e
~/.rvm/bin/rvm-prompt
]
;
then
RPROMPT
=
'%{$fg_bold[red]%}‹$(rvm_current)›%{$reset_color%}'
else
if
which rbenv &> /dev/null
;
then
RPROMPT
=
'%{$fg_bold[red]%}$(rbenv_version)%{$reset_color%}'
fi
fi
ZSH_THEME_RUBY_PROMPT_PREFIX
=
"%{
$fg_bold
[red]%}‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX
=
"›%{
$reset_color
%}"
PROMPT
=
'
%{$fg_bold[green]%}%~%{$reset_color%}$(git_prompt_info) ⌚ %{$fg_bold[red]%}%*%{$reset_color%}
$ '
RPROMPT
=
'$(ruby_prompt_info)'
themes/arrow.zsh-theme
View file @
cad48e38
...
...
@@ -8,7 +8,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="*"
ZSH_THEME_GIT_PROMPT_CLEAN=""
# See http://geoff.greer.fm/lscolors/
# See http
s
://geoff.greer.fm/lscolors/
export LSCOLORS="exfxcxdxbxbxbxbxbxbxbx"
export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=31;40:cd=31;40:su=31;40:sg=31;40:tw=31;40:ow=31;40:"
themes/avit.zsh-theme
View file @
cad48e38
...
...
@@ -50,9 +50,7 @@ function _ruby_version() {
# use a neutral color, otherwise colors will vary according to time.
function _git_time_since_commit() {
# Only proceed if there is actually a commit.
if git log -1 > /dev/null 2>&1; then
# Get the last commit.
last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null)
if last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null); then
now=$(date +%s)
seconds_since_last_commit=$((now-last_commit))
...
...
@@ -65,7 +63,7 @@ function _git_time_since_commit() {
sub_hours=$((hours % 24))
sub_minutes=$((minutes % 60))
if [ $hours -g
t
24 ]; then
if [ $hours -g
e
24 ]; then
commit_age="${days}d"
elif [ $minutes -gt 60 ]; then
commit_age="${sub_hours}h${sub_minutes}m"
...
...
@@ -104,7 +102,7 @@ ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}"
# LS colors, made with http://geoff.greer.fm/lscolors/
# LS colors, made with http
s
://geoff.greer.fm/lscolors/
export LSCOLORS="exfxcxdxbxegedabagacad"
export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:'
export GREP_COLOR='1;33'
themes/bira.zsh-theme
View file @
cad48e38
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
# ZSH Theme - Preview: http
s
://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}'
local user_symbol='#'
else
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}'
local user_symbol='$'
fi
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%}'
else
if which rbenv &> /dev/null; then
rvm_ruby='%{$fg[red]%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$reset_color%}'
fi
fi
local git_branch='$(git_prompt_info)%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}'
local git_branch='$(git_prompt_info)'
local rvm_ruby='$(ruby_prompt_info)'
local venv_prompt='$(virtualenv_prompt_info)'
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
╰─%B$%b "
RPS1="${return_code}"
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt}
╰─%B${user_symbol}%b "
RPROMPT="%B${return_code}%b"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX
ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX
Prev
1
…
21
22
23
24
25
26
27
28
29
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment