mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-01 04:30:37 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
264108ccae
5 changed files with 36 additions and 29 deletions
14
README.md
14
README.md
|
|
@ -18,9 +18,9 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t
|
|||
|
||||
### Prerequisites
|
||||
|
||||
__Disclaimer:__ _Oh My Zsh works best on OS X and Linux._
|
||||
__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
|
||||
|
||||
* Unix-based operating system (OS X or Linux)
|
||||
* Unix-based operating system (macOS or Linux)
|
||||
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
|
||||
* `curl` or `wget` should be installed
|
||||
* `git` should be installed
|
||||
|
|
@ -49,7 +49,7 @@ Oh My Zsh comes with a shit load of plugins to take advantage of. You can take a
|
|||
|
||||
#### Enabling Plugins
|
||||
|
||||
If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load in initialization.
|
||||
If you spot a plugin (or several) that you would like to use with Oh My Zsh, you will need to edit the `~/.zshrc` file. Once you open it with your favorite editor, you'll see a spot to list all the plugins that you'd like Oh My Zsh to load on initialization.
|
||||
|
||||
For example, this line might begin to look like...
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ We'll admit it. Early in the Oh My Zsh world, we may have gotten a bit too theme
|
|||
|
||||
#### Selecting a Theme
|
||||
|
||||
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just right (for him)._
|
||||
_Robby's theme is the default one. It's not the fanciest one. It's not the simplest one. It's just the right one (for him)._
|
||||
|
||||
Once you find a theme that you want to use, you will need to edit the `~/.zshrc` file. You'll see an environment variable (all caps) in there that looks like:
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ To use a different theme, simply change the value to match the name of your desi
|
|||
ZSH_THEME="agnoster" # (this is one of the fancy ones)
|
||||
```
|
||||
|
||||
Open up a new terminal window and your prompt should look something like...
|
||||
Open up a new terminal window and your prompt should look something like this:
|
||||
|
||||

|
||||
|
||||
|
|
@ -129,7 +129,7 @@ cp ~/.zshrc ~/.zshrc.orig
|
|||
|
||||
##### 3. Create a new zsh configuration file
|
||||
|
||||
You can create a new zsh config file by copying the template that we included for you.
|
||||
You can create a new zsh config file by copying the template that we have included for you.
|
||||
|
||||
```shell
|
||||
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
|
||||
|
|
@ -208,7 +208,7 @@ Thank you so much!
|
|||
|
||||
## Follow Us
|
||||
|
||||
We're on the social medias.
|
||||
We're on the social media.
|
||||
|
||||
* [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it.
|
||||
* [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook.
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ done
|
|||
|
||||
# Figure out the SHORT hostname
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
# OS X's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||
# macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
||||
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
|
||||
else
|
||||
SHORT_HOST=${HOST/.*/}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ droplr() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
if [[ "$1" =~ ^http[|s]:// ]]; then
|
||||
osascript -e "tell app 'Droplr' to shorten '$1'"
|
||||
if [[ "$1" =~ ^https?:// ]]; then
|
||||
osascript -e 'tell app "Droplr" to shorten "'"$1"'"'
|
||||
else
|
||||
open -ga /Applications/Droplr.app "$1"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
|||
|
||||
if [[ $UID -eq 0 ]]; then
|
||||
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
|
||||
local user_symbol='#'
|
||||
else
|
||||
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
|
||||
local user_symbol='$'
|
||||
fi
|
||||
|
||||
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
|
||||
|
|
@ -20,8 +22,9 @@ fi
|
|||
local git_branch='$(git_prompt_info)%{$reset_color%}'
|
||||
|
||||
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
|
||||
╰─%B$%b "
|
||||
RPS1="${return_code}"
|
||||
╰─%B${user_symbol}%b "
|
||||
RPS1="%B${return_code}%b"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
|
||||
|
||||
|
|
|
|||
|
|
@ -5,26 +5,30 @@ function prompt_char {
|
|||
}
|
||||
|
||||
function virtualenv_info {
|
||||
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
|
||||
[[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') '
|
||||
}
|
||||
|
||||
function collapse_pwd {
|
||||
echo $(pwd | sed -e "s,^$HOME,~,")
|
||||
function ruby_prompt {
|
||||
if (( $+commands[rvm-prompt] )); then
|
||||
print -n $ZSH_THEME_RUBY_PROMPT_PREFIX
|
||||
print -n $(~/.rvm/bin/rvm-prompt)
|
||||
print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX
|
||||
elif (( $+commands[rbenv] )); then
|
||||
print -n $ZSH_THEME_RUBY_PROMPT_PREFIX
|
||||
print -n $(rbenv version | sed -e "s/ (set.*$//")
|
||||
print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
if which rvm-prompt &> /dev/null; then
|
||||
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%}
|
||||
$(virtualenv_info)$(prompt_char) '
|
||||
else
|
||||
if which rbenv &> /dev/null; then
|
||||
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}
|
||||
$(virtualenv_info)$(prompt_char) '
|
||||
fi
|
||||
fi
|
||||
PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt)
|
||||
$(virtualenv_info) $(prompt_char) '
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}'
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX='%f'
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY='%F{green}!'
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED='%F{green}?'
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=''
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
ZSH_THEME_RUBY_PROMPT_PREFIX=' using %F{red}'
|
||||
ZSH_THEME_RUBY_PROMPT_SUFFIX='%f'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue