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
7f75bb90
Commit
7f75bb90
authored
Nov 06, 2014
by
Robby Russell
Browse files
Merge pull request #3223 from mcornella/use-special-vars
Use special variables where we can
parents
7034b01c
95d795e8
Changes
21
Show whitespace changes
Inline
Side-by-side
lib/completion.zsh
View file @
7f75bb90
...
...
@@ -27,9 +27,9 @@ zstyle ':completion:*:*:*:*:*' menu select
zstyle
':completion:*:*:kill:*:processes'
list-colors
'=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
if
[
"
$OSTYPE
[0,7]"
=
"solaris"
]
then
zstyle
':completion:*:*:*:*:processes'
command
"ps -u
`
whoami
`
-o pid,user,comm"
zstyle
':completion:*:*:*:*:processes'
command
"ps -u
$USER
-o pid,user,comm"
else
zstyle
':completion:*:*:*:*:processes'
command
"ps -u
`
whoami
`
-o pid,user,comm -w -w"
zstyle
':completion:*:*:*:*:processes'
command
"ps -u
$USER
-o pid,user,comm -w -w"
fi
# disable named-directories autocompletion
...
...
plugins/dirhistory/dirhistory.plugin.zsh
View file @
7f75bb90
...
...
@@ -3,7 +3,7 @@
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
#
dirhistory_past
=(
`
pwd
`
)
dirhistory_past
=(
$PWD
)
dirhistory_future
=()
export
dirhistory_past
export
dirhistory_future
...
...
@@ -50,7 +50,7 @@ function push_future() {
# Called by zsh when directory changes
function
chpwd
()
{
push_past
`
pwd
`
push_past
$PWD
# If DIRHISTORY_CD is not set...
if
[[
-z
"
${
DIRHISTORY_CD
+x
}
"
]]
;
then
# ... clear future.
...
...
@@ -73,7 +73,7 @@ function dirhistory_back() {
pop_past cw
if
[[
""
==
"
$cw
"
]]
;
then
# Someone overwrote our variable. Recover it.
dirhistory_past
=(
`
pwd
`
)
dirhistory_past
=(
$PWD
)
return
fi
...
...
plugins/jump/jump.plugin.zsh
View file @
7f75bb90
...
...
@@ -14,12 +14,12 @@ jump() {
mark
()
{
if
((
$#
==
0
))
;
then
MARK
=
$(
basename
"
$
(
pwd
)
"
)
MARK
=
$(
basename
"
$
PWD
"
)
else
MARK
=
"
$1
"
fi
if
read
-q
\?
"Mark
$
(
pwd
)
as
${
MARK
}
? (y/n) "
;
then
mkdir
-p
"
$MARKPATH
"
;
ln
-s
"
$
(
pwd
)
"
"
$MARKPATH
/
$MARK
"
if
read
-q
\?
"Mark
$
PWD
as
${
MARK
}
? (y/n) "
;
then
mkdir
-p
"
$MARKPATH
"
;
ln
-s
"
$
PWD
"
"
$MARKPATH
/
$MARK
"
fi
}
...
...
plugins/pow/pow.plugin.zsh
View file @
7f75bb90
...
...
@@ -21,13 +21,13 @@
rack_root
(){
setopt chaselinks
local
orgdir
=
"
$
(
pwd
)
"
local
basedir
=
"
$
(
pwd
)
"
local
orgdir
=
"
$
PWD
"
local
basedir
=
"
$
PWD
"
while
[[
$basedir
!=
'/'
]]
;
do
test
-e
"
$basedir
/config.ru"
&&
break
builtin cd
".."
2>/dev/null
basedir
=
"
$
(
pwd
)
"
basedir
=
"
$
PWD
"
done
builtin cd
"
$orgdir
"
2>/dev/null
...
...
@@ -56,7 +56,7 @@ kapow(){
compctl
-W
~/.pow -/ kapow
powit
(){
local
basedir
=
"
$
(
pwd
)
"
local
basedir
=
"
$
PWD
"
local
vhost
=
$1
[
!
-n
"
$vhost
"
]
&&
vhost
=
$(
rack_root_detect
)
if
[
!
-h
~/.pow/
$vhost
]
...
...
plugins/profiles/profiles.plugin.zsh
View file @
7f75bb90
...
...
@@ -2,7 +2,7 @@
# This will look for a custom profile for the local machine and each domain or
# subdomain it belongs to. (e.g. com, example.com and foo.example.com)
parts
=(
${
(s
:.:
)
$
(
hostname
)
}
)
parts
=(
${
(s
:.:
)
$
HOST
}
)
for
i
in
{
${#
parts
}
..1
}
;
do
profile
=
${
(j
:.:
)
${
parts
[
$i
,
${#
parts
}
]
}}
file
=
$ZSH_CUSTOM
/profiles/
$profile
...
...
plugins/svn/svn.plugin.zsh
View file @
7f75bb90
...
...
@@ -77,7 +77,7 @@ function svn_dirty() {
function
svn_dirty_choose_pwd
()
{
if
in_svn
;
then
root
=
`
pwd
`
root
=
$PWD
if
$(
svn status
$root
2> /dev/null |
grep
-Eq
'^\s*[ACDIM!?L]'
)
;
then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo
$1
...
...
plugins/systemadmin/systemadmin.plugin.zsh
View file @
7f75bb90
...
...
@@ -30,7 +30,7 @@ function retlog() {
}
alias
ping
=
'ping -c 5'
alias
clr
=
'clear;echo "Currently logged in on $(tty), as $
(whoami)
in directory $
(pwd)
."'
alias
clr
=
'clear;echo "Currently logged in on $(tty), as $
USER
in directory $
PWD
."'
alias
path
=
'echo -e ${PATH//:/\\n}'
alias mkdir
=
'mkdir -pv'
# get top process eating memory
...
...
plugins/vim-interaction/vim-interaction.plugin.zsh
View file @
7f75bb90
...
...
@@ -9,7 +9,7 @@ function resolveFile
if
[
-f
"
$1
"
]
;
then
echo
$(
readlink
-f
"
$1
"
)
elif
[[
"
${
1
#/
}
"
==
"
$1
"
]]
;
then
echo
"
$
(
pwd
)
/
$1
"
echo
"
$
PWD
/
$1
"
else
echo
$1
fi
...
...
themes/adben.zsh-theme
View file @
7f75bb90
...
...
@@ -89,9 +89,8 @@ function precmd {
# Context: user@directory or just directory
prompt_context
()
{
local
user
=
`
whoami
`
if
[[
"
$user
"
!=
"
$DEFAULT_USER
"
||
-n
"
$SSH_CLIENT
"
]]
;
then
echo
-n
"
${
PR_RESET
}${
PR_RED
}
$user
@%m
${
PR_RESET
}${
PR_BRIGHT_YELLOW
}
%~%<<
${
PR_RESET
}
"
if
[[
"
$USER
"
!=
"
$DEFAULT_USER
"
||
-n
"
$SSH_CLIENT
"
]]
;
then
echo
-n
"
${
PR_RESET
}${
PR_RED
}
$USER
@%m
${
PR_RESET
}${
PR_BRIGHT_YELLOW
}
%~%<<
${
PR_RESET
}
"
else
echo
-n
"
${
PR_RESET
}${
PR_BRIGHT_YELLOW
}
%~%<<
${
PR_RESET
}
"
fi
...
...
themes/agnoster.zsh-theme
View file @
7f75bb90
...
...
@@ -60,10 +60,8 @@ prompt_end() {
# Context: user@hostname (who am I and where am I)
prompt_context
()
{
local
user
=
`
whoami
`
if
[[
"
$user
"
!=
"
$DEFAULT_USER
"
||
-n
"
$SSH_CLIENT
"
]]
;
then
prompt_segment black default
"%(!.%{%F{yellow}%}.)
$user
@%m"
if
[[
"
$USER
"
!=
"
$DEFAULT_USER
"
||
-n
"
$SSH_CLIENT
"
]]
;
then
prompt_segment black default
"%(!.%{%F{yellow}%}.)
$USER
@%m"
fi
}
...
...
themes/candy-kingdom.zsh-theme
View file @
7f75bb90
...
...
@@ -13,7 +13,7 @@ patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name ||
hostname -s
[ -f ~/.box-name ] && cat ~/.box-name ||
echo $SHORT_HOST || echo $HOST
}
PROMPT='
...
...
themes/dieter.zsh-theme
View file @
7f75bb90
...
...
@@ -21,7 +21,7 @@ local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}"
# Hostname part. compressed and colorcoded per host_repr array
# if not found, regular hostname in default color
local host="@${host_repr[$
(hostname)]:-$(hostname)
}%{$reset_color%}"
local host="@${host_repr[$
HOST]:-$HOST
}%{$reset_color%}"
# Compacted $PWD
local pwd="%{$fg[blue]%}%c%{$reset_color%}"
...
...
themes/fino-time.zsh-theme
View file @
7f75bb90
...
...
@@ -21,7 +21,7 @@ function prompt_char {
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name ||
hostname -s
[ -f ~/.box-name ] && cat ~/.box-name ||
echo $SHORT_HOST || echo $HOST
}
...
...
themes/fino.zsh-theme
View file @
7f75bb90
...
...
@@ -17,7 +17,7 @@ function prompt_char {
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name ||
hostname -s
[ -f ~/.box-name ] && cat ~/.box-name ||
echo $SHORT_HOST || echo $HOST
}
local ruby_env=''
...
...
themes/flazz.zsh-theme
View file @
7f75bb90
if [ "$
(whoami)
" = "root" ]
if [ "$
USER
" = "root" ]
then CARETCOLOR="red"
else CARETCOLOR="blue"
fi
...
...
themes/kardan.zsh-theme
View file @
7f75bb90
# Simple theme based on my old zsh settings.
function get_host {
echo '@'
`hostname`''
echo '@'
$HOST
}
PROMPT='> '
...
...
themes/michelebologna.zsh-theme
View file @
7f75bb90
...
...
@@ -17,7 +17,7 @@ USERNAME_NORMAL_COLOR=$WHITE
USERNAME_ROOT_COLOR=$RED
HOSTNAME_NORMAL_COLOR=$BLUE
# uncomment next line if you want auto-generated hostname color
#for i in
`hostname`
; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
#for i in
$HOST
; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
HOSTNAME_ROOT_COLOR=$RED
HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR)
CURRENT_DIR_COLOR=$CYAN
...
...
themes/obraun.zsh-theme
View file @
7f75bb90
if [ "$
(whoami)
" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
if [ "$
USER
" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
...
...
themes/re5et.zsh-theme
View file @
7f75bb90
if [ "$
(whoami)
" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
if [ "$
USER
" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
...
...
themes/sunrise.zsh-theme
View file @
7f75bb90
...
...
@@ -10,7 +10,7 @@ Y=$fg_no_bold[yellow]
B=$fg_no_bold[blue]
RESET=$reset_color
if [ "$
(whoami)
" = "root" ]; then
if [ "$
USER
" = "root" ]; then
PROMPTCOLOR="%{$R%}" PREFIX="-!-";
else
PROMPTCOLOR="" PREFIX="---";
...
...
Prev
1
2
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