Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/sorin-ionescu/prezto
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkiss committed Oct 30, 2017
2 parents 7c4a32d + 4b0ecff commit c07d47d
Show file tree
Hide file tree
Showing 132 changed files with 2,471 additions and 595 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[{.gitattributes,.gitignore,.gitmodules}]
indent_style = tab
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- Please check if a similar issue already exists or has been closed before before opening your issue. -->

### Description
<!-- Provide a general description of the bug or feature -->

### Expected behavior

<!-- What you expected to happen -->

### Actual behavior

<!-- What actually happened -->

### Steps to Reproduce

1. [First Step]
2. [Second Step]
3. [and so on...]

### Versions

- Prezto commit:
- ZSH version:
- OS information:
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Please be sure to check out our [contributing guidelines](https://github.com/sorin-ionescu/prezto/blob/master/CONTRIBUTING.md)
before submitting your pull request.

Fixes #

## Proposed Changes

-
-
-
15 changes: 12 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "modules/autosuggestions/external"]
path = modules/autosuggestions/external
url = https://github.com/zsh-users/zsh-autosuggestions.git
[submodule "modules/history-substring-search/external"]
path = modules/history-substring-search/external
url = https://github.com/zsh-users/zsh-history-substring-search.git
Expand All @@ -16,6 +19,12 @@
[submodule "modules/prompt/functions/pure"]
path = modules/prompt/external/pure
url = https://github.com/sindresorhus/pure.git
[submodule "modules/autosuggestions/external"]
path = modules/autosuggestions/external
url = https://github.com/tarruda/zsh-autosuggestions
[submodule "modules/fasd/external"]
path = modules/fasd/external
url = https://github.com/clvv/fasd.git
[submodule "modules/prompt/external/async"]
path = modules/prompt/external/async
url = https://github.com/mafredri/zsh-async.git
[submodule "modules/prompt/external/powerlevel9k"]
path = modules/prompt/external/powerlevel9k
url = https://github.com/bhilburn/powerlevel9k.git
38 changes: 36 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,39 @@ improve its performance, do not hesitate to fork and send pull requests.
- Open a [pull request][4] that relates to but one subject with a clear
title and description in grammatically correct, complete sentences.

#### Code Style

This project follows the [Google Shell Style Guide][5] when possible. However,
there are a number of additional things to keep in mind.

- Local variables should be used whenever possible.
- Prefer `zstyle` over environment variables for configuration.
- Prefer (( ... )) over [[ ... ]] for arithmetic expression.
- Use the function keyword to define functions.
- The 80 character hard limit can be waved for readability.

#### Using an Alternative zprezto Directory

To work on zprezto without messing with your current configuration:

```sh
mkdir devel-zprezto
cd devel-zprezto
git clone --recursive https://github.com/sorin-ionescu/prezto.git .zprezto
ZDOTDIR=$(pwd)
echo "Your development ZDOTDIR is $ZDOTDIR"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
```

Then to start zsh in this development environment you will run:

```sh
ZDOTDIR=/path/to/devel-zprezto zsh
```

#### Modules

- A *README.md* must be present.
Expand All @@ -32,10 +65,11 @@ improve its performance, do not hesitate to fork and send pull requests.
#### Themes

- A screenshots section must be present in the file header.
- The pull request description must have [embedded screenshots][5].
- The pull request description must have [embedded screenshots][6].

