mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-16 02:27:03 +01:00
Merge fc6f3fc603 into fce68bbba0
This commit is contained in:
commit
5bcf6c9b1e
4 changed files with 36 additions and 33 deletions
|
|
@ -13,18 +13,18 @@ You can install this via the command line with either `curl` or `wget`.
|
||||||
|
|
||||||
h4. via `curl`
|
h4. via `curl`
|
||||||
|
|
||||||
@curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh@
|
@curl -L https://github.com/NeuralSandwich/oh-my-zsh/raw/master/tools/install.sh | sh@
|
||||||
|
|
||||||
h4. via `wget`
|
h4. via `wget`
|
||||||
|
|
||||||
@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
|
@wget --no-check-certificate https://github.com/NeuralSandwich/oh-my-zsh/raw/master/tools/install.sh -O - | sh@
|
||||||
|
|
||||||
h3. The manual way
|
h3. The manual way
|
||||||
|
|
||||||
|
|
||||||
1. Clone the repository
|
1. Clone the repository
|
||||||
|
|
||||||
@git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@
|
@git clone git://github.com/NeuralSandwich/oh-my-zsh.git ~/.oh-my-zsh@
|
||||||
|
|
||||||
2. *OPTIONAL* Backup your existing ~/.zshrc file
|
2. *OPTIONAL* Backup your existing ~/.zshrc file
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ h2. Usage
|
||||||
* enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible)
|
* enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible)
|
||||||
** example: @plugins=(git osx ruby)@
|
** example: @plugins=(git osx ruby)@
|
||||||
* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@.
|
* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@.
|
||||||
** Take a look at the "current themes":https://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_.
|
** Take a look at the "current themes":https://wiki.github.com/NeuralSandwich/oh-my-zsh/themes that come bundled with _Oh My Zsh_.
|
||||||
* much much more... take a look at @lib/@ what _Oh My Zsh_ offers...
|
* much much more... take a look at @lib/@ what _Oh My Zsh_ offers...
|
||||||
|
|
||||||
h2. Useful
|
h2. Useful
|
||||||
|
|
@ -84,6 +84,6 @@ h2. Contributors
|
||||||
|
|
||||||
This project wouldn't exist without all of our awesome users and contributors.
|
This project wouldn't exist without all of our awesome users and contributors.
|
||||||
|
|
||||||
* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors
|
* "View our growing list of contributors":https://github.com/NeuralSandwich/oh-my-zsh/contributors
|
||||||
|
|
||||||
Thank you so much!
|
Thank you so much!
|
||||||
|
|
|
||||||
|
|
@ -42,17 +42,27 @@ if [[ $(uname) == "Darwin" ]] ; then
|
||||||
fi
|
fi
|
||||||
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
||||||
else
|
else
|
||||||
echo ""
|
echo "∞"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
elif [[ $(uname) == "Linux" ]] ; then
|
elif [[ $(uname) == "Linux" ]] ; then
|
||||||
|
|
||||||
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
function battery_pct_remaining() {
|
||||||
function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
|
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||||
function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
|
echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')"
|
||||||
function battery_pct_prompt() {
|
fi
|
||||||
b=$(battery_pct_remaining)
|
}
|
||||||
|
|
||||||
|
function battery_time_remaining() {
|
||||||
|
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||||
|
echo $(acpi | cut -f3 -d ',')
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function battery_pct_prompt() {
|
||||||
|
b=$(battery_pct_remaining)
|
||||||
|
if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
|
||||||
if [ $b -gt 50 ] ; then
|
if [ $b -gt 50 ] ; then
|
||||||
color='green'
|
color='green'
|
||||||
elif [ $b -gt 20 ] ; then
|
elif [ $b -gt 20 ] ; then
|
||||||
|
|
@ -61,11 +71,8 @@ elif [[ $(uname) == "Linux" ]] ; then
|
||||||
color='red'
|
color='red'
|
||||||
fi
|
fi
|
||||||
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
|
||||||
}
|
else
|
||||||
else
|
echo "∞"
|
||||||
error_msg='no battery'
|
fi
|
||||||
function battery_pct_remaining() { echo $error_msg }
|
}
|
||||||
function battery_time_remaining() { echo $error_msg }
|
|
||||||
function battery_pct_prompt() { echo '' }
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -7,24 +7,12 @@
|
||||||
# Create:
|
# Create:
|
||||||
# Modified:
|
# Modified:
|
||||||
|
|
||||||
if [ "x$OH_MY_ZSH_HG" = "x" ]; then
|
|
||||||
OH_MY_ZSH_HG="hg"
|
|
||||||
fi
|
|
||||||
|
|
||||||
function hg_prompt_info {
|
|
||||||
$OH_MY_ZSH_HG prompt --angle-brackets "\
|
|
||||||
< on %{$fg[magenta]%}<branch>%{$reset_color%}>\
|
|
||||||
< at %{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
|
|
||||||
%{$fg[green]%}<status|modified|unknown><update>%{$reset_color%}<
|
|
||||||
patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
function box_name {
|
function box_name {
|
||||||
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
|
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT='
|
PROMPT='
|
||||||
%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}$(box_name)%{$reset_color%}:%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
|
%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}$(box_name)%{$reset_color%}:%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info)
|
||||||
%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )$ '
|
%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )$ '
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[magenta]%}branch: "
|
ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[magenta]%}branch: "
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
|
which zsh>/dev/null
|
||||||
|
RES=$?
|
||||||
|
if [ $RES -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "\033[0;33mYou do not have zsh installed.\033[0m You'll need to install zsh first if you want to install oh-my-zsh"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d ~/.oh-my-zsh ]
|
if [ -d ~/.oh-my-zsh ]
|
||||||
then
|
then
|
||||||
echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install"
|
echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install"
|
||||||
|
|
@ -5,7 +13,7 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
||||||
hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh || {
|
hash git >/dev/null && /usr/bin/env git clone https://github.com/NeuralSandwichl/oh-my-zsh.git ~/.oh-my-zsh || {
|
||||||
echo "git not installed"
|
echo "git not installed"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
@ -34,5 +42,5 @@ echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m
|
||||||
echo "\033[0;32m"' /____/ '"\033[0m"
|
echo "\033[0;32m"' /____/ '"\033[0m"
|
||||||
|
|
||||||
echo "\n\n \033[0;32m....is now installed.\033[0m"
|
echo "\n\n \033[0;32m....is now installed.\033[0m"
|
||||||
|
echo "source .zshrc" | zsh
|
||||||
/usr/bin/env zsh
|
/usr/bin/env zsh
|
||||||
source ~/.zshrc
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue