Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Gaetan Semet 2016-10-23 23:49:29 +02:00
commit 264108ccae
5 changed files with 36 additions and 29 deletions

View file

@ -18,9 +18,9 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t
### Prerequisites ### 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) * [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 * `curl` or `wget` should be installed
* `git` 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 #### 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... 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 #### 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: 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) 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:
![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png) ![Agnoster theme](https://cloud.githubusercontent.com/assets/2618447/6316862/70f58fb6-ba03-11e4-82c9-c083bf9a6574.png)
@ -129,7 +129,7 @@ cp ~/.zshrc ~/.zshrc.orig
##### 3. Create a new zsh configuration file ##### 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 ```shell
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
@ -208,7 +208,7 @@ Thank you so much!
## Follow Us ## 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. * [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. You should follow it.
* [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook. * [Oh My Zsh](https://www.facebook.com/Oh-My-Zsh-296616263819290/) on Facebook.

View file

@ -53,7 +53,7 @@ done
# Figure out the SHORT hostname # Figure out the SHORT hostname
if [[ "$OSTYPE" = darwin* ]]; then 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/.*/} SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
else else
SHORT_HOST=${HOST/.*/} SHORT_HOST=${HOST/.*/}

View file

@ -7,8 +7,8 @@ droplr() {
return 1 return 1
fi fi
if [[ "$1" =~ ^http[|s]:// ]]; then if [[ "$1" =~ ^https?:// ]]; then
osascript -e "tell app 'Droplr' to shorten '$1'" osascript -e 'tell app "Droplr" to shorten "'"$1"'"'
else else
open -ga /Applications/Droplr.app "$1" open -ga /Applications/Droplr.app "$1"
fi fi

View file

@ -4,8 +4,10 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [[ $UID -eq 0 ]]; then if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}' local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
local user_symbol='#'
else else
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local user_symbol='$'
fi fi
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
@ -20,8 +22,9 @@ fi
local git_branch='$(git_prompt_info)%{$reset_color%}' local git_branch='$(git_prompt_info)%{$reset_color%}'
PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
╰─%B$%b " ╰─%B${user_symbol}%b "
RPS1="${return_code}" RPS1="%B${return_code}%b"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=" %{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX=" %{$reset_color%}"

View file

@ -5,26 +5,30 @@ function prompt_char {
} }
function virtualenv_info { function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' [[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') '
} }
function collapse_pwd { function ruby_prompt {
echo $(pwd | sed -e "s,^$HOME,~,") if (( $+commands[rvm-prompt] )); then
} print -n $ZSH_THEME_RUBY_PROMPT_PREFIX
print -n $(~/.rvm/bin/rvm-prompt)
if which rvm-prompt &> /dev/null; then print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX
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%} elif (( $+commands[rbenv] )); then
$(virtualenv_info)$(prompt_char) ' print -n $ZSH_THEME_RUBY_PROMPT_PREFIX
else print -n $(rbenv version | sed -e "s/ (set.*$//")
if which rbenv &> /dev/null; then print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX
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
fi return 0
}
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 %{$fg[magenta]%}" ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}'
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX='%f'
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" ZSH_THEME_GIT_PROMPT_DIRTY='%F{green}!'
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" ZSH_THEME_GIT_PROMPT_UNTRACKED='%F{green}?'
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=''
ZSH_THEME_RUBY_PROMPT_PREFIX=' using %F{red}'
ZSH_THEME_RUBY_PROMPT_SUFFIX='%f'