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