mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
Conflict merge 1
This commit is contained in:
commit
4d4fd1ba97
19 changed files with 1371 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ Oh My Zsh is installed by running one of the following commands in your terminal
|
||||||
|
|
||||||
#### via curl
|
#### via curl
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
```shell
|
```shell
|
||||||
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||||
```
|
```
|
||||||
|
|
@ -34,6 +35,13 @@ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/i
|
||||||
```shell
|
```shell
|
||||||
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
||||||
```
|
```
|
||||||
|
=======
|
||||||
|
`sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"`
|
||||||
|
|
||||||
|
#### via wget
|
||||||
|
|
||||||
|
`sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"`
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
|
|
||||||
## Using Oh My Zsh
|
## Using Oh My Zsh
|
||||||
|
|
||||||
|
|
@ -104,7 +112,11 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory)
|
||||||
If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
|
If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
<<<<<<< HEAD
|
||||||
export ZSH="~/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
export ZSH="~/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||||
|
=======
|
||||||
|
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Manual Installation
|
#### Manual Installation
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ alias p='tail -1 /home/pdavis/notes.txt | pbcopy'
|
||||||
alias pbcopy='xsel --clipboard --input'
|
alias pbcopy='xsel --clipboard --input'
|
||||||
alias rosh='ssh pdavis-admin@opsware.discovery.com -p 2222'
|
alias rosh='ssh pdavis-admin@opsware.discovery.com -p 2222'
|
||||||
alias console='cu -t -l /dev/ttyUSB0 -s 115200'
|
alias console='cu -t -l /dev/ttyUSB0 -s 115200'
|
||||||
|
<<<<<<< HEAD
|
||||||
alias open='ssh $1 -l pdavis-admin'
|
alias open='ssh $1 -l pdavis-admin'
|
||||||
alias home='ssh netinstall@pebcac.org'
|
alias home='ssh netinstall@pebcac.org'
|
||||||
alias myrouter='ssh tunnel@192.168.10.1'
|
alias myrouter='ssh tunnel@192.168.10.1'
|
||||||
|
|
@ -15,4 +16,7 @@ alias pswitch='ssh tunnel@192.168.10.4'
|
||||||
alias jumphost='ssh pdavis@jumphost.pebcac.org'
|
alias jumphost='ssh pdavis@jumphost.pebcac.org'
|
||||||
|
|
||||||
# Start with tmux
|
# Start with tmux
|
||||||
|
=======
|
||||||
|
alias open='ssh $1 -l pdavis-admin'
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
[[ $TERM != "screen" ]] && exec tmux
|
[[ $TERM != "screen" ]] && exec tmux
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,12 @@
|
||||||
# * Consider whether to move default output file location to TMPDIR. More robust
|
# * Consider whether to move default output file location to TMPDIR. More robust
|
||||||
# but less user friendly.
|
# but less user friendly.
|
||||||
#
|
#
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
autoload -Uz is-at-least
|
autoload -Uz is-at-least
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
function omz_diagnostic_dump() {
|
function omz_diagnostic_dump() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
|
|
||||||
|
|
@ -250,7 +253,11 @@ function _omz_diag_dump_one_big_text() {
|
||||||
|
|
||||||
function _omz_diag_dump_check_core_commands() {
|
function _omz_diag_dump_check_core_commands() {
|
||||||
builtin echo "Core command check:"
|
builtin echo "Core command check:"
|
||||||
|
<<<<<<< HEAD
|
||||||
local redefined name builtins externals reserved_words
|
local redefined name builtins externals reserved_words
|
||||||
|
=======
|
||||||
|
local redefined name builtins externals
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
redefined=()
|
redefined=()
|
||||||
# All the zsh non-module builtin commands
|
# All the zsh non-module builtin commands
|
||||||
# These are taken from the zsh reference manual for 5.0.2
|
# These are taken from the zsh reference manual for 5.0.2
|
||||||
|
|
@ -258,6 +265,7 @@ function _omz_diag_dump_check_core_commands() {
|
||||||
# (For back-compatibility, if any of these are newish, they should be removed,
|
# (For back-compatibility, if any of these are newish, they should be removed,
|
||||||
# or at least made conditional on the version of the current running zsh.)
|
# or at least made conditional on the version of the current running zsh.)
|
||||||
# "history" is also excluded because OMZ is known to redefine that
|
# "history" is also excluded because OMZ is known to redefine that
|
||||||
|
<<<<<<< HEAD
|
||||||
reserved_words=( do done esac then elif else fi for case if while function
|
reserved_words=( do done esac then elif else fi for case if while function
|
||||||
repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
|
repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}'
|
||||||
)
|
)
|
||||||
|
|
@ -284,6 +292,19 @@ function _omz_diag_dump_check_core_commands() {
|
||||||
redefined+=$name
|
redefined+=$name
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
=======
|
||||||
|
builtins=( alias autoload bg bindkey break builtin bye cd chdir command
|
||||||
|
comparguments compcall compctl compdescribe compfiles compgroups compquote comptags
|
||||||
|
comptry compvalues continue declare dirs disable disown echo echotc echoti emulate
|
||||||
|
enable eval exec exit export false fc fg float functions getln getopts hash
|
||||||
|
integer jobs kill let limit local log logout noglob popd print printf
|
||||||
|
pushd pushln pwd r read readonly rehash return sched set setopt shift
|
||||||
|
source suspend test times trap true ttyctl type typeset ulimit umask unalias
|
||||||
|
unfunction unhash unlimit unset unsetopt vared wait whence where which zcompile
|
||||||
|
zle zmodload zparseopts zregexparse zstyle )
|
||||||
|
builtins_fatal=( builtin command local )
|
||||||
|
externals=( zsh )
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
for name in $builtins; do
|
for name in $builtins; do
|
||||||
if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then
|
if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then
|
||||||
builtin echo "builtin '$name' has been redefined"
|
builtin echo "builtin '$name' has been redefined"
|
||||||
|
|
|
||||||
18
lib/misc.zsh
18
lib/misc.zsh
|
|
@ -1,4 +1,5 @@
|
||||||
## Load smart urls if available
|
## Load smart urls if available
|
||||||
|
<<<<<<< HEAD
|
||||||
# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434
|
# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434
|
||||||
autoload -Uz is-at-least
|
autoload -Uz is-at-least
|
||||||
if [[ $ZSH_VERSION != 5.1.1 ]]; then
|
if [[ $ZSH_VERSION != 5.1.1 ]]; then
|
||||||
|
|
@ -14,6 +15,18 @@ if [[ $ZSH_VERSION != 5.1.1 ]]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
=======
|
||||||
|
for d in $fpath; do
|
||||||
|
if [[ -e "$d/url-quote-magic" ]]; then
|
||||||
|
if [[ -e "$d/bracketed-paste-magic" ]]; then
|
||||||
|
autoload -Uz bracketed-paste-magic
|
||||||
|
zle -N bracketed-paste bracketed-paste-magic
|
||||||
|
fi
|
||||||
|
autoload -U url-quote-magic
|
||||||
|
zle -N self-insert url-quote-magic
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
|
|
||||||
## jobs
|
## jobs
|
||||||
setopt long_list_jobs
|
setopt long_list_jobs
|
||||||
|
|
@ -27,7 +40,12 @@ alias _='sudo'
|
||||||
alias please='sudo'
|
alias please='sudo'
|
||||||
|
|
||||||
## more intelligent acking for ubuntu users
|
## more intelligent acking for ubuntu users
|
||||||
|
<<<<<<< HEAD
|
||||||
if which ack-grep &> /dev/null; then
|
if which ack-grep &> /dev/null; then
|
||||||
|
=======
|
||||||
|
if which ack-grep &> /dev/null;
|
||||||
|
then
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
alias afind='ack-grep -il'
|
alias afind='ack-grep -il'
|
||||||
else
|
else
|
||||||
alias afind='ack -il'
|
alias afind='ack -il'
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,17 @@ Chuck Norris' blood type is AK+. Ass-Kicking Positive. It is compatible only wit
|
||||||
Chuck Norris is 1/8th Cherokee. This has nothing to do with ancestry, the man ate a fucking Indian.
|
Chuck Norris is 1/8th Cherokee. This has nothing to do with ancestry, the man ate a fucking Indian.
|
||||||
%
|
%
|
||||||
In fine print on the last page of the Guinness Book of World Records it notes that all world records are held by Chuck Norris, and those listed in the book are simply the closest anyone else has ever gotten.
|
In fine print on the last page of the Guinness Book of World Records it notes that all world records are held by Chuck Norris, and those listed in the book are simply the closest anyone else has ever gotten.
|
||||||
|
<<<<<<< HEAD
|
||||||
%
|
%
|
||||||
There is no chin behind Chuck Norris' beard. There is only another fist.
|
There is no chin behind Chuck Norris' beard. There is only another fist.
|
||||||
%
|
%
|
||||||
Chuck Norris does not teabag the ladies. He potato-sacks them.
|
Chuck Norris does not teabag the ladies. He potato-sacks them.
|
||||||
%
|
%
|
||||||
|
=======
|
||||||
|
There is no chin behind Chuck Norris' beard. There is only another fist.
|
||||||
|
%
|
||||||
|
Chuck Norris does not teabag the ladies. He potato-sacks them.
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the Chuck gave them a roundhouse kick to the face.
|
Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the Chuck gave them a roundhouse kick to the face.
|
||||||
%
|
%
|
||||||
When Chuck Norris goes to donate blood, he declines the syringe, and instead requests a hand gun and a bucket.
|
When Chuck Norris goes to donate blood, he declines the syringe, and instead requests a hand gun and a bucket.
|
||||||
|
|
@ -129,7 +135,10 @@ Chuck Norris can drink an entire gallon of milk in thirty-seven seconds.
|
||||||
Little known medical fact: Chuck Norris invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb.
|
Little known medical fact: Chuck Norris invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb.
|
||||||
%
|
%
|
||||||
Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint.
|
Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint.
|
||||||
|
<<<<<<< HEAD
|
||||||
%
|
%
|
||||||
|
=======
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
The show Survivor had the original premise of putting people on an island with Chuck Norris. There were no survivors, and nobody is brave enough to go to the island to retrieve the footage.
|
The show Survivor had the original premise of putting people on an island with Chuck Norris. There were no survivors, and nobody is brave enough to go to the island to retrieve the footage.
|
||||||
%
|
%
|
||||||
It takes Chuck Norris 20 minutes to watch 60 Minutes.
|
It takes Chuck Norris 20 minutes to watch 60 Minutes.
|
||||||
|
|
@ -284,7 +293,10 @@ In a recent survey it was discovered the 94% of American women lost their virgin
|
||||||
Chuck Norris invented a language that incorporates karate and roundhouse kicks. So next time Chuck Norris is kicking your ass, don't be offended or hurt, he may be just trying to tell you he likes your hat.
|
Chuck Norris invented a language that incorporates karate and roundhouse kicks. So next time Chuck Norris is kicking your ass, don't be offended or hurt, he may be just trying to tell you he likes your hat.
|
||||||
%
|
%
|
||||||
If at first you don't succeed, you're not Chuck Norris.
|
If at first you don't succeed, you're not Chuck Norris.
|
||||||
|
<<<<<<< HEAD
|
||||||
%
|
%
|
||||||
|
=======
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass.
|
If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass.
|
||||||
%
|
%
|
||||||
Fear is not the only emotion Chuck Norris can smell. He can also detect hope, as in "I hope I don't get a roundhouse kick from Chuck Norris."
|
Fear is not the only emotion Chuck Norris can smell. He can also detect hope, as in "I hope I don't get a roundhouse kick from Chuck Norris."
|
||||||
|
|
@ -353,7 +365,11 @@ As President Roosevelt said: "We have nothing to fear but fear itself. And Chuck
|
||||||
%
|
%
|
||||||
Chuck Norris just says "no" to drugs. If he said "yes", it would collapse Colombia's infrastructure.
|
Chuck Norris just says "no" to drugs. If he said "yes", it would collapse Colombia's infrastructure.
|
||||||
%
|
%
|
||||||
|
<<<<<<< HEAD
|
||||||
Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.?
|
Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.?
|
||||||
|
=======
|
||||||
|
Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
%
|
%
|
||||||
Crime does not pay - unless you are an undertaker following Walker, Texas Ranger, on a routine patrol.
|
Crime does not pay - unless you are an undertaker following Walker, Texas Ranger, on a routine patrol.
|
||||||
%
|
%
|
||||||
|
|
@ -501,8 +517,12 @@ When Chuck Norris works out on the Total Gym, the Total Gym feels like it's been
|
||||||
%
|
%
|
||||||
Chuck Norris can skeletize a cow in two minutes.
|
Chuck Norris can skeletize a cow in two minutes.
|
||||||
%
|
%
|
||||||
|
<<<<<<< HEAD
|
||||||
The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing.
|
The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing.
|
||||||
%
|
%
|
||||||
|
=======
|
||||||
|
The only sure things are Death and Taxes?and when Chuck Norris goes to work for the IRS, they'll be the same thing.
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
Chuck Norris' first job was as a paperboy. There were no survivors.
|
Chuck Norris' first job was as a paperboy. There were no survivors.
|
||||||
%
|
%
|
||||||
With the rising cost of gasoline, Chuck Norris is beginning to worry about his drinking habit.
|
With the rising cost of gasoline, Chuck Norris is beginning to worry about his drinking habit.
|
||||||
|
|
@ -533,6 +553,11 @@ Noah was the only man notified before Chuck Norris relieved himself in the Atlan
|
||||||
%
|
%
|
||||||
Chuck Norris once invited all of the other badasses from TV to duke it out in order to see who was the supreme badass. Only two showed up-- Jack Bauer and MacGyver.
|
Chuck Norris once invited all of the other badasses from TV to duke it out in order to see who was the supreme badass. Only two showed up-- Jack Bauer and MacGyver.
|
||||||
%
|
%
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
%
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart.
|
MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart.
|
||||||
%
|
%
|
||||||
Jack Bauer tried to use his detailed knowledge of torture techniques, but to no avail: Chuck Norris thrives on pain. Chuck Norris then ripped off Jack Bauer's arm and beat him to death with it. Game, set, match.
|
Jack Bauer tried to use his detailed knowledge of torture techniques, but to no avail: Chuck Norris thrives on pain. Chuck Norris then ripped off Jack Bauer's arm and beat him to death with it. Game, set, match.
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,11 @@ Preview the compiled result of your coffeescript with `cf "code"` as per the
|
||||||
following:
|
following:
|
||||||
|
|
||||||
```zsh
|
```zsh
|
||||||
|
<<<<<<< HEAD
|
||||||
$ cf 'if a then b else c'
|
$ cf 'if a then b else c'
|
||||||
|
=======
|
||||||
|
$ cf 'if a then be else c'
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
if (a) {
|
if (a) {
|
||||||
b;
|
b;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,11 @@ cfc () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# compile from clipboard & print
|
# compile from clipboard & print
|
||||||
|
<<<<<<< HEAD
|
||||||
alias cfp='cf "$(clippaste)"'
|
alias cfp='cf "$(clippaste)"'
|
||||||
|
=======
|
||||||
|
alias cfp='coffeeMe "$(clippaste)"'
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
|
|
||||||
# compile from clipboard and copy to clipboard
|
# compile from clipboard and copy to clipboard
|
||||||
alias cfpc='cfp | clipcopy'
|
alias cfpc='cfp | clipcopy'
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,11 @@ zstyle ':completion:*:*:git:*' user-commands \
|
||||||
count:'count commits' \
|
count:'count commits' \
|
||||||
create-branch:'create local and remote branch' \
|
create-branch:'create local and remote branch' \
|
||||||
delete-branch:'delete local and remote branch' \
|
delete-branch:'delete local and remote branch' \
|
||||||
|
<<<<<<< HEAD
|
||||||
delete-merged-branches:'delete merged branches'\
|
delete-merged-branches:'delete merged branches'\
|
||||||
|
=======
|
||||||
|
delete-merged-brancees:'delete merged branches'\
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
delete-submodule:'delete submodule' \
|
delete-submodule:'delete submodule' \
|
||||||
delete-tag:'delete local and remote tag' \
|
delete-tag:'delete local and remote tag' \
|
||||||
effort:'display effort statistics' \
|
effort:'display effort statistics' \
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
#!zsh
|
#!zsh
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
<<<<<<< HEAD
|
||||||
# A descriptive listing of core Gradle commands
|
# A descriptive listing of core Gradle commands
|
||||||
|
=======
|
||||||
|
# A descriptive listing of core Gradle commands
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
############################################################################
|
############################################################################
|
||||||
function _gradle_core_commands() {
|
function _gradle_core_commands() {
|
||||||
local ret=1 state
|
local ret=1 state
|
||||||
|
|
@ -32,15 +36,23 @@ function _gradle_arguments() {
|
||||||
'--stop[Stop the Gradle daemon]' \
|
'--stop[Stop the Gradle daemon]' \
|
||||||
'--daemon[Use the Gradle daemon]' \
|
'--daemon[Use the Gradle daemon]' \
|
||||||
'--no-daemon[Do not use the Gradle daemon]' \
|
'--no-daemon[Do not use the Gradle daemon]' \
|
||||||
|
<<<<<<< HEAD
|
||||||
'--rerun-task [Specifies that any task optimization is ignored.]' \
|
'--rerun-task [Specifies that any task optimization is ignored.]' \
|
||||||
'-i[Log at the info level]' \
|
'-i[Log at the info level]' \
|
||||||
'-m[Dry run]' \
|
'-m[Dry run]' \
|
||||||
'-P[Set a project property]' \
|
'-P[Set a project property]' \
|
||||||
'-p[Specifies the start directory]' \
|
'-p[Specifies the start directory]' \
|
||||||
|
=======
|
||||||
|
'--no-opt[Do not perform any task optimization]' \
|
||||||
|
'-i[Log at the info level]' \
|
||||||
|
'-m[Dry run]' \
|
||||||
|
'-P[Set a project property]' \
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
'--profile[Profile the build time]' \
|
'--profile[Profile the build time]' \
|
||||||
'-q[Log at the quiet level (only show errors)]' \
|
'-q[Log at the quiet level (only show errors)]' \
|
||||||
'-v[Print the Gradle version info]' \
|
'-v[Print the Gradle version info]' \
|
||||||
'-x[Specify a task to be excluded]' \
|
'-x[Specify a task to be excluded]' \
|
||||||
|
<<<<<<< HEAD
|
||||||
'-b[Specifies the build file.]' \
|
'-b[Specifies the build file.]' \
|
||||||
'-c[Specifies the settings file.]' \
|
'-c[Specifies the settings file.]' \
|
||||||
'--continue[Continues task execution after a task failure.]' \
|
'--continue[Continues task execution after a task failure.]' \
|
||||||
|
|
@ -48,6 +60,8 @@ function _gradle_arguments() {
|
||||||
'-I[Specifies an initialization script.]' \
|
'-I[Specifies an initialization script.]' \
|
||||||
'--refresh-dependencies[Refresh the state of dependencies.]' \
|
'--refresh-dependencies[Refresh the state of dependencies.]' \
|
||||||
'-u[Don''t search in parent directories for a settings.gradle file.]' \
|
'-u[Don''t search in parent directories for a settings.gradle file.]' \
|
||||||
|
=======
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
'*::command:->command' \
|
'*::command:->command' \
|
||||||
&& return 0
|
&& return 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,15 @@ for pyenvdir in "${pyenvdirs[@]}" ; do
|
||||||
FOUND_PYENV=1
|
FOUND_PYENV=1
|
||||||
export PYENV_ROOT=$pyenvdir
|
export PYENV_ROOT=$pyenvdir
|
||||||
export PATH=${pyenvdir}/bin:$PATH
|
export PATH=${pyenvdir}/bin:$PATH
|
||||||
|
<<<<<<< HEAD
|
||||||
eval "$(pyenv init - zsh)"
|
eval "$(pyenv init - zsh)"
|
||||||
|
|
||||||
if pyenv commands | command grep -q virtualenv-init; then
|
if pyenv commands | command grep -q virtualenv-init; then
|
||||||
eval "$(pyenv virtualenv-init - zsh)"
|
eval "$(pyenv virtualenv-init - zsh)"
|
||||||
fi
|
fi
|
||||||
|
=======
|
||||||
|
eval "$(pyenv init --no-rehash - zsh)"
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
|
|
||||||
function pyenv_prompt_info() {
|
function pyenv_prompt_info() {
|
||||||
echo "$(pyenv version-name)"
|
echo "$(pyenv version-name)"
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,10 @@ alias rp='rails plugin'
|
||||||
alias ru='rails runner'
|
alias ru='rails runner'
|
||||||
alias rs='rails server'
|
alias rs='rails server'
|
||||||
alias rsd='rails server --debugger'
|
alias rsd='rails server --debugger'
|
||||||
|
<<<<<<< HEAD
|
||||||
alias rsp='rails server --port'
|
alias rsp='rails server --port'
|
||||||
|
=======
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
|
|
||||||
# Rake aliases
|
# Rake aliases
|
||||||
alias rdm='rake db:migrate'
|
alias rdm='rake db:migrate'
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,21 @@ _rake_refresh () {
|
||||||
}
|
}
|
||||||
|
|
||||||
_rake_does_task_list_need_generating () {
|
_rake_does_task_list_need_generating () {
|
||||||
|
<<<<<<< HEAD
|
||||||
[[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]]
|
[[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]]
|
||||||
|
=======
|
||||||
|
if [ ! -f .rake_tasks ]; then return 0;
|
||||||
|
else
|
||||||
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
|
accurate=$(stat -f%m .rake_tasks)
|
||||||
|
changed=$(stat -f%m Rakefile)
|
||||||
|
else
|
||||||
|
accurate=$(stat -c%Y .rake_tasks)
|
||||||
|
changed=$(stat -c%Y Rakefile)
|
||||||
|
fi
|
||||||
|
return $(expr $accurate '>=' $changed)
|
||||||
|
fi
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
}
|
}
|
||||||
|
|
||||||
_rake_generate () {
|
_rake_generate () {
|
||||||
|
|
|
||||||
450
themes/bullet-train.zsh-theme
Normal file
450
themes/bullet-train.zsh-theme
Normal file
|
|
@ -0,0 +1,450 @@
|
||||||
|
# README
|
||||||
|
#
|
||||||
|
# In order for this theme to render correctly, you will need a
|
||||||
|
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
|
||||||
|
#
|
||||||
|
# In addition, I recommend the
|
||||||
|
# [Tomorrow Night theme](https://github.com/chriskempson/tomorrow-theme) and, if
|
||||||
|
# you're using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over
|
||||||
|
# Terminal.app - it has significantly better color fidelity.
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# CONFIGURATION
|
||||||
|
# The default configuration, that can be overwrite in your .zshrc file
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
VIRTUAL_ENV_DISABLE_PROMPT=true
|
||||||
|
|
||||||
|
# PROMPT
|
||||||
|
if [ ! -n "${BULLETTRAIN_PROMPT_CHAR+1}" ]; then
|
||||||
|
BULLETTRAIN_PROMPT_CHAR="\$"
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_PROMPT_ROOT+1}" ]; then
|
||||||
|
BULLETTRAIN_PROMPT_ROOT=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# STATUS
|
||||||
|
if [ ! -n "${BULLETTRAIN_STATUS_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_STATUS_SHOW=true
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_STATUS_EXIT_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_STATUS_EXIT_SHOW=false
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_STATUS_BG+1}" ]; then
|
||||||
|
BULLETTRAIN_STATUS_BG=green
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_STATUS_ERROR_BG+1}" ]; then
|
||||||
|
BULLETTRAIN_STATUS_ERROR_BG=red
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_STATUS_FG+1}" ]; then
|
||||||
|
BULLETTRAIN_STATUS_FG=white
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TIME
|
||||||
|
if [ ! -n "${BULLETTRAIN_TIME_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_TIME_SHOW=true
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_TIME_BG+1}" ]; then
|
||||||
|
BULLETTRAIN_TIME_BG=white
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_TIME_FG+1}" ]; then
|
||||||
|
BULLETTRAIN_TIME_FG=black
|
||||||
|
fi
|
||||||
|
|
||||||
|
# VIRTUALENV
|
||||||
|
if [ ! -n "${BULLETTRAIN_VIRTUALENV_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_VIRTUALENV_SHOW=true
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_VIRTUALENV_BG+1}" ]; then
|
||||||
|
BULLETTRAIN_VIRTUALENV_BG=yellow
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_VIRTUALENV_FG+1}" ]; then
|
||||||
|
BULLETTRAIN_VIRTUALENV_FG=white
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_VIRTUALENV_PREFIX+1}" ]; then
|
||||||
|
BULLETTRAIN_VIRTUALENV_PREFIX=🐍
|
||||||
|
fi
|
||||||
|
|
||||||
|
# NVM
|
||||||
|
if [ ! -n "${BULLETTRAIN_NVM_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_NVM_SHOW=false
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_NVM_BG+1}" ]; then
|
||||||
|
BULLETTRAIN_NVM_BG=green
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_NVM_FG+1}" ]; then
|
||||||
|
BULLETTRAIN_NVM_FG=white
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_NVM_PREFIX+1}" ]; then
|
||||||
|
BULLETTRAIN_NVM_PREFIX="⬡ "
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RMV
|
||||||
|
if [ ! -n "${BULLETTRAIN_RVM_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_RVM_SHOW=true
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_RVM_BG+1}" ]; then
|
||||||
|
BULLETTRAIN_RVM_BG=magenta
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_RVM_FG+1}" ]; then
|
||||||
|
BULLETTRAIN_RVM_FG=white
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_RVM_PREFIX+1}" ]; then
|
||||||
|
BULLETTRAIN_RVM_PREFIX=♦️
|
||||||
|
fi
|
||||||
|
|
||||||
|
# DIR
|
||||||
|
if [ ! -n "${BULLETTRAIN_DIR_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_DIR_SHOW=true
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_DIR_BG+1}" ]; then
|
||||||
|
BULLETTRAIN_DIR_BG=blue
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_DIR_FG+1}" ]; then
|
||||||
|
BULLETTRAIN_DIR_FG=white
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_DIR_CONTEXT_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_DIR_CONTEXT_SHOW=false
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_DIR_EXTENDED+1}" ]; then
|
||||||
|
BULLETTRAIN_DIR_EXTENDED=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# GIT
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_GIT_SHOW=true
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_BG+1}" ]; then
|
||||||
|
BULLETTRAIN_GIT_BG=white
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_FG+1}" ]; then
|
||||||
|
BULLETTRAIN_GIT_FG=black
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_EXTENDED+1}" ]; then
|
||||||
|
BULLETTRAIN_GIT_EXTENDED=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CONTEXT
|
||||||
|
if [ ! -n "${BULLETTRAIN_CONTEXT_SHOW+1}" ]; then
|
||||||
|
BULLETTRAIN_CONTEXT_SHOW=false
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_CONTEXT_BG+1}" ]; then
|
||||||
|
BULLETTRAIN_CONTEXT_BG=black
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_CONTEXT_FG+1}" ]; then
|
||||||
|
BULLETTRAIN_CONTEXT_FG=default
|
||||||
|
fi
|
||||||
|
|
||||||
|
# GIT PROMPT
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_PREFIX+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=" \ue0a0 "
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=$BULLETTRAIN_GIT_PREFIX
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_SUFFIX+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX=$BULLETTRAIN_GIT_SUFFIX
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_DIRTY+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY=" ✘"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY=$BULLETTRAIN_GIT_DIRTY
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_CLEAN+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=" ✔"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=$BULLETTRAIN_GIT_CLEAN
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_ADDED+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_ADDED=" %F{green}✚%F{black}"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_ADDED=$BULLETTRAIN_GIT_ADDED
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_MODIFIED+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_MODIFIED=" %F{blue}✹%F{black}"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_MODIFIED=$BULLETTRAIN_GIT_MODIFIED
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_DELETED+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_DELETED=" %F{red}✖%F{black}"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_DELETED=$BULLETTRAIN_GIT_DELETED
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_UNTRACKED+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNTRACKED=" %F{yellow}✭%F{black}"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNTRACKED=$BULLETTRAIN_GIT_UNTRACKED
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_RENAMED+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_RENAMED=" ➜"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_RENAMED=$BULLETTRAIN_GIT_RENAMED
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_UNMERGED+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNMERGED=" ═"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_UNMERGED=$BULLETTRAIN_GIT_UNMERGED
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_AHEAD+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_AHEAD=" ⬆"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_AHEAD=$BULLETTRAIN_GIT_AHEAD
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_BEHIND+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_BEHIND=" ⬇"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_BEHIND=$BULLETTRAIN_GIT_BEHIND
|
||||||
|
fi
|
||||||
|
if [ ! -n "${BULLETTRAIN_GIT_DIVERGED+1}" ]; then
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIVERGED=" ⬍"
|
||||||
|
else
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIVERGED=$BULLETTRAIN_GIT_PROMPT_DIVERGED
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# SEGMENT DRAWING
|
||||||
|
# A few functions to make it easy and re-usable to draw segmented prompts
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
CURRENT_BG='NONE'
|
||||||
|
SEGMENT_SEPARATOR=''
|
||||||
|
|
||||||
|
# Begin a segment
|
||||||
|
# Takes two arguments, background and foreground. Both can be omitted,
|
||||||
|
# rendering default background/foreground.
|
||||||
|
prompt_segment() {
|
||||||
|
local bg fg
|
||||||
|
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
|
||||||
|
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
|
||||||
|
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
|
||||||
|
echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
|
||||||
|
else
|
||||||
|
echo -n "%{$bg%}%{$fg%} "
|
||||||
|
fi
|
||||||
|
CURRENT_BG=$1
|
||||||
|
[[ -n $3 ]] && echo -n $3
|
||||||
|
}
|
||||||
|
|
||||||
|
# End the prompt, closing any open segments
|
||||||
|
prompt_end() {
|
||||||
|
if [[ -n $CURRENT_BG ]]; then
|
||||||
|
echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
|
||||||
|
else
|
||||||
|
echo -n "%{%k%}"
|
||||||
|
fi
|
||||||
|
echo -n "%{%f%}"
|
||||||
|
CURRENT_BG=''
|
||||||
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# PROMPT COMPONENTS
|
||||||
|
# Each component will draw itself, and hide itself if no information needs
|
||||||
|
# to be shown
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Context: user@hostname (who am I and where am I)
|
||||||
|
context() {
|
||||||
|
local user="$(whoami)"
|
||||||
|
[[ "$user" != "$BULLETTRAIN_CONTEXT_DEFAULT_USER" || -n "$BULLETTRAIN_IS_SSH_CLIENT" ]] && echo -n "${user}@%m"
|
||||||
|
}
|
||||||
|
prompt_context() {
|
||||||
|
[[ $BULLETTRAIN_CONTEXT_SHOW == false ]] && return
|
||||||
|
|
||||||
|
local _context="$(context)"
|
||||||
|
[[ -n "$_context" ]] && prompt_segment $BULLETTRAIN_CONTEXT_BG $BULLETTRAIN_CONTEXT_FG "$_context"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Git
|
||||||
|
prompt_git() {
|
||||||
|
if [[ $BULLETTRAIN_GIT_SHOW == false ]] then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ref dirty mode repo_path
|
||||||
|
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
||||||
|
|
||||||
|
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||||
|
prompt_segment $BULLETTRAIN_GIT_BG $BULLETTRAIN_GIT_FG
|
||||||
|
|
||||||
|
if [[ $BULLETTRAIN_GIT_EXTENDED == true ]] then
|
||||||
|
echo -n $(git_prompt_info)$(git_prompt_status)
|
||||||
|
else
|
||||||
|
echo -n $(git_prompt_info)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt_hg() {
|
||||||
|
local rev status
|
||||||
|
if $(hg id >/dev/null 2>&1); then
|
||||||
|
if $(hg prompt >/dev/null 2>&1); then
|
||||||
|
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
||||||
|
# if files are not added
|
||||||
|
prompt_segment red white
|
||||||
|
st='±'
|
||||||
|
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
||||||
|
# if any modification
|
||||||
|
prompt_segment yellow black
|
||||||
|
st='±'
|
||||||
|
else
|
||||||
|
# if working copy is clean
|
||||||
|
prompt_segment green black
|
||||||
|
fi
|
||||||
|
echo -n $(hg prompt "☿ {rev}@{branch}") $st
|
||||||
|
else
|
||||||
|
st=""
|
||||||
|
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||||
|
branch=$(hg id -b 2>/dev/null)
|
||||||
|
if $(hg st | grep -Eq "^\?"); then
|
||||||
|
prompt_segment red black
|
||||||
|
st='±'
|
||||||
|
elif $(hg st | grep -Eq "^(M|A)"); then
|
||||||
|
prompt_segment yellow black
|
||||||
|
st='±'
|
||||||
|
else
|
||||||
|
prompt_segment green black
|
||||||
|
fi
|
||||||
|
echo -n "☿ $rev@$branch" $st
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Dir: current working directory
|
||||||
|
prompt_dir() {
|
||||||
|
if [[ $BULLETTRAIN_DIR_SHOW == false ]] then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local dir=''
|
||||||
|
local _context="$(context)"
|
||||||
|
[[ $BULLETTRAIN_DIR_CONTEXT_SHOW == true && -n "$_context" ]] && dir="${dir}${_context}:"
|
||||||
|
|
||||||
|
if [[ $BULLETTRAIN_DIR_EXTENDED == 0 ]]; then
|
||||||
|
#short directories
|
||||||
|
dir="${dir}%1~"
|
||||||
|
elif [[ $BULLETTRAIN_DIR_EXTENDED == 2 ]]; then
|
||||||
|
#long directories
|
||||||
|
dir="${dir}%0~"
|
||||||
|
else
|
||||||
|
#medium directories (default case)
|
||||||
|
dir="${dir}%4(c:...:)%3c"
|
||||||
|
fi
|
||||||
|
|
||||||
|
prompt_segment $BULLETTRAIN_DIR_BG $BULLETTRAIN_DIR_FG $dir
|
||||||
|
}
|
||||||
|
|
||||||
|
# RVM: only shows RVM info if on a gemset that is not the default one
|
||||||
|
prompt_rvm() {
|
||||||
|
if [[ $BULLETTRAIN_RVM_SHOW == false ]] then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if which rvm-prompt &> /dev/null; then
|
||||||
|
if [[ ! -n $(rvm gemset list | grep "=> (default)") ]]
|
||||||
|
then
|
||||||
|
prompt_segment $BULLETTRAIN_RVM_BG $BULLETTRAIN_RVM_FG $BULLETTRAIN_RVM_PREFIX" $(rvm-prompt i v g)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Virtualenv: current working virtualenv
|
||||||
|
prompt_virtualenv() {
|
||||||
|
if [[ $BULLETTRAIN_VIRTUALENV_SHOW == false ]] then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local virtualenv_path="$VIRTUAL_ENV"
|
||||||
|
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
|
||||||
|
prompt_segment $BULLETTRAIN_VIRTUALENV_BG $BULLETTRAIN_VIRTUALENV_FG $BULLETTRAIN_VIRTUALENV_PREFIX" $(basename $virtualenv_path)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# NVM: Node version manager
|
||||||
|
prompt_nvm() {
|
||||||
|
if [[ $BULLETTRAIN_NVM_SHOW == false ]] then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
$(type nvm >/dev/null 2>&1) || return
|
||||||
|
|
||||||
|
local nvm_prompt
|
||||||
|
nvm_prompt=$(node -v 2>/dev/null)
|
||||||
|
[[ "${nvm_prompt}x" == "x" ]] && return
|
||||||
|
nvm_prompt=${nvm_prompt:1}
|
||||||
|
prompt_segment $BULLETTRAIN_NVM_BG $BULLETTRAIN_NVM_FG $BULLETTRAIN_NVM_PREFIX$nvm_prompt
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt_time() {
|
||||||
|
if [[ $BULLETTRAIN_TIME_SHOW == false ]] then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $BULLETTRAIN_TIME_12HR == true ]] then
|
||||||
|
prompt_segment $BULLETTRAIN_TIME_BG $BULLETTRAIN_TIME_FG %D{%r}
|
||||||
|
else
|
||||||
|
prompt_segment $BULLETTRAIN_TIME_BG $BULLETTRAIN_TIME_FG %D{%X}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Status:
|
||||||
|
# - was there an error
|
||||||
|
# - am I root
|
||||||
|
# - are there background jobs?
|
||||||
|
prompt_status() {
|
||||||
|
if [[ $BULLETTRAIN_STATUS_SHOW == false ]] then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local symbols
|
||||||
|
symbols=()
|
||||||
|
[[ $RETVAL -ne 0 && $BULLETTRAIN_STATUS_EXIT_SHOW != true ]] && symbols+="✘"
|
||||||
|
[[ $RETVAL -ne 0 && $BULLETTRAIN_STATUS_EXIT_SHOW == true ]] && symbols+="✘ $RETVAL"
|
||||||
|
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡%f"
|
||||||
|
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="⚙"
|
||||||
|
|
||||||
|
if [[ -n "$symbols" && $RETVAL -ne 0 ]] then
|
||||||
|
prompt_segment $BULLETTRAIN_STATUS_ERROR_BG $BULLETTRAIN_STATUS_FG "$symbols"
|
||||||
|
elif [[ -n "$symbols" ]] then
|
||||||
|
prompt_segment $BULLETTRAIN_STATUS_BG $BULLETTRAIN_STATUS_FG "$symbols"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Prompt Character
|
||||||
|
prompt_char() {
|
||||||
|
local bt_prompt_char
|
||||||
|
|
||||||
|
if [[ ${#BULLETTRAIN_PROMPT_CHAR} -eq 1 ]] then
|
||||||
|
bt_prompt_char="${BULLETTRAIN_PROMPT_CHAR}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $BULLETTRAIN_PROMPT_ROOT == true ]] then
|
||||||
|
bt_prompt_char="%(!.%F{red}#.%F{green}${bt_prompt_char}%f)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n $bt_prompt_char
|
||||||
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# MAIN
|
||||||
|
# Entry point
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
build_prompt() {
|
||||||
|
RETVAL=$?
|
||||||
|
prompt_time
|
||||||
|
prompt_status
|
||||||
|
prompt_rvm
|
||||||
|
prompt_virtualenv
|
||||||
|
prompt_nvm
|
||||||
|
prompt_context
|
||||||
|
prompt_dir
|
||||||
|
prompt_git
|
||||||
|
# prompt_hg
|
||||||
|
prompt_end
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT='
|
||||||
|
%{%f%b%k%}$(build_prompt)
|
||||||
|
%{${fg_bold[default]}%}$(prompt_char) %{$reset_color%}'
|
||||||
1
themes/powerlevel9k
Submodule
1
themes/powerlevel9k
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1390fbdea5b278474eafe889da327979654c0d99
|
||||||
655
themes/powerlevel9k.zsh-theme
Normal file
655
themes/powerlevel9k.zsh-theme
Normal file
|
|
@ -0,0 +1,655 @@
|
||||||
|
# vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
|
||||||
|
################################################################
|
||||||
|
# powerlevel9k Theme
|
||||||
|
# https://github.com/bhilburn/powerlevel9k
|
||||||
|
#
|
||||||
|
# This theme was inspired by agnoster's Theme:
|
||||||
|
# https://gist.github.com/3712874
|
||||||
|
#
|
||||||
|
# The `vcs_info` hooks in this file are from Tom Upton:
|
||||||
|
# https://github.com/tupton/dotfiles/blob/master/zsh/zshrc
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Please see the README file located in the source repository for full docs.
|
||||||
|
# What follows is a brief list of the settings variables used by this theme.
|
||||||
|
# You should define these variables in your `~/.zshrc`.
|
||||||
|
#
|
||||||
|
# Customize which segments appear in which prompts (below is also the default):
|
||||||
|
# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
|
||||||
|
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time)
|
||||||
|
#
|
||||||
|
# Set your Amazon Web Services profile for the `aws` segment:
|
||||||
|
# export AWS_DEFAULT_PROFILE=<profile_name>
|
||||||
|
#
|
||||||
|
# Set your username for the `context` segment:
|
||||||
|
# export DEFAULT_USER=<your username>
|
||||||
|
#
|
||||||
|
# Customize the format of the time segment. Example of reverse format:
|
||||||
|
# POWERLEVEL9K_TIME_FORMAT='%D{%S:%M:%H}'
|
||||||
|
#
|
||||||
|
# Show the hash/changeset string in the `vcs` segment:
|
||||||
|
# POWERLEVEL9K_SHOW_CHANGESET=true
|
||||||
|
# Set the length of the hash/changeset if enabled in the `vcs` segment:
|
||||||
|
# POWERLEVEL9K_CHANGESET_HASH_LENGTH=6
|
||||||
|
#
|
||||||
|
# Make powerlevel9k a double-lined prompt:
|
||||||
|
# POWERLEVEL9K_PROMPT_ON_NEWLINE=true
|
||||||
|
#
|
||||||
|
# Set the colorscheme:
|
||||||
|
# POWERLEVEL9K_COLOR_SCHEME='light'
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
#zstyle ':vcs_info:*+*:*' debug true
|
||||||
|
#set -o xtrace
|
||||||
|
|
||||||
|
# These characters require the Powerline fonts to work properly. If see boxes or
|
||||||
|
# bizarre characters below, your fonts are not correctly installed. If you
|
||||||
|
# do not want to install a special font, you can set `POWERLEVEL9K_MODE` to
|
||||||
|
# `compatible`. This shows all icons in regular symbols.
|
||||||
|
case $POWERLEVEL9K_MODE in
|
||||||
|
'flat')
|
||||||
|
# Awesome-Patched Font required!
|
||||||
|
# See https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched
|
||||||
|
LEFT_SEGMENT_SEPARATOR=''
|
||||||
|
RIGHT_SEGMENT_SEPARATOR=''
|
||||||
|
ROOT_ICON="\uE801" #
|
||||||
|
RUBY_ICON="\uE847" #
|
||||||
|
AWS_ICON="\uE895" #
|
||||||
|
BACKGROUND_JOBS_ICON="\uE82F " #
|
||||||
|
TEST_ICON="\uE891" #
|
||||||
|
OK_ICON="\u2713" # ✓
|
||||||
|
FAIL_ICON="\u2718" # ✘
|
||||||
|
SYMFONY_ICON="SF"
|
||||||
|
VCS_UNTRACKED_ICON="\uE16C" #
|
||||||
|
VCS_UNSTAGED_ICON="\uE17C" #
|
||||||
|
VCS_STAGED_ICON="\uE168" #
|
||||||
|
VCS_STASH_ICON="\uE133 " #
|
||||||
|
#VCS_INCOMING_CHANGES="\uE1EB " #
|
||||||
|
#VCS_INCOMING_CHANGES="\uE80D " #
|
||||||
|
VCS_INCOMING_CHANGES="\uE131 " #
|
||||||
|
#VCS_OUTGOING_CHANGES="\uE1EC " #
|
||||||
|
#VCS_OUTGOING_CHANGES="\uE80E " #
|
||||||
|
VCS_OUTGOING_CHANGES="\uE132 " #
|
||||||
|
VCS_TAG_ICON="\uE817 " #
|
||||||
|
VCS_BOOKMARK_ICON="\uE87B" #
|
||||||
|
VCS_COMMIT_ICON="\uE821 " #
|
||||||
|
VCS_BRANCH_ICON="\uE220" #
|
||||||
|
VCS_REMOTE_BRANCH_ICON=" \uE804 " #
|
||||||
|
VCS_GIT_ICON="\uE20E " #
|
||||||
|
VCS_HG_ICON="\uE1C3 " #
|
||||||
|
;;
|
||||||
|
'compatible')
|
||||||
|
LEFT_SEGMENT_SEPARATOR="\u2B80" # ⮀
|
||||||
|
RIGHT_SEGMENT_SEPARATOR="\u2B82" # ⮂
|
||||||
|
ROOT_ICON="\u26A1" # ⚡
|
||||||
|
RUBY_ICON=''
|
||||||
|
AWS_ICON="AWS:"
|
||||||
|
BACKGROUND_JOBS_ICON="\u2699" # ⚙
|
||||||
|
TEST_ICON=''
|
||||||
|
OK_ICON="\u2713" # ✓
|
||||||
|
FAIL_ICON="\u2718" # ✘
|
||||||
|
SYMFONY_ICON="SF"
|
||||||
|
VCS_UNTRACKED_ICON='?'
|
||||||
|
VCS_UNSTAGED_ICON="\u25CF" # ●
|
||||||
|
VCS_STAGED_ICON="\u271A" # ✚
|
||||||
|
VCS_STASH_ICON="\u235F" # ⍟
|
||||||
|
VCS_INCOMING_CHANGES="\u2193" # ↓
|
||||||
|
VCS_OUTGOING_CHANGES="\u2191" # ↑
|
||||||
|
VCS_TAG_ICON=''
|
||||||
|
VCS_BOOKMARK_ICON="\u263F" # ☿
|
||||||
|
VCS_COMMIT_ICON=''
|
||||||
|
VCS_BRANCH_ICON='@'
|
||||||
|
VCS_REMOTE_BRANCH_ICON="\u2192" # →
|
||||||
|
VCS_GIT_ICON='Git'
|
||||||
|
VCS_HG_ICON='HG'
|
||||||
|
;;
|
||||||
|
'awesome-patched')
|
||||||
|
# Awesome-Patched Font required!
|
||||||
|
# See https://github.com/gabrielelana/awesome-terminal-fonts/tree/patching-strategy/patched
|
||||||
|
LEFT_SEGMENT_SEPARATOR="\uE0B0" #
|
||||||
|
RIGHT_SEGMENT_SEPARATOR="\uE0B2" #
|
||||||
|
ROOT_ICON="\u26A1" # ⚡
|
||||||
|
RUBY_ICON="\uE847" #
|
||||||
|
AWS_ICON="\uE895" #
|
||||||
|
BACKGROUND_JOBS_ICON="\uE82F " #
|
||||||
|
TEST_ICON="\uE891" #
|
||||||
|
OK_ICON="\u2713" # ✓
|
||||||
|
FAIL_ICON="\u2718" # ✘
|
||||||
|
SYMFONY_ICON="SF"
|
||||||
|
VCS_UNTRACKED_ICON="\uE16C" #
|
||||||
|
VCS_UNSTAGED_ICON="\uE17C" #
|
||||||
|
VCS_STAGED_ICON="\uE168" #
|
||||||
|
VCS_STASH_ICON="\uE133 " #
|
||||||
|
#VCS_INCOMING_CHANGES="\uE1EB " #
|
||||||
|
#VCS_INCOMING_CHANGES="\uE80D " #
|
||||||
|
VCS_INCOMING_CHANGES="\uE131 " #
|
||||||
|
#VCS_OUTGOING_CHANGES="\uE1EC " #
|
||||||
|
#VCS_OUTGOING_CHANGES="\uE80E " #
|
||||||
|
VCS_OUTGOING_CHANGES="\uE132 " #
|
||||||
|
VCS_TAG_ICON="\uE817 " #
|
||||||
|
VCS_BOOKMARK_ICON="\uE87B" #
|
||||||
|
VCS_COMMIT_ICON="\uE821 " #
|
||||||
|
VCS_BRANCH_ICON="\uE220" #
|
||||||
|
VCS_REMOTE_BRANCH_ICON=" \uE804 " #
|
||||||
|
VCS_GIT_ICON="\uE20E " #
|
||||||
|
VCS_HG_ICON="\uE1C3 " #
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Powerline-Patched Font required!
|
||||||
|
# See https://github.com/Lokaltog/powerline-fonts
|
||||||
|
LEFT_SEGMENT_SEPARATOR="\uE0B0" #
|
||||||
|
RIGHT_SEGMENT_SEPARATOR="\uE0B2" #
|
||||||
|
ROOT_ICON="\u26A1" # ⚡
|
||||||
|
RUBY_ICON=''
|
||||||
|
AWS_ICON="AWS:"
|
||||||
|
BACKGROUND_JOBS_ICON="\u2699" # ⚙
|
||||||
|
TEST_ICON=''
|
||||||
|
OK_ICON="\u2713" # ✓
|
||||||
|
FAIL_ICON="\u2718" # ✘
|
||||||
|
SYMFONY_ICON="SF"
|
||||||
|
VCS_UNTRACKED_ICON='?'
|
||||||
|
VCS_UNSTAGED_ICON="\u25CF" # ●
|
||||||
|
VCS_STAGED_ICON="\u271A" # ✚
|
||||||
|
VCS_STASH_ICON="\u235F" # ⍟
|
||||||
|
VCS_INCOMING_CHANGES="\u2193" # ↓
|
||||||
|
VCS_OUTGOING_CHANGES="\u2191" # ↑
|
||||||
|
VCS_TAG_ICON=''
|
||||||
|
VCS_BOOKMARK_ICON="\u263F" # ☿
|
||||||
|
VCS_COMMIT_ICON=''
|
||||||
|
VCS_BRANCH_ICON="\uE0A0 " #
|
||||||
|
VCS_REMOTE_BRANCH_ICON="\u2192" # →
|
||||||
|
VCS_GIT_ICON=""
|
||||||
|
VCS_HG_ICON=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ "$POWERLEVEL9K_HIDE_BRANCH_ICON" == true ]]; then
|
||||||
|
VCS_BRANCH_ICON=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# color scheme
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
if [[ "$POWERLEVEL9K_COLOR_SCHEME" == "light" ]]; then
|
||||||
|
DEFAULT_COLOR=white
|
||||||
|
DEFAULT_COLOR_INVERTED=black
|
||||||
|
DEFAULT_COLOR_DARK="252"
|
||||||
|
else
|
||||||
|
DEFAULT_COLOR=black
|
||||||
|
DEFAULT_COLOR_INVERTED=white
|
||||||
|
DEFAULT_COLOR_DARK="236"
|
||||||
|
fi
|
||||||
|
|
||||||
|
VCS_FOREGROUND_COLOR=$DEFAULT_COLOR
|
||||||
|
VCS_FOREGROUND_COLOR_DARK=$DEFAULT_COLOR_DARK
|
||||||
|
|
||||||
|
# If user has defined custom colors for the `vcs` segment, override the defaults
|
||||||
|
if [[ -n $POWERLEVEL9K_VCS_FOREGROUND ]]; then
|
||||||
|
VCS_FOREGROUND_COLOR=$POWERLEVEL9K_VCS_FOREGROUND
|
||||||
|
fi
|
||||||
|
if [[ -n $POWERLEVEL9K_VCS_DARK_FOREGROUND ]]; then
|
||||||
|
VCS_FOREGROUND_COLOR_DARK=$POWERLEVEL9K_VCS_DARK_FOREGROUND
|
||||||
|
fi
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# VCS Information Settings
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
setopt prompt_subst
|
||||||
|
autoload -Uz vcs_info
|
||||||
|
|
||||||
|
VCS_WORKDIR_DIRTY=false
|
||||||
|
VCS_CHANGESET_PREFIX=''
|
||||||
|
if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then
|
||||||
|
# Default: Just display the first 12 characters of our changeset-ID.
|
||||||
|
local VCS_CHANGESET_HASH_LENGTH=12
|
||||||
|
if [[ -n "$POWERLEVEL9K_CHANGESET_HASH_LENGTH" ]]; then
|
||||||
|
VCS_CHANGESET_HASH_LENGTH="$POWERLEVEL9K_CHANGESET_HASH_LENGTH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
VCS_CHANGESET_PREFIX="%F{$VCS_FOREGROUND_COLOR_DARK}$VCS_COMMIT_ICON%0.$VCS_CHANGESET_HASH_LENGTH""i%f "
|
||||||
|
fi
|
||||||
|
|
||||||
|
zstyle ':vcs_info:*' enable git hg
|
||||||
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
|
|
||||||
|
VCS_DEFAULT_FORMAT="$VCS_CHANGESET_PREFIX%F{$VCS_FOREGROUND_COLOR}%b%c%u%m%f"
|
||||||
|
zstyle ':vcs_info:git*:*' formats "%F{$VCS_FOREGROUND_COLOR}$VCS_GIT_ICON%f$VCS_DEFAULT_FORMAT"
|
||||||
|
zstyle ':vcs_info:hg*:*' formats "%F{$VCS_FOREGROUND_COLOR}$VCS_HG_ICON%f$VCS_DEFAULT_FORMAT"
|
||||||
|
|
||||||
|
zstyle ':vcs_info:*' actionformats "%b %F{red}| %a%f"
|
||||||
|
|
||||||
|
zstyle ':vcs_info:*' stagedstr " %F{$VCS_FOREGROUND_COLOR}$VCS_STAGED_ICON%f"
|
||||||
|
zstyle ':vcs_info:*' unstagedstr " %F{$VCS_FOREGROUND_COLOR}$VCS_UNSTAGED_ICON%f"
|
||||||
|
|
||||||
|
zstyle ':vcs_info:git*+set-message:*' hooks vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname
|
||||||
|
zstyle ':vcs_info:hg*+set-message:*' hooks vcs-detect-changes
|
||||||
|
|
||||||
|
# For Hg, only show the branch name
|
||||||
|
zstyle ':vcs_info:hg*:*' branchformat "$VCS_BRANCH_ICON%b"
|
||||||
|
# The `get-revision` function must be turned on for dirty-check to work for Hg
|
||||||
|
zstyle ':vcs_info:hg*:*' get-revision true
|
||||||
|
zstyle ':vcs_info:hg*:*' get-bookmarks true
|
||||||
|
zstyle ':vcs_info:hg*+gen-hg-bookmark-string:*' hooks hg-bookmarks
|
||||||
|
|
||||||
|
if [[ "$POWERLEVEL9K_SHOW_CHANGESET" == true ]]; then
|
||||||
|
zstyle ':vcs_info:*' get-revision true
|
||||||
|
fi
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Prompt Segment Constructors
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
# Begin a left prompt segment
|
||||||
|
# Takes four arguments:
|
||||||
|
# * $1: Name of the function that was orginally invoked (mandatory).
|
||||||
|
# Necessary, to make the dynamic color-overwrite mechanism work.
|
||||||
|
# * $2: Background color
|
||||||
|
# * $3: Foreground color
|
||||||
|
# * $4: The segment content
|
||||||
|
# The latter three can be omitted,
|
||||||
|
left_prompt_segment() {
|
||||||
|
# Overwrite given background-color by user defined variable for this segment.
|
||||||
|
# We get as first Parameter the function name, which called this function.
|
||||||
|
# From the given function name, we strip the "prompt_"-prefix and uppercase it.
|
||||||
|
# This is, prefixed with "POWERLEVEL9K_" and suffixed with either "_BACKGROUND"
|
||||||
|
# of "_FOREGROUND", our variable name. So each new Segment should automatically
|
||||||
|
# be overwritable by a variable following this naming convention.
|
||||||
|
local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND
|
||||||
|
local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE}
|
||||||
|
[[ -n $BG_COLOR_MODIFIER ]] && 2=$BG_COLOR_MODIFIER
|
||||||
|
|
||||||
|
# Overwrite given foreground-color by user defined variable for this segment.
|
||||||
|
local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND
|
||||||
|
local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE}
|
||||||
|
[[ -n $FG_COLOR_MODIFIER ]] && 3=$FG_COLOR_MODIFIER
|
||||||
|
|
||||||
|
local bg fg
|
||||||
|
[[ -n $2 ]] && bg="%K{$2}" || bg="%k"
|
||||||
|
[[ -n $3 ]] && fg="%F{$3}" || fg="%f"
|
||||||
|
if [[ $CURRENT_BG != 'NONE' && $2 != $CURRENT_BG ]]; then
|
||||||
|
# Middle segment
|
||||||
|
echo -n "%{$bg%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR%{$fg%} "
|
||||||
|
else
|
||||||
|
# First segment
|
||||||
|
echo -n "%{$bg%}%{$fg%} "
|
||||||
|
fi
|
||||||
|
CURRENT_BG=$2
|
||||||
|
[[ -n $4 ]] && echo -n "$4 "
|
||||||
|
}
|
||||||
|
|
||||||
|
# End the left prompt, closing any open segments
|
||||||
|
left_prompt_end() {
|
||||||
|
if [[ -n $CURRENT_BG ]]; then
|
||||||
|
echo -n "%{%k%F{$CURRENT_BG}%}$LEFT_SEGMENT_SEPARATOR"
|
||||||
|
else
|
||||||
|
echo -n "%{%k%}"
|
||||||
|
fi
|
||||||
|
echo -n "%{%f%} "
|
||||||
|
CURRENT_BG=''
|
||||||
|
}
|
||||||
|
|
||||||
|
# Begin a right prompt segment
|
||||||
|
# Takes four arguments:
|
||||||
|
# * $1: Name of the function that was orginally invoked (mandatory).
|
||||||
|
# Necessary, to make the dynamic color-overwrite mechanism work.
|
||||||
|
# * $2: Background color
|
||||||
|
# * $3: Foreground color
|
||||||
|
# * $4: The segment content
|
||||||
|
# No ending for the right prompt segment is needed (unlike the left prompt, above).
|
||||||
|
right_prompt_segment() {
|
||||||
|
# Overwrite given background-color by user defined variable for this segment.
|
||||||
|
local BACKGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_BACKGROUND
|
||||||
|
local BG_COLOR_MODIFIER=${(P)BACKGROUND_USER_VARIABLE}
|
||||||
|
[[ -n $BG_COLOR_MODIFIER ]] && 2=$BG_COLOR_MODIFIER
|
||||||
|
|
||||||
|
# Overwrite given foreground-color by user defined variable for this segment.
|
||||||
|
local FOREGROUND_USER_VARIABLE=POWERLEVEL9K_${(U)1#prompt_}_FOREGROUND
|
||||||
|
local FG_COLOR_MODIFIER=${(P)FOREGROUND_USER_VARIABLE}
|
||||||
|
[[ -n $FG_COLOR_MODIFIER ]] && 3=$FG_COLOR_MODIFIER
|
||||||
|
|
||||||
|
local bg fg
|
||||||
|
[[ -n $2 ]] && bg="%K{$2}" || bg="%k"
|
||||||
|
[[ -n $3 ]] && fg="%F{$3}" || fg="%f"
|
||||||
|
echo -n "%f%F{$2}$RIGHT_SEGMENT_SEPARATOR%f%{$bg%}%{$fg%} "
|
||||||
|
[[ -n $4 ]] && echo -n "$4 "
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# The 'vcs' Segment and VCS_INFO hooks / helper functions
|
||||||
|
################################################################
|
||||||
|
prompt_vcs() {
|
||||||
|
local vcs_prompt="${vcs_info_msg_0_}"
|
||||||
|
|
||||||
|
if [[ -n "$vcs_prompt" ]]; then
|
||||||
|
if [[ "$VCS_WORKDIR_DIRTY" == true ]]; then
|
||||||
|
$1_prompt_segment "$0_MODIFIED" "yellow" "$DEFAULT_COLOR"
|
||||||
|
else
|
||||||
|
$1_prompt_segment "$0" "green" "$DEFAULT_COLOR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "$vcs_prompt "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function +vi-git-untracked() {
|
||||||
|
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' && \
|
||||||
|
${$(git ls-files --others --exclude-standard | sed q | wc -l)// /} != 0 ]]; then
|
||||||
|
hook_com[unstaged]+=" %F{$VCS_FOREGROUND_COLOR}$VCS_UNTRACKED_ICON%f"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function +vi-git-aheadbehind() {
|
||||||
|
local ahead behind branch_name
|
||||||
|
local -a gitstatus
|
||||||
|
|
||||||
|
branch_name=${$(git symbolic-ref --short HEAD 2>/dev/null)}
|
||||||
|
|
||||||
|
# for git prior to 1.7
|
||||||
|
# ahead=$(git rev-list origin/${branch_name}..HEAD | wc -l)
|
||||||
|
ahead=$(git rev-list ${branch_name}@{upstream}..HEAD 2>/dev/null | wc -l)
|
||||||
|
(( $ahead )) && gitstatus+=( " %F{$VCS_FOREGROUND_COLOR}$VCS_OUTGOING_CHANGES${ahead// /}%f" )
|
||||||
|
|
||||||
|
# for git prior to 1.7
|
||||||
|
# behind=$(git rev-list HEAD..origin/${branch_name} | wc -l)
|
||||||
|
behind=$(git rev-list HEAD..${branch_name}@{upstream} 2>/dev/null | wc -l)
|
||||||
|
(( $behind )) && gitstatus+=( " %F{$VCS_FOREGROUND_COLOR}$VCS_INCOMING_CHANGES${behind// /}%f" )
|
||||||
|
|
||||||
|
hook_com[misc]+=${(j::)gitstatus}
|
||||||
|
}
|
||||||
|
|
||||||
|
function +vi-git-remotebranch() {
|
||||||
|
local remote branch_name
|
||||||
|
|
||||||
|
# Are we on a remote-tracking branch?
|
||||||
|
remote=${$(git rev-parse --verify HEAD@{upstream} --symbolic-full-name 2>/dev/null)/refs\/(remotes|heads)\/}
|
||||||
|
branch_name=${$(git symbolic-ref --short HEAD 2>/dev/null)}
|
||||||
|
|
||||||
|
hook_com[branch]="%F{$VCS_FOREGROUND_COLOR}$VCS_BRANCH_ICON${hook_com[branch]}%f"
|
||||||
|
# Always show the remote
|
||||||
|
#if [[ -n ${remote} ]] ; then
|
||||||
|
# Only show the remote if it differs from the local
|
||||||
|
if [[ -n ${remote} && ${remote#*/} != ${branch_name} ]] ; then
|
||||||
|
hook_com[branch]+="%F{$VCS_FOREGROUND_COLOR}$VCS_REMOTE_BRANCH_ICON%f%F{$VCS_FOREGROUND_COLOR}${remote// /}%f"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function +vi-git-tagname() {
|
||||||
|
local tag
|
||||||
|
|
||||||
|
tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
|
||||||
|
[[ -n "${tag}" ]] && hook_com[branch]=" %F{$VCS_FOREGROUND_COLOR}$VCS_TAG_ICON${tag}%f"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Show count of stashed changes
|
||||||
|
# Port from https://github.com/whiteinge/dotfiles/blob/5dfd08d30f7f2749cfc60bc55564c6ea239624d9/.zsh_shouse_prompt#L268
|
||||||
|
function +vi-git-stash() {
|
||||||
|
local -a stashes
|
||||||
|
|
||||||
|
if [[ -s $(git rev-parse --git-dir)/refs/stash ]] ; then
|
||||||
|
stashes=$(git stash list 2>/dev/null | wc -l)
|
||||||
|
hook_com[misc]+=" %F{$VCS_FOREGROUND_COLOR}$VCS_STASH_ICON${stashes// /}%f"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function +vi-hg-bookmarks() {
|
||||||
|
if [[ -n "${hgbmarks[@]}" ]]; then
|
||||||
|
hook_com[hg-bookmark-string]=" %F{$VCS_FOREGROUND_COLOR}$VCS_BOOKMARK_ICON${hgbmarks[@]}%f"
|
||||||
|
|
||||||
|
# And to signal, that we want to use the sting we just generated,
|
||||||
|
# set the special variable `ret' to something other than the default
|
||||||
|
# zero:
|
||||||
|
ret=1
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function +vi-vcs-detect-changes() {
|
||||||
|
if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then
|
||||||
|
VCS_WORKDIR_DIRTY=true
|
||||||
|
else
|
||||||
|
VCS_WORKDIR_DIRTY=false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Prompt Segments
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
# The `CURRENT_BG` variable is used to remember what the last BG color used was
|
||||||
|
# when building the left-hand prompt. Because the RPROMPT is created from
|
||||||
|
# right-left but reads the opposite, this isn't necessary for the other side.
|
||||||
|
CURRENT_BG='NONE'
|
||||||
|
|
||||||
|
# AWS Profile
|
||||||
|
prompt_aws() {
|
||||||
|
local aws_profile="$AWS_DEFAULT_PROFILE"
|
||||||
|
if [[ -n "$aws_profile" ]];
|
||||||
|
then
|
||||||
|
$1_prompt_segment "$0" red white "$AWS_ICON $aws_profile"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Context: user@hostname (who am I and where am I)
|
||||||
|
# Note that if $DEFAULT_USER is not set, this prompt segment will always print
|
||||||
|
prompt_context() {
|
||||||
|
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
|
||||||
|
if [[ $(print -P "%#") == '#' ]]; then
|
||||||
|
# Shell runs as root
|
||||||
|
$1_prompt_segment "$0_ROOT" "$DEFAULT_COLOR" "yellow" "$USER@%m"
|
||||||
|
else
|
||||||
|
$1_prompt_segment "$0_DEFAULT" "$DEFAULT_COLOR" "011" "$USER@%m"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Dir: current working directory
|
||||||
|
prompt_dir() {
|
||||||
|
local current_path='%~'
|
||||||
|
if [[ -n "$POWERLEVEL9K_SHORTEN_DIR_LENGTH" ]]; then
|
||||||
|
# shorten path to $POWERLEVEL9K_SHORTEN_DIR_LENGTH
|
||||||
|
current_path="%$((POWERLEVEL9K_SHORTEN_DIR_LENGTH+1))(c:.../:)%${POWERLEVEL9K_SHORTEN_DIR_LENGTH}c"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$1_prompt_segment "$0" "blue" "$DEFAULT_COLOR" "$current_path"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Command number (in local history)
|
||||||
|
prompt_history() {
|
||||||
|
$1_prompt_segment "$0" "244" "$DEFAULT_COLOR" '%h'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Right Status: (return code, root status, background jobs)
|
||||||
|
# This creates a status segment for the *right* prompt. Exact same thing as
|
||||||
|
# above - just other side.
|
||||||
|
prompt_longstatus() {
|
||||||
|
local symbols bg
|
||||||
|
symbols=()
|
||||||
|
|
||||||
|
if [[ "$RETVAL" -ne 0 ]]; then
|
||||||
|
symbols+="%F{226}%? ↵"
|
||||||
|
bg="009"
|
||||||
|
else
|
||||||
|
symbols+="%{%F{"046"}%}$OK_ICON"
|
||||||
|
bg="008"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ "$UID" -eq 0 ]] && symbols+="%{%F{yellow}%} $ROOT_ICON"
|
||||||
|
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}$BACKGROUND_JOBS_ICON"
|
||||||
|
|
||||||
|
[[ -n "$symbols" ]] && $1_prompt_segment "$0" "$bg" "$DEFAULT_COLOR" "$symbols"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Node version
|
||||||
|
prompt_node_version() {
|
||||||
|
local nvm_prompt=$(node -v 2>/dev/null)
|
||||||
|
[[ -z "${nvm_prompt}" ]] && return
|
||||||
|
NODE_ICON=$'\u2B22' # ⬢
|
||||||
|
|
||||||
|
$1_prompt_segment "$0" "green" "white" "${nvm_prompt:1} $NODE_ICON"
|
||||||
|
}
|
||||||
|
|
||||||
|
# rbenv information
|
||||||
|
prompt_rbenv() {
|
||||||
|
if [[ -n "$RBENV_VERSION" ]]; then
|
||||||
|
$1_prompt_segment "$0" "red" "$DEFAULT_COLOR" "$RBENV_VERSION"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# RSpec test ratio
|
||||||
|
prompt_rspec_stats() {
|
||||||
|
if [[ (-d app && -d spec) ]]; then
|
||||||
|
local code_amount=$(ls -1 app/**/*.rb | wc -l)
|
||||||
|
local tests_amount=$(ls -1 spec/**/*.rb | wc -l)
|
||||||
|
|
||||||
|
build_test_stats "$1" $0 "$code_amount" $tests_amount "RSpec $TEST_ICON"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ruby Version Manager information
|
||||||
|
prompt_rvm() {
|
||||||
|
local rvm_prompt
|
||||||
|
rvm_prompt=`rvm-prompt`
|
||||||
|
if [ "$rvm_prompt" != "" ]; then
|
||||||
|
$1_prompt_segment "$0" "240" "$DEFAULT_COLOR" "$rvm_prompt $RUBY_ICON "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Left Status: (return code, root status, background jobs)
|
||||||
|
# This creates a status segment for the *left* prompt
|
||||||
|
prompt_status() {
|
||||||
|
local symbols
|
||||||
|
symbols=()
|
||||||
|
[[ "$RETVAL" -ne 0 ]] && symbols+="%{%F{red}%}$FAIL_ICON"
|
||||||
|
[[ "$UID" -eq 0 ]] && symbols+="%{%F{yellow}%} $ROOT_ICON"
|
||||||
|
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}$BACKGROUND_JOBS_ICON"
|
||||||
|
|
||||||
|
[[ -n "$symbols" ]] && $1_prompt_segment "$0" "$DEFAULT_COLOR" "default" "$symbols"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Symfony2-PHPUnit test ratio
|
||||||
|
prompt_symfony2_tests() {
|
||||||
|
if [[ (-d src && -d app && -f app/AppKernel.php) ]]; then
|
||||||
|
local code_amount=$(ls -1 src/**/*.php | grep -v Tests | wc -l)
|
||||||
|
local tests_amount=$(ls -1 src/**/*.php | grep Tests | wc -l)
|
||||||
|
|
||||||
|
build_test_stats "$1" "$0" "$code_amount" "$tests_amount" "SF2 $TEST_ICON"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Symfony2-Version
|
||||||
|
prompt_symfony2_version() {
|
||||||
|
if [[ -f app/bootstrap.php.cache ]]; then
|
||||||
|
local symfony2_version=$(grep " VERSION " app/bootstrap.php.cache | sed -e 's/[^.0-9]*//g')
|
||||||
|
$1_prompt_segment "$0" "240" "$DEFAULT_COLOR" "$SYMFONY_ICON $symfony2_version"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Show a ratio of tests vs code
|
||||||
|
build_test_stats() {
|
||||||
|
local code_amount="$3"
|
||||||
|
local tests_amount="$4"+0.00001
|
||||||
|
local headline="$5"
|
||||||
|
|
||||||
|
# Set float precision to 2 digits:
|
||||||
|
typeset -F 2 ratio
|
||||||
|
local ratio=$(( (tests_amount/code_amount) * 100 ))
|
||||||
|
|
||||||
|
[[ ratio -ge 0.75 ]] && $1_prompt_segment "${2}_GOOD" "cyan" "$DEFAULT_COLOR" "$headline: $ratio%%"
|
||||||
|
[[ ratio -ge 0.5 && ratio -lt 0.75 ]] && $1_prompt_segment "$2_AVG" "yellow" "$DEFAULT_COLOR" "$headline: $ratio%%"
|
||||||
|
[[ ratio -lt 0.5 ]] && $1_prompt_segment "$2_BAD" "red" "$DEFAULT_COLOR" "$headline: $ratio%%"
|
||||||
|
}
|
||||||
|
|
||||||
|
# System time
|
||||||
|
prompt_time() {
|
||||||
|
local time_format="%D{%H:%M:%S}"
|
||||||
|
if [[ -n "$POWERLEVEL9K_TIME_FORMAT" ]]; then
|
||||||
|
time_format="$POWERLEVEL9K_TIME_FORMAT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
$1_prompt_segment "$0" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$time_format"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Virtualenv: current working virtualenv
|
||||||
|
# More information on virtualenv (Python):
|
||||||
|
# https://virtualenv.pypa.io/en/latest/
|
||||||
|
prompt_virtualenv() {
|
||||||
|
local virtualenv_path="$VIRTUAL_ENV"
|
||||||
|
if [[ -n "$virtualenv_path" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then
|
||||||
|
$1_prompt_segment "$0" "blue" "$DEFAULT_COLOR" "(`basename $virtualenv_path`)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Prompt processing and drawing
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
# Main prompt
|
||||||
|
build_left_prompt() {
|
||||||
|
RETVAL=$?
|
||||||
|
|
||||||
|
if [[ "${#POWERLEVEL9K_LEFT_PROMPT_ELEMENTS}" == 0 ]]; then
|
||||||
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
|
||||||
|
fi
|
||||||
|
|
||||||
|
for element in $POWERLEVEL9K_LEFT_PROMPT_ELEMENTS; do
|
||||||
|
prompt_$element "left"
|
||||||
|
done
|
||||||
|
|
||||||
|
left_prompt_end
|
||||||
|
}
|
||||||
|
|
||||||
|
# Right prompt
|
||||||
|
build_right_prompt() {
|
||||||
|
RETVAL=$?
|
||||||
|
|
||||||
|
if [[ "${#POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS}" == 0 ]]; then
|
||||||
|
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(longstatus history time)
|
||||||
|
fi
|
||||||
|
|
||||||
|
for element in $POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS; do
|
||||||
|
prompt_$element "right"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
powerlevel9k_init() {
|
||||||
|
setopt LOCAL_OPTIONS
|
||||||
|
unsetopt XTRACE KSH_ARRAYS
|
||||||
|
prompt_opts=(cr percent subst)
|
||||||
|
|
||||||
|
# initialize colors
|
||||||
|
autoload -U colors && colors
|
||||||
|
|
||||||
|
# initialize VCS
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
|
add-zsh-hook precmd vcs_info
|
||||||
|
|
||||||
|
if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then
|
||||||
|
[[ -n $POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX ]] || POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="╭─"
|
||||||
|
[[ -n $POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX ]] || POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX="╰─ "
|
||||||
|
|
||||||
|
PROMPT="$POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX%{%f%b%k%}"'$(build_left_prompt)'"
|
||||||
|
$POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX"
|
||||||
|
# The right prompt should be on the same line as the first line of the left
|
||||||
|
# prompt. To do so, there is just a quite ugly workaround: Before zsh draws
|
||||||
|
# the RPROMPT, we advise it, to go one line up. At the end of RPROMPT, we
|
||||||
|
# advise it to go one line down. See:
|
||||||
|
# http://superuser.com/questions/357107/zsh-right-justify-in-ps1
|
||||||
|
RPROMPT_PREFIX='%{'$'\e[1A''%}' # one line up
|
||||||
|
RPROMPT_SUFFIX='%{'$'\e[1B''%}' # one line down
|
||||||
|
else
|
||||||
|
PROMPT="%{%f%b%k%}"'$(build_left_prompt)'
|
||||||
|
RPROMPT_PREFIX=''
|
||||||
|
RPROMPT_SUFFIX=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$POWERLEVEL9K_DISABLE_RPROMPT" != true ]]; then
|
||||||
|
RPROMPT=$RPROMPT_PREFIX"%{%f%b%k%}"'$(build_right_prompt)'"%{$reset_color%}"$RPROMPT_SUFFIX
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
powerlevel9k_init "$@"
|
||||||
|
|
@ -26,9 +26,12 @@ fi
|
||||||
# oh-my-zsh directory.
|
# oh-my-zsh directory.
|
||||||
[[ -w "$ZSH" ]] || return 0
|
[[ -w "$ZSH" ]] || return 0
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
# Cancel upgrade if git is unavailable on the system
|
# Cancel upgrade if git is unavailable on the system
|
||||||
whence git >/dev/null || return 0
|
whence git >/dev/null || return 0
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
if [ -f ~/.zsh-update ]
|
if [ -f ~/.zsh-update ]
|
||||||
then
|
then
|
||||||
. ~/.zsh-update
|
. ~/.zsh-update
|
||||||
|
|
@ -57,3 +60,7 @@ else
|
||||||
# create the zsh file
|
# create the zsh file
|
||||||
_update_zsh_update
|
_update_zsh_update
|
||||||
fi
|
fi
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
|
|
|
||||||
119
tools/install.sh
119
tools/install.sh
|
|
@ -1,3 +1,4 @@
|
||||||
|
<<<<<<< HEAD
|
||||||
main() {
|
main() {
|
||||||
# Use colors, but only if connected to a terminal, and that terminal
|
# Use colors, but only if connected to a terminal, and that terminal
|
||||||
# supports them.
|
# supports them.
|
||||||
|
|
@ -120,3 +121,121 @@ main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
=======
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Use colors, but only if connected to a terminal, and that terminal
|
||||||
|
# supports them.
|
||||||
|
tput=$(which tput)
|
||||||
|
if [ -n "$tput" ]; then
|
||||||
|
ncolors=$($tput colors)
|
||||||
|
fi
|
||||||
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||||
|
RED="$(tput setaf 1)"
|
||||||
|
GREEN="$(tput setaf 2)"
|
||||||
|
YELLOW="$(tput setaf 3)"
|
||||||
|
BLUE="$(tput setaf 4)"
|
||||||
|
BOLD="$(tput bold)"
|
||||||
|
NORMAL="$(tput sgr0)"
|
||||||
|
else
|
||||||
|
RED=""
|
||||||
|
GREEN=""
|
||||||
|
YELLOW=""
|
||||||
|
BLUE=""
|
||||||
|
BOLD=""
|
||||||
|
NORMAL=""
|
||||||
|
fi
|
||||||
|
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
|
||||||
|
if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
|
||||||
|
printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
unset CHECK_ZSH_INSTALLED
|
||||||
|
|
||||||
|
if [ ! -n "$ZSH" ]; then
|
||||||
|
ZSH=~/.oh-my-zsh
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d "$ZSH" ]; then
|
||||||
|
printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n"
|
||||||
|
printf "You'll need to remove $ZSH if you want to re-install.\n"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prevent the cloned repository from having insecure permissions. Failing to do
|
||||||
|
# so causes compinit() calls to fail with "command not found: compdef" errors
|
||||||
|
# for users with insecure umasks (e.g., "002", allowing group writability). Note
|
||||||
|
# that this will be ignored under Cygwin by default, as Windows ACLs take
|
||||||
|
# precedence over umasks except for filesystems mounted with option "noacl".
|
||||||
|
umask g-w,o-w
|
||||||
|
|
||||||
|
printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
|
||||||
|
hash git >/dev/null 2>&1 || {
|
||||||
|
echo "Error: git is not installed"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
|
||||||
|
printf "Error: git clone of oh-my-zsh repo failed\n"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# The Windows (MSYS) Git is not compatible with normal use on cygwin
|
||||||
|
if [ "$OSTYPE" = cygwin ]; then
|
||||||
|
if git --version | grep msysgit > /dev/null; then
|
||||||
|
echo "Error: Windows/MSYS Git is not supported on Cygwin"
|
||||||
|
echo "Error: Make sure the Cygwin git package is installed and is first on the path"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
|
||||||
|
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
|
||||||
|
printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n";
|
||||||
|
mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh;
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n"
|
||||||
|
cp $ZSH/templates/zshrc.zsh-template ~/.zshrc
|
||||||
|
sed "/^export ZSH=/ c\\
|
||||||
|
export ZSH=$ZSH
|
||||||
|
" ~/.zshrc > ~/.zshrc-omztemp
|
||||||
|
mv -f ~/.zshrc-omztemp ~/.zshrc
|
||||||
|
|
||||||
|
printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n"
|
||||||
|
sed "/export PATH=/ c\\
|
||||||
|
export PATH=\"$PATH\"
|
||||||
|
" ~/.zshrc > ~/.zshrc-omztemp
|
||||||
|
mv -f ~/.zshrc-omztemp ~/.zshrc
|
||||||
|
|
||||||
|
# If this user's login shell is not already "zsh", attempt to switch.
|
||||||
|
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
|
||||||
|
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
|
||||||
|
# If this platform provides a "chsh" command (not Cygwin), do it, man!
|
||||||
|
if hash chsh >/dev/null 2>&1; then
|
||||||
|
printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
|
||||||
|
chsh -s $(grep /zsh$ /etc/shells | tail -1)
|
||||||
|
# Else, suggest the user do so manually.
|
||||||
|
else
|
||||||
|
printf "I can't change your shell automatically because this system does not have chsh.\n"
|
||||||
|
printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "${GREEN}"
|
||||||
|
echo ' __ __ '
|
||||||
|
echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ '
|
||||||
|
echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '
|
||||||
|
echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '
|
||||||
|
echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '
|
||||||
|
echo ' /____/ ....is now installed!'
|
||||||
|
echo ''
|
||||||
|
echo ''
|
||||||
|
echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.'
|
||||||
|
echo ''
|
||||||
|
echo 'p.s. Follow us at https://twitter.com/ohmyzsh.'
|
||||||
|
echo ''
|
||||||
|
echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.'
|
||||||
|
echo ''
|
||||||
|
printf "${NORMAL}"
|
||||||
|
env zsh
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
|
read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
|
||||||
|
<<<<<<< HEAD
|
||||||
if [ "$confirmation" != y ] && [ "$confirmation" != Y ]
|
if [ "$confirmation" != y ] && [ "$confirmation" != Y ]
|
||||||
then
|
then
|
||||||
echo "Uninstall cancelled"
|
echo "Uninstall cancelled"
|
||||||
exit
|
exit
|
||||||
|
=======
|
||||||
|
if ! [[ $confirmation =~ ^[yY]$ ]]
|
||||||
|
then
|
||||||
|
echo "Uninstall cancelled"
|
||||||
|
exit
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Removing ~/.oh-my-zsh"
|
echo "Removing ~/.oh-my-zsh"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
|
|
||||||
# Use colors, but only if connected to a terminal, and that terminal
|
# Use colors, but only if connected to a terminal, and that terminal
|
||||||
# supports them.
|
# supports them.
|
||||||
|
<<<<<<< HEAD
|
||||||
if which tput >/dev/null 2>&1; then
|
if which tput >/dev/null 2>&1; then
|
||||||
|
=======
|
||||||
|
tput=$(which tput)
|
||||||
|
if [ -n "$tput" ]; then
|
||||||
|
>>>>>>> c0134a9450e486251b247735e022d7efeb496b9c
|
||||||
ncolors=$(tput colors)
|
ncolors=$(tput colors)
|
||||||
fi
|
fi
|
||||||
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue