Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
74177c53
Commit
74177c53
authored
Oct 09, 2014
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change all whoami calls for $USER variable
This avoid spawning additional processes, as the $USER variable will **always** contain the current logged-in user.
parent
7034b01c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
12 additions
and
15 deletions
+12
-15
completion.zsh
lib/completion.zsh
+2
-2
systemadmin.plugin.zsh
plugins/systemadmin/systemadmin.plugin.zsh
+1
-1
adben.zsh-theme
themes/adben.zsh-theme
+2
-3
agnoster.zsh-theme
themes/agnoster.zsh-theme
+2
-4
flazz.zsh-theme
themes/flazz.zsh-theme
+1
-1
obraun.zsh-theme
themes/obraun.zsh-theme
+1
-1
re5et.zsh-theme
themes/re5et.zsh-theme
+1
-1
sunrise.zsh-theme
themes/sunrise.zsh-theme
+1
-1
ys.zsh-theme
themes/ys.zsh-theme
+1
-1
No files found.
lib/completion.zsh
View file @
74177c53
...
...
@@ -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/systemadmin/systemadmin.plugin.zsh
View file @
74177c53
...
...
@@ -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
...
...
themes/adben.zsh-theme
View file @
74177c53
...
...
@@ -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 @
74177c53
...
...
@@ -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/flazz.zsh-theme
View file @
74177c53
if [ "$
(whoami)
" = "root" ]
if [ "$
USER
" = "root" ]
then CARETCOLOR="red"
else CARETCOLOR="blue"
fi
...
...
themes/obraun.zsh-theme
View file @
74177c53
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 @
74177c53
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 @
74177c53
...
...
@@ -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="---";
...
...
themes/ys.zsh-theme
View file @
74177c53
...
...
@@ -33,7 +33,7 @@ ${git_info} \
%{$fg[white]%}[%*]
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
if [[ "$
(whoami)
" == "root" ]]; then
if [[ "$
USER
" == "root" ]]; then
PROMPT="
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
%{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \
...
...
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