[1]: https://github.com/sorin-ionescu/prezto/contributors
[2]: http://gun.io/blog/how-to-github-fork-branch-and-pull-request
[3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[4]: https://help.github.com/articles/using-pull-requests
[5]: http://daringfireball.net/projects/markdown/syntax#img
[5]: https://google.github.io/styleguide/shell.xml
[6]: http://daringfireball.net/projects/markdown/syntax#img
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2009-2011 Robby Russell and contributors
Copyright (c) 2011-2017 Sorin Ionescu and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
67 changes: 34 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,41 @@ Installation
------------

Prezto will work with any recent release of Zsh, but the minimum required
version is 4.3.17.
version is 4.3.11.

1. Launch Zsh:

zsh
```console
zsh
```

2. Clone the repository:

git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
```console
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
```

3. Create a new Zsh configuration by copying the Zsh configuration files
provided:

setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
```sh
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
```

Note: If you already have any of the given config files, ln will error. In
simple cases you can add `source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"` to
the bottom of your `.zshrc` to load prezto but keep your config intact. For
more complicated setups, it is recommended that you back up your original
configs and replace them with the provided prezto runcoms.

4. Set Zsh as your default shell:

chsh -s /bin/zsh
```console
chsh -s /bin/zsh
```

5. Open a new Zsh terminal window or tab.

Expand All @@ -42,9 +56,18 @@ window or tab.
Updating
--------

Pull the latest changes and update submodules.
Run `zprezto-update` to automatically check if there is an update to zprezto.
If there are no file conflicts, zprezto and its submodules will be
automatically updated. If there are conflicts you will instructed to go into
the `$ZPREZTODIR` directory and resolve them yourself.

To pull the latest changes and update submodules manually:

git pull && git submodule update --init --recursive
```console
cd $ZPREZTODIR
git pull
git submodule update --init --recursive
```

Usage
-----
Expand Down Expand Up @@ -83,29 +106,7 @@ The [Zsh Reference Card][7] and the [zsh-lovers][8] man page are indispensable.
License
-------

(The MIT License)

Copyright (c) 2009-2011 Robby Russell and contributors.

Copyright (c) 2011-2015 Sorin Ionescu and contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This project is licensed under the MIT License.

[1]: http://www.zsh.org
[2]: http://i.imgur.com/nrGV6pg.png "sorin theme"
Expand Down
74 changes: 64 additions & 10 deletions init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,61 @@
#

# Check for the minimum supported version.
min_zsh_version='4.3.17'
min_zsh_version='4.3.11'
if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then
print "prezto: old shell detected, minimum required: $min_zsh_version" >&2
printf "prezto: old shell detected, minimum required: %s\n" "$min_zsh_version" >&2
return 1
fi
unset min_zsh_version

# zprezto convenience updater
# The function is surrounded by ( ) instead of { } so it starts in a subshell
# and won't affect the environment of the calling shell
function zprezto-update {
(
function cannot-fast-forward {
local STATUS="$1"
[[ -n "${STATUS}" ]] && printf "%s\n" "${STATUS}"
printf "Unable to fast-forward the changes. You can fix this by "
printf "running\ncd '%s' and then\n'git pull' " "${ZPREZTODIR}"
printf "to manually pull and possibly merge in changes\n"
}
cd -q -- "${ZPREZTODIR}" || return 7
local orig_branch="$(git symbolic-ref HEAD 2> /dev/null | cut -d '/' -f 3)"
if [[ "$orig_branch" == "master" ]]; then
git fetch || return "$?"
local UPSTREAM=$(git rev-parse '@{u}')
local LOCAL=$(git rev-parse HEAD)
local REMOTE=$(git rev-parse "$UPSTREAM")
local BASE=$(git merge-base HEAD "$UPSTREAM")
if [[ $LOCAL == $REMOTE ]]; then
printf "There are no updates.\n"
return 0
elif [[ $LOCAL == $BASE ]]; then
printf "There is an update available. Trying to pull.\n\n"
if git pull --ff-only; then
printf "Syncing submodules\n"
git submodule update --recursive
return $?
else
cannot-fast-forward
return 1
fi
elif [[ $REMOTE == $BASE ]]; then
cannot-fast-forward "Commits in master that aren't in upstream."
return 1
else
cannot-fast-forward "Upstream and local have diverged."
return 1
fi
else
printf "zprezto install at '%s' is not on the master branch " "${ZPREZTODIR}"
printf "(you're on '%s')\nUnable to automatically update.\n" "${orig_branch}"
return 1
fi
return 1
)
}
#
# Module Loader
#
Expand All @@ -25,13 +73,13 @@ unset min_zsh_version
function pmodload {
local -a pmodules
local pmodule
local pfunction_glob='^([_.]*|prompt_*_setup|README*)(-.N:t)'
local pfunction_glob='^([_.]*|prompt_*_setup|README*|*~)(-.N:t)'

# $argv is overridden in the anonymous function.
pmodules=("$argv[@]")

# Add functions to $fpath.
fpath=(${pmodules:+${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions(/FN)} $fpath)
fpath=(${pmodules:+$ZPREZTODIR/modules/${^pmodules}/functions(/FN)} $fpath)

function {
local pfunction
Expand All @@ -40,7 +88,7 @@ function pmodload {
setopt LOCAL_OPTIONS EXTENDED_GLOB

# Load Prezto functions.
for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions/$~pfunction_glob; do
for pfunction in $ZPREZTODIR/modules/${^pmodules}/functions/$~pfunction_glob; do
autoload -Uz "$pfunction"
done
}
Expand All @@ -49,19 +97,19 @@ function pmodload {
for pmodule in "$pmodules[@]"; do
if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
continue
elif [[ ! -d "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule" ]]; then
elif [[ ! -d "$ZPREZTODIR/modules/$pmodule" ]]; then
print "$0: no such module: $pmodule" >&2
continue
else
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh"
if [[ -s "$ZPREZTODIR/modules/$pmodule/init.zsh" ]]; then
source "$ZPREZTODIR/modules/$pmodule/init.zsh"
fi

if (( $? == 0 )); then
zstyle ":prezto:module:$pmodule" loaded 'yes'
else
# Remove the $fpath entry.
fpath[(r)${ZDOTDIR:-$HOME}/.zprezto/modules/${pmodule}/functions]=()
fpath[(r)${ZPREZTODIR}/modules/${pmodule}/functions]=()

function {
local pfunction
Expand All @@ -71,7 +119,7 @@ function pmodload {
setopt LOCAL_OPTIONS EXTENDED_GLOB

# Unload Prezto functions.
for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/functions/$~pfunction_glob; do
for pfunction in $ZPREZTODIR/modules/$pmodule/functions/$~pfunction_glob; do
unfunction "$pfunction"
done
}
Expand All @@ -86,6 +134,12 @@ function pmodload {
# Prezto Initialization
#

# This finds the directory prezto is installed to so plugin managers don't need
# to rely on dirty hacks to force prezto into a directory. Additionally, it
# needs to be done here because inside the pmodload function ${0:h} evaluates to
# the current directory of the shell rather than the prezto dir.
ZPREZTODIR=${0:h}

# Source the Prezto configuration file.
if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then
source "${ZDOTDIR:-$HOME}/.zpreztorc"
Expand Down
4 changes: 3 additions & 1 deletion modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Modules

Load modules in *zpreztorc*. The order matters.

zstyle ':prezto:load' pmodule 'environment' 'terminal'
```sh
zstyle ':prezto:load' pmodule 'environment' 'terminal'
```

Archive
-------
Expand Down
Loading

0 comments on commit c07d47d

Please sign in to comment.