mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 07:43:31 +01:00
parent
95a06f3927
commit
02d07f3e3d
@ -32,9 +32,9 @@ zstyle ':completion:*' list-colors ''
|
|||||||
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" = solaris* ]]; then
|
if [[ "$OSTYPE" = solaris* ]]; then
|
||||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
|
zstyle ':completion:*:*:*:*:processes' command "ps -u $USERNAME -o pid,user,comm"
|
||||||
else
|
else
|
||||||
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
|
zstyle ':completion:*:*:*:*:processes' command "ps -u $USERNAME -o pid,user,comm -w -w"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# disable named-directories autocompletion
|
# disable named-directories autocompletion
|
||||||
|
@ -112,7 +112,7 @@ function _omz_diag_dump_one_big_text() {
|
|||||||
command uname -a
|
command uname -a
|
||||||
builtin echo OSTYPE=$OSTYPE
|
builtin echo OSTYPE=$OSTYPE
|
||||||
builtin echo ZSH_VERSION=$ZSH_VERSION
|
builtin echo ZSH_VERSION=$ZSH_VERSION
|
||||||
builtin echo User: $USER
|
builtin echo User: $USERNAME
|
||||||
builtin echo umask: $(umask)
|
builtin echo umask: $(umask)
|
||||||
builtin echo
|
builtin echo
|
||||||
_omz_diag_dump_os_specific_version
|
_omz_diag_dump_os_specific_version
|
||||||
|
@ -20,8 +20,8 @@ _emacsfun()
|
|||||||
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
||||||
if [ "$#" -ge "2" -a "$2" = "-" ]
|
if [ "$#" -ge "2" -a "$2" = "-" ]
|
||||||
then
|
then
|
||||||
tempfile="$(mktemp --tmpdir emacs-stdin-$USER.XXXXXXX 2>/dev/null \
|
tempfile="$(mktemp --tmpdir emacs-stdin-$USERNAME.XXXXXXX 2>/dev/null \
|
||||||
|| mktemp -t emacs-stdin-$USER)" # support BSD mktemp
|
|| mktemp -t emacs-stdin-$USERNAME)" # support BSD mktemp
|
||||||
cat - > "$tempfile"
|
cat - > "$tempfile"
|
||||||
_emacsfun --no-wait $tempfile
|
_emacsfun --no-wait $tempfile
|
||||||
else
|
else
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# of the tab window should be.
|
# of the tab window should be.
|
||||||
if [[ "$TERM" == screen* ]]; then
|
if [[ "$TERM" == screen* ]]; then
|
||||||
if [[ $_GET_PATH == '' ]]; then
|
if [[ $_GET_PATH == '' ]]; then
|
||||||
_GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^\/home\//~/;s/^~$USER/~/"'
|
_GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^\/home\//~/;s/^~$USERNAME/~/"'
|
||||||
fi
|
fi
|
||||||
if [[ $_GET_HOST == '' ]]; then
|
if [[ $_GET_HOST == '' ]]; then
|
||||||
_GET_HOST='echo $HOST | sed "s/\..*//"'
|
_GET_HOST='echo $HOST | sed "s/\..*//"'
|
||||||
|
@ -61,11 +61,11 @@ zstyle -b :omz:plugins:ssh-agent agent-forwarding _agent_forwarding
|
|||||||
|
|
||||||
if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then
|
if [[ $_agent_forwarding == "yes" && -n "$SSH_AUTH_SOCK" ]]; then
|
||||||
# Add a nifty symlink for screen/tmux if agent forwarding
|
# Add a nifty symlink for screen/tmux if agent forwarding
|
||||||
[[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
|
[[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
|
||||||
elif [[ -f "$_ssh_env_cache" ]]; then
|
elif [[ -f "$_ssh_env_cache" ]]; then
|
||||||
# Source SSH settings, if applicable
|
# Source SSH settings, if applicable
|
||||||
. $_ssh_env_cache > /dev/null
|
. $_ssh_env_cache > /dev/null
|
||||||
if [[ $USER == "root" ]]; then
|
if [[ $USERNAME == "root" ]]; then
|
||||||
FILTER="ax"
|
FILTER="ax"
|
||||||
else
|
else
|
||||||
FILTER="x"
|
FILTER="x"
|
||||||
|
@ -10,17 +10,17 @@ plugins=(... systemadmin)
|
|||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|---------|------------------------------------------------------------------------|--------------------------------------------------------------------|
|
|---------|----------------------------------------------------------------------------|--------------------------------------------------------------------|
|
||||||
| ping | `ping -c 5` | Sends only 5 ICMP Messages |
|
| ping | `ping -c 5` | Sends only 5 ICMP Messages |
|
||||||
| clr | `clear; echo Currently logged in on $TTY, as $USER in directory $PWD.` | Clears the screen and prints the current user, TTY, and directory |
|
| clr | `clear; echo Currently logged in on $TTY, as $USERNAME in directory $PWD.` | Clears the screen and prints the current user, TTY, and directory |
|
||||||
| path | `print -l $path` | Displays PATH with each entry on a separate line |
|
| path | `print -l $path` | Displays PATH with each entry on a separate line |
|
||||||
| mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output |
|
| mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output |
|
||||||
| psmem | `ps -e -orss=,args= \| sort -b -k1 -nr` | Display the processes using the most memory |
|
| psmem | `ps -e -orss=,args= \| sort -b -k1 -nr` | Display the processes using the most memory |
|
||||||
| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -10` | Display the top 10 processes using the most memory |
|
| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -10` | Display the top 10 processes using the most memory |
|
||||||
| pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU |
|
| pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU |
|
||||||
| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -10` | Display the top 10 processes using the most CPU |
|
| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -10` | Display the top 10 processes using the most CPU |
|
||||||
| hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history |
|
| hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history |
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ function retlog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
alias ping='ping -c 5'
|
alias ping='ping -c 5'
|
||||||
alias clr='clear; echo Currently logged in on $TTY, as $USER in directory $PWD.'
|
alias clr='clear; echo Currently logged in on $TTY, as $USERNAME in directory $PWD.'
|
||||||
alias path='print -l $path'
|
alias path='print -l $path'
|
||||||
alias mkdir='mkdir -pv'
|
alias mkdir='mkdir -pv'
|
||||||
# get top process eating memory
|
# get top process eating memory
|
||||||
|
@ -89,8 +89,8 @@ function precmd {
|
|||||||
|
|
||||||
# Context: user@directory or just directory
|
# Context: user@directory or just directory
|
||||||
prompt_context () {
|
prompt_context () {
|
||||||
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
if [[ "$USERNAME" != "$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}$USERNAME@%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
|
||||||
|
@ -88,7 +88,7 @@ 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() {
|
||||||
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
||||||
prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
|
prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ function _user_host() {
|
|||||||
local me
|
local me
|
||||||
if [[ -n $SSH_CONNECTION ]]; then
|
if [[ -n $SSH_CONNECTION ]]; then
|
||||||
me="%n@%m"
|
me="%n@%m"
|
||||||
elif [[ $LOGNAME != $USER ]]; then
|
elif [[ $LOGNAME != $USERNAME ]]; then
|
||||||
me="%n"
|
me="%n"
|
||||||
fi
|
fi
|
||||||
if [[ -n $me ]]; then
|
if [[ -n $me ]]; then
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
if [ "$USER" = "root" ]
|
if [ "$USERNAME" = "root" ]
|
||||||
then CARETCOLOR="red"
|
then CARETCOLOR="red"
|
||||||
else CARETCOLOR="blue"
|
else CARETCOLOR="blue"
|
||||||
fi
|
fi
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
|
if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
|
||||||
|
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
|
if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
|
||||||
|
|
||||||
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
|
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Y=$fg_no_bold[yellow]
|
|||||||
B=$fg_no_bold[blue]
|
B=$fg_no_bold[blue]
|
||||||
RESET=$reset_color
|
RESET=$reset_color
|
||||||
|
|
||||||
if [ "$USER" = "root" ]; then
|
if [ "$USERNAME" = "root" ]; then
|
||||||
PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-";
|
PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-";
|
||||||
else
|
else
|
||||||
PROMPTCOLOR="" PROMPTPREFIX="---";
|
PROMPTCOLOR="" PROMPTPREFIX="---";
|
||||||
|
@ -227,7 +227,7 @@ EOF
|
|||||||
if [ -n "$SHELL" ]; then
|
if [ -n "$SHELL" ]; then
|
||||||
echo "$SHELL" > ~/.shell.pre-oh-my-zsh
|
echo "$SHELL" > ~/.shell.pre-oh-my-zsh
|
||||||
else
|
else
|
||||||
grep "^$USER:" /etc/passwd | awk -F: '{print $7}' > ~/.shell.pre-oh-my-zsh
|
grep "^$USERNAME:" /etc/passwd | awk -F: '{print $7}' > ~/.shell.pre-oh-my-zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Actually change the default shell to zsh
|
# Actually change the default shell to zsh
|
||||||
|
Loading…
Reference in New Issue
Block a user