mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-04 21:39:24 +00:00
Compare commits
219 Commits
belak/zdeb
...
c005e87859
Author | SHA1 | Date | |
---|---|---|---|
c005e87859 | |||
667fba697e | |||
704fc46c3f | |||
c43d483d47 | |||
f080e2075e | |||
b7a80d99a8 | |||
c7ef9c1f46 | |||
775f6123b2 | |||
e915c34507 | |||
39151645ac | |||
0a405494ca | |||
813bde4d44 | |||
38882275b8 | |||
e9197234cf | |||
685da200d7 | |||
cb8b9ca746 | |||
4e7ab4b8b7 | |||
677e301174 | |||
c21295b27f | |||
83f3dca4a3 | |||
a132c1007a | |||
2d3763380c | |||
20a78c04e5 | |||
ff91c8d410 | |||
b8f5b31573 | |||
cb69d2d3e4 | |||
793f239a5e | |||
649c0e4561 | |||
13c61bae30 | |||
6d546561c6 | |||
530ea10126 | |||
342385618c | |||
2da4774473 | |||
f427a567d7 | |||
de7b3b7fdc | |||
95ff0360ae | |||
5b03d7fa32 | |||
d5bef142d4 | |||
9b2744cfdf | |||
7fbedf4a3b | |||
f479f37ead | |||
f4ca9ebfc9 | |||
1b99be879c | |||
cfeb8cd6c9 | |||
0c22054a49 | |||
d955fbdeb7 | |||
94f9e44f3f | |||
92e6b37f73 | |||
d2832051f7 | |||
65e8ba0596 | |||
272528b439 | |||
a73bb314cc | |||
cb0099ec7a | |||
fc8f82329b | |||
3d827cdb88 | |||
47b37b22ea | |||
e9f281cd6f | |||
4b32ae96db | |||
bca85497f8 | |||
4bcbe2ee68 | |||
ac9843e2d4 | |||
66b9ea7d44 | |||
7cad349a5a | |||
4a32e9d68b | |||
7ec4aad48c | |||
1f52b03a45 | |||
9ae279e25a | |||
2acaec814f | |||
a3a51bdf6c | |||
c6efe80152 | |||
7c94154dda | |||
e86200e7aa | |||
721b1535ea | |||
a5ebde1b17 | |||
a251bd2fb9 | |||
ef3e9eda18 | |||
2d6205e714 | |||
b9c34d9445 | |||
0af28e758b | |||
048d5302d6 | |||
e9e8c31217 | |||
f549bd7a0b | |||
ed511e6747 | |||
13f3cabd81 | |||
b2aead431c | |||
21ce6a6f97 | |||
585b3646f9 | |||
aeb58b972d | |||
b44893d9eb | |||
ed6303c340 | |||
6d65cb4176 | |||
1bc0da5f48 | |||
55eb406515 | |||
2873885d37 | |||
91292526a0 | |||
a1df63bade | |||
9507a0e881 | |||
75b112bcd0 | |||
f596d5d1d6 | |||
61de4d199d | |||
6ae2f39cc1 | |||
75940e8ee9 | |||
43214f1aed | |||
8b1a7afd81 | |||
8914274ca9 | |||
34948690d5 | |||
a8087e01fb | |||
abb0c7ecb4 | |||
b01f02aa5c | |||
5566a9c792 | |||
3ae422a0da | |||
6dd97d15e0 | |||
21b83b65ef | |||
e94b6b2078 | |||
de23724dc3 | |||
e6e5e4d68f | |||
09e83ed282 | |||
9f86f48ae6 | |||
15bfe616bc | |||
1d58546406 | |||
ac65e8eb18 | |||
bb901dfb7e | |||
f235db7aaa | |||
82222831a7 | |||
1f4601e44c | |||
b8d7e2cad8 | |||
5d7c990eec | |||
d22effbf85 | |||
4ff726e600 | |||
c2c53592a1 | |||
4abbc55721 | |||
777674e07e | |||
ba4063f99e | |||
88456ec9b6 | |||
4a16d3fa50 | |||
a70d24ab10 | |||
a338cba805 | |||
0e6429da97 | |||
9d3e2f0204 | |||
dc8e168d5f | |||
3093f1b966 | |||
11184084bc | |||
54dff31b63 | |||
23c56a5640 | |||
1a48ae2e54 | |||
eee3c9c166 | |||
39e1a63349 | |||
d275f316ff | |||
6a2cc2e146 | |||
d45d87b08f | |||
a987c8bc8a | |||
f745645342 | |||
a2398fc045 | |||
e7fea3343f | |||
53286ebbdb | |||
2286662b80 | |||
3de1e24965 | |||
be68a38ff5 | |||
32084778d0 | |||
8bfed01773 | |||
b2a9152820 | |||
680fba3112 | |||
236907f8af | |||
108392b503 | |||
a09155f990 | |||
35a83744e7 | |||
b083b134e7 | |||
e6eea17b12 | |||
93313aac23 | |||
f37cf0ffc9 | |||
1ed5331e84 | |||
bfe1815cbf | |||
a43093119e | |||
a3753d8f3b | |||
58809b2d21 | |||
992b9de505 | |||
6f603df7a6 | |||
ff5bd9306e | |||
df4c61861d | |||
53facbe9de | |||
6c46804f41 | |||
e9387a177e | |||
ee885d42de | |||
fbcae356d3 | |||
f366e49c32 | |||
ad861d3b45 | |||
2bbf5d0687 | |||
dd7a26e219 | |||
7bb7a7cb6f | |||
66487c9532 | |||
f2042a29cc | |||
dacef14214 | |||
e064d5c65f | |||
152b4a1b5d | |||
e149367445 | |||
cd70822994 | |||
0d6e7de031 | |||
b11b9ce788 | |||
d4332e2faf | |||
92e668e1d9 | |||
3d911cd511 | |||
ae23bedd24 | |||
2995b7d0c8 | |||
6e179f24ab | |||
f8f93d4b91 | |||
b6b43eb331 | |||
300102897a | |||
054eb351f1 | |||
1b441e7654 | |||
443021237a | |||
a0977cb92e | |||
b3c27bb164 | |||
e00562e7cf | |||
742260b55f | |||
580ddc44f3 | |||
4325f74f9d | |||
6d00fdf8c8 | |||
e26387656d | |||
d7622624aa |
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -28,3 +28,8 @@
|
|||||||
[submodule "modules/prompt/external/powerlevel9k"]
|
[submodule "modules/prompt/external/powerlevel9k"]
|
||||||
path = modules/prompt/external/powerlevel9k
|
path = modules/prompt/external/powerlevel9k
|
||||||
url = https://github.com/bhilburn/powerlevel9k.git
|
url = https://github.com/bhilburn/powerlevel9k.git
|
||||||
|
shallow = true
|
||||||
|
[submodule "modules/prompt/external/powerlevel10k"]
|
||||||
|
path = modules/prompt/external/powerlevel10k
|
||||||
|
url = https://github.com/romkatv/powerlevel10k.git
|
||||||
|
shallow = true
|
||||||
|
@ -32,7 +32,7 @@ there are a number of additional things to keep in mind.
|
|||||||
- Prefer `zstyle` over environment variables for configuration.
|
- Prefer `zstyle` over environment variables for configuration.
|
||||||
- Prefer (( ... )) over [[ ... ]] for arithmetic expression.
|
- Prefer (( ... )) over [[ ... ]] for arithmetic expression.
|
||||||
- Use the function keyword to define functions.
|
- Use the function keyword to define functions.
|
||||||
- The 80 character hard limit can be waved for readability.
|
- The 80 character hard limit can be waived for readability.
|
||||||
|
|
||||||
#### Using an Alternative zprezto Directory
|
#### Using an Alternative zprezto Directory
|
||||||
|
|
||||||
|
15
INSTALL.md
Normal file
15
INSTALL.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
# Install and update
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/dcarrillo/prezto.git ~/.zprezto
|
||||||
|
cd ~/.zprezto
|
||||||
|
git remote add upstream https://github.com/sorin-ionescu/prezto.git
|
||||||
|
git submodule update --init --recursive
|
||||||
|
```
|
||||||
|
|
||||||
|
## Keep updated
|
||||||
|
|
||||||
|
Run the [update](scripts/update_zprezto) script.
|
19
README.md
19
README.md
@ -33,10 +33,11 @@ version is 4.3.11.
|
|||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: If you already have any of the given config files, ln will error. In
|
Note: If you already have any of the given configuration files, `ln` will
|
||||||
simple cases you can add `source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"` to
|
cause error. In simple cases you can load prezto by adding the line
|
||||||
the bottom of your `.zshrc` to load prezto but keep your config intact. For
|
`source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"` to the bottom of your
|
||||||
more complicated setups, it is recommended that you back up your original
|
`.zshrc` and keep the rest of your Zsh configuration intact. For more
|
||||||
|
complicated setups, it is recommended that you back up your original
|
||||||
configs and replace them with the provided prezto runcoms.
|
configs and replace them with the provided prezto runcoms.
|
||||||
|
|
||||||
4. Set Zsh as your default shell:
|
4. Set Zsh as your default shell:
|
||||||
@ -58,7 +59,7 @@ Updating
|
|||||||
|
|
||||||
Run `zprezto-update` to automatically check if there is an update to zprezto.
|
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
|
If there are no file conflicts, zprezto and its submodules will be
|
||||||
automatically updated. If there are conflicts you will instructed to go into
|
automatically updated. If there are conflicts you will be instructed to go into
|
||||||
the `$ZPREZTODIR` directory and resolve them yourself.
|
the `$ZPREZTODIR` directory and resolve them yourself.
|
||||||
|
|
||||||
To pull the latest changes and update submodules manually:
|
To pull the latest changes and update submodules manually:
|
||||||
@ -89,6 +90,10 @@ accompanying README files to learn of what is available.
|
|||||||
window or tab.
|
window or tab.
|
||||||
|
|
||||||
![sorin theme][2]
|
![sorin theme][2]
|
||||||
|
Note that the 'git' module may be required for special symbols to appear,
|
||||||
|
such as those on the right of the above image. Add `'git'` to the `pmodule`
|
||||||
|
list (under `zstyle ':prezto:load' pmodule \` in your *~/.zpreztorc*) to
|
||||||
|
enable this module.
|
||||||
|
|
||||||
### External Modules
|
### External Modules
|
||||||
|
|
||||||
@ -99,7 +104,7 @@ accompanying README files to learn of what is available.
|
|||||||
Note that module names need to be unique or they will cause an error when
|
Note that module names need to be unique or they will cause an error when
|
||||||
loading.
|
loading.
|
||||||
|
|
||||||
```console
|
```sh
|
||||||
zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib
|
zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -126,6 +131,6 @@ This project is licensed under the MIT License.
|
|||||||
[3]: http://git-scm.com
|
[3]: http://git-scm.com
|
||||||
[4]: https://github.com
|
[4]: https://github.com
|
||||||
[5]: http://gitimmersion.com
|
[5]: http://gitimmersion.com
|
||||||
[6]: http://gitref.org
|
[6]: https://git.github.io/git-reference/
|
||||||
[7]: http://www.bash2zsh.com/zsh_refcard/refcard.pdf
|
[7]: http://www.bash2zsh.com/zsh_refcard/refcard.pdf
|
||||||
[8]: http://grml.org/zsh/zsh-lovers.html
|
[8]: http://grml.org/zsh/zsh-lovers.html
|
||||||
|
26
init.zsh
26
init.zsh
@ -17,20 +17,6 @@ if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then
|
|||||||
fi
|
fi
|
||||||
unset min_zsh_version
|
unset min_zsh_version
|
||||||
|
|
||||||
# Change the resolution of the SECONDS variable to be more useful for debugging.
|
|
||||||
typeset -F SECONDS
|
|
||||||
|
|
||||||
# logging convenience, mostly meant for debugging performance issues.
|
|
||||||
function pdebuglog {
|
|
||||||
if ! zstyle -t ":prezto" debug; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
local format="$1"
|
|
||||||
shift
|
|
||||||
printf "[%f] $format\n" $SECONDS "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
# zprezto convenience updater
|
# zprezto convenience updater
|
||||||
# The function is surrounded by ( ) instead of { } so it starts in a subshell
|
# The function is surrounded by ( ) instead of { } so it starts in a subshell
|
||||||
# and won't affect the environment of the calling shell
|
# and won't affect the environment of the calling shell
|
||||||
@ -58,7 +44,7 @@ function zprezto-update {
|
|||||||
printf "There is an update available. Trying to pull.\n\n"
|
printf "There is an update available. Trying to pull.\n\n"
|
||||||
if git pull --ff-only; then
|
if git pull --ff-only; then
|
||||||
printf "Syncing submodules\n"
|
printf "Syncing submodules\n"
|
||||||
git submodule update --recursive
|
git submodule update --init --recursive
|
||||||
return $?
|
return $?
|
||||||
else
|
else
|
||||||
cannot-fast-forward
|
cannot-fast-forward
|
||||||
@ -107,25 +93,25 @@ function pmodload {
|
|||||||
|
|
||||||
# Load Prezto modules.
|
# Load Prezto modules.
|
||||||
for pmodule in "$pmodules[@]"; do
|
for pmodule in "$pmodules[@]"; do
|
||||||
pdebuglog "Started loading %q" $pmodule
|
|
||||||
if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
|
if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
|
||||||
pdebuglog "Module %q already loaded" $pmodule
|
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
locations=(${pmodule_dirs:+${^pmodule_dirs}/$pmodule(-/FN)})
|
locations=(${pmodule_dirs:+${^pmodule_dirs}/$pmodule(-/FN)})
|
||||||
if (( ${#locations} > 1 )); then
|
if (( ${#locations} > 1 )); then
|
||||||
|
if ! zstyle -t ':prezto:load' pmodule-allow-overrides 'yes'; then
|
||||||
print "$0: conflicting module locations: $locations"
|
print "$0: conflicting module locations: $locations"
|
||||||
continue
|
continue
|
||||||
|
fi
|
||||||
elif (( ${#locations} < 1 )); then
|
elif (( ${#locations} < 1 )); then
|
||||||
print "$0: no such module: $pmodule"
|
print "$0: no such module: $pmodule"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Grab the full path to this module
|
# Grab the full path to this module
|
||||||
pmodule_location=${locations[1]}
|
pmodule_location=${locations[-1]}
|
||||||
|
|
||||||
# Add functions to $fpath.
|
# Add functions to $fpath.
|
||||||
fpath=(${pmodule_location}/functions(/FN) $fpath)
|
fpath=(${pmodule_location}/functions(-/FN) $fpath)
|
||||||
|
|
||||||
function {
|
function {
|
||||||
local pfunction
|
local pfunction
|
||||||
@ -147,7 +133,6 @@ function pmodload {
|
|||||||
|
|
||||||
if (( $? == 0 )); then
|
if (( $? == 0 )); then
|
||||||
zstyle ":prezto:module:$pmodule" loaded 'yes'
|
zstyle ":prezto:module:$pmodule" loaded 'yes'
|
||||||
pdebuglog "Module %q loaded" $pmodule
|
|
||||||
else
|
else
|
||||||
# Remove the $fpath entry.
|
# Remove the $fpath entry.
|
||||||
fpath[(r)${pmodule_location}/functions]=()
|
fpath[(r)${pmodule_location}/functions]=()
|
||||||
@ -165,7 +150,6 @@ function pmodload {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
pdebuglog "Module %q failed to load" $pmodule
|
|
||||||
zstyle ":prezto:module:$pmodule" loaded 'no'
|
zstyle ":prezto:module:$pmodule" loaded 'no'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -20,7 +20,7 @@ Integrates zsh-autosuggestions into Prezto.
|
|||||||
Command-Not-Found
|
Command-Not-Found
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Loads the command-not-found tool on Debian-based distributions.
|
Loads the command-not-found tool on macOS or Debian-based distributions.
|
||||||
|
|
||||||
Completion
|
Completion
|
||||||
----------
|
----------
|
||||||
@ -122,7 +122,7 @@ Initializes OCaml package management.
|
|||||||
OSX
|
OSX
|
||||||
---
|
---
|
||||||
|
|
||||||
Defines Mac OS X aliases and functions.
|
Defines macOS aliases and functions.
|
||||||
|
|
||||||
Pacman
|
Pacman
|
||||||
------
|
------
|
||||||
@ -132,7 +132,7 @@ Provides aliases and functions for the Pacman package manager and frontends.
|
|||||||
Perl
|
Perl
|
||||||
----
|
----
|
||||||
|
|
||||||
Enables local Perl module installation on Mac OS X and defines alises.
|
Enables local Perl module installation on macOS and defines alises.
|
||||||
|
|
||||||
Prompt
|
Prompt
|
||||||
------
|
------
|
||||||
|
@ -31,9 +31,9 @@ installed:
|
|||||||
- *.7z* requires `7za`.
|
- *.7z* requires `7za`.
|
||||||
- *.deb* requires `ar`, `tar`.
|
- *.deb* requires `ar`, `tar`.
|
||||||
|
|
||||||
Additionally, if `pigz` and/or `pbzip2` are installed, `archive` will use them over
|
Additionally, if `pigz` and/or `pbzip2` are installed, `archive` will use them
|
||||||
their traditional counterparts, `gzip` and `bzip2` respectively, to take full advantage
|
over their traditional counterparts, `gzip` and `bzip2` respectively, to take
|
||||||
of all available CPU cores for compression.
|
full advantage of all available CPU cores for compression.
|
||||||
|
|
||||||
Alternatives
|
Alternatives
|
||||||
------------
|
------------
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
# function archive {
|
# function archive {
|
||||||
|
|
||||||
local archive_name dir_to_archive _gzip_bin _bzip2_bin
|
local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin
|
||||||
|
|
||||||
if (( $# != 2 )); then
|
if (( $# < 2 )); then
|
||||||
cat >&2 <<EOF
|
cat >&2 <<EOF
|
||||||
usage: $0 [archive_name.zip] [/path/to/include/into/archive]
|
usage: $0 [archive_name.zip] [/path/to/include/into/archive ...]
|
||||||
|
|
||||||
Where 'archive.zip' uses any of the following extensions:
|
Where 'archive.zip' uses any of the following extensions:
|
||||||
|
|
||||||
@ -28,14 +28,8 @@ fi
|
|||||||
|
|
||||||
# strip the path, just in case one is provided for some reason
|
# strip the path, just in case one is provided for some reason
|
||||||
archive_name="${1:t}"
|
archive_name="${1:t}"
|
||||||
# use absolute paths, and follow symlinks
|
# let paths be handled by actual archive helper
|
||||||
dir_to_archive="${2}"
|
path_to_archive="${@:2}"
|
||||||
|
|
||||||
# if the directory doesn't exist, quit. Nothing to archive
|
|
||||||
if [[ ! -e "${dir_to_archive}" ]]; then
|
|
||||||
print "$0: file or directory not valid: ${dir_to_archive}" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# here, we check for dropin/multi-threaded replacements
|
# here, we check for dropin/multi-threaded replacements
|
||||||
# this should eventually be moved to modules/archive/init.zsh
|
# this should eventually be moved to modules/archive/init.zsh
|
||||||
@ -46,21 +40,29 @@ else
|
|||||||
_gzip_bin='gzip'
|
_gzip_bin='gzip'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( $+commands[pbzip2] )); then
|
if (( $+commands[pixz] )); then
|
||||||
|
_xz_bin='pixz'
|
||||||
|
else
|
||||||
|
_xz_bin='xz'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( $+commands[lbzip2] )); then
|
||||||
|
_bzip2_bin='lbzip2'
|
||||||
|
elif (( $+commands[pbzip2] )); then
|
||||||
_bzip2_bin='pbzip2'
|
_bzip2_bin='pbzip2'
|
||||||
else
|
else
|
||||||
_bzip2_bin='bzip2'
|
_bzip2_bin='bzip2'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "${archive_name}" in
|
case "${archive_name}" in
|
||||||
(*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${dir_to_archive}" ;;
|
(*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${=path_to_archive}" ;;
|
||||||
(*.tar.bz2|*.tbz|*.tbz2) tar -cvf "${archive_name}" --use-compress-program="${_bzip2_bin}" "${dir_to_archive}" ;;
|
(*.tar.bz2|*.tbz|*.tbz2) tar -cvf "${archive_name}" --use-compress-program="${_bzip2_bin}" "${=path_to_archive}" ;;
|
||||||
(*.tar.xz|*.txz) tar -cvJf "${archive_name}" "${dir_to_archive}" ;;
|
(*.tar.xz|*.txz) tar -cvf "${archive_name}" --use-compress-program="${_xz_bin}" "${=path_to_archive}" ;;
|
||||||
(*.tar.lzma|*.tlz) tar -cvf "${archive_name}" --lzma "${dir_to_archive}" ;;
|
(*.tar.lzma|*.tlz) tar -cvf "${archive_name}" --lzma "${=path_to_archive}" ;;
|
||||||
(*.tar) tar -cvf "${archive_name}" "${dir_to_archive}" ;;
|
(*.tar) tar -cvf "${archive_name}" "${=path_to_archive}" ;;
|
||||||
(*.zip|*.jar) zip -r "${archive_name}" "${dir_to_archive}" ;;
|
(*.zip|*.jar) zip -r "${archive_name}" "${=path_to_archive}" ;;
|
||||||
(*.rar) rar a "${archive_name}" "${dir_to_archive}" ;;
|
(*.rar) rar a "${archive_name}" "${=path_to_archive}" ;;
|
||||||
(*.7z) 7za a "${archive_name}" "${dir_to_archive}" ;;
|
(*.7z) 7za a "${archive_name}" "${=path_to_archive}" ;;
|
||||||
(*.gz) print "\n.gz is only useful for single files, and does not capture permissions. Use .tar.gz" ;;
|
(*.gz) print "\n.gz is only useful for single files, and does not capture permissions. Use .tar.gz" ;;
|
||||||
(*.bz2) print "\n.bzip2 is only useful for single files, and does not capture permissions. Use .tar.bz2" ;;
|
(*.bz2) print "\n.bzip2 is only useful for single files, and does not capture permissions. Use .tar.bz2" ;;
|
||||||
(*.xz) print "\n.xz is only useful for single files, and does not capture permissions. Use .tar.xz" ;;
|
(*.xz) print "\n.xz is only useful for single files, and does not capture permissions. Use .tar.xz" ;;
|
||||||
|
@ -12,6 +12,7 @@ local success
|
|||||||
local file_name
|
local file_name
|
||||||
local file_path
|
local file_path
|
||||||
local extract_dir
|
local extract_dir
|
||||||
|
local _gzip_bin _bzip2_bin _xz_bin
|
||||||
|
|
||||||
if (( $# == 0 )); then
|
if (( $# == 0 )); then
|
||||||
cat >&2 <<EOF
|
cat >&2 <<EOF
|
||||||
@ -30,6 +31,29 @@ if [[ "$1" == "-r" || "$1" == "--remove" ]]; then
|
|||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# here, we check for dropin/multi-threaded replacements
|
||||||
|
# this should eventually be moved to modules/archive/init.zsh
|
||||||
|
# as a global alias
|
||||||
|
if (( $+commands[pigz] )); then
|
||||||
|
_gzip_bin='pigz'
|
||||||
|
else
|
||||||
|
_gzip_bin='gzip'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( $+commands[pixz] )); then
|
||||||
|
_xz_bin='pixz'
|
||||||
|
else
|
||||||
|
_xz_bin='xz'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( $+commands[lbzip2] )); then
|
||||||
|
_bzip2_bin='lbzip2'
|
||||||
|
elif (( $+commands[pbzip2] )); then
|
||||||
|
_bzip2_bin='pbzip2'
|
||||||
|
else
|
||||||
|
_bzip2_bin='bzip2'
|
||||||
|
fi
|
||||||
|
|
||||||
while (( $# > 0 )); do
|
while (( $# > 0 )); do
|
||||||
if [[ ! -s "$1" ]]; then
|
if [[ ! -s "$1" ]]; then
|
||||||
print "$0: file not valid: $1" >&2
|
print "$0: file not valid: $1" >&2
|
||||||
@ -42,15 +66,13 @@ while (( $# > 0 )); do
|
|||||||
file_path="${1:A}"
|
file_path="${1:A}"
|
||||||
extract_dir="${file_name:r}"
|
extract_dir="${file_name:r}"
|
||||||
case "$1:l" in
|
case "$1:l" in
|
||||||
(*.tar.gz|*.tgz) tar xvzf "$1" ;;
|
(*.tar.gz|*.tgz) tar -xvf "$1" --use-compress-program="${_gzip_bin}" ;;
|
||||||
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
|
(*.tar.bz2|*.tbz|*.tbz2) tar -xvf "$1" --use-compress-program="${_bzip2_bin}" ;;
|
||||||
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
|
(*.tar.xz|*.txz) tar -xvf "$1" --use-compress-program="${_xz_bin}" ;;
|
||||||
&& tar --xz -xvf "$1" \
|
|
||||||
|| xzcat "$1" | tar xvf - ;;
|
|
||||||
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
|
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
|
||||||
&& tar --lzma -xvf "$1" \
|
&& tar --lzma -xvf "$1" \
|
||||||
|| lzcat "$1" | tar xvf - ;;
|
|| lzcat "$1" | tar -xvf - ;;
|
||||||
(*.tar) tar xvf "$1" ;;
|
(*.tar) tar -xvf "$1" ;;
|
||||||
(*.gz) gunzip "$1" ;;
|
(*.gz) gunzip "$1" ;;
|
||||||
(*.bz2) bunzip2 "$1" ;;
|
(*.bz2) bunzip2 "$1" ;;
|
||||||
(*.xz) unxz "$1" ;;
|
(*.xz) unxz "$1" ;;
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
Autosuggestions
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Integrates zsh-autosuggestions into Prezto.
|
|
||||||
|
|
||||||
Autosuggestions
|
Autosuggestions
|
||||||
===============
|
===============
|
||||||
|
|
||||||
@ -46,6 +41,14 @@ To set the query found color, add the following line to *zpreztorc*:
|
|||||||
zstyle ':prezto:module:autosuggestions:color' found ''
|
zstyle ':prezto:module:autosuggestions:color' found ''
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Troubleshooting
|
||||||
|
---------------
|
||||||
|
|
||||||
|
### Autosuggestions from previous sessions don't show up
|
||||||
|
|
||||||
|
For autosuggestions from previous shell sessions to work, please make sure you
|
||||||
|
also have the `history` module enabled.
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
Submodule modules/autosuggestions/external updated: 15931f04ff...ae315ded4d
13
modules/aws/functions/_aws_switch_profile
Normal file
13
modules/aws/functions/_aws_switch_profile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#compdef aws_switch_profile
|
||||||
|
#autoload
|
||||||
|
|
||||||
|
if [[ ! -f ~/.aws/credentials ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local profiles
|
||||||
|
profiles=$(grep -E "^\[.+\]" ~/.aws/credentials | tr -d '[' | tr -d ']' )
|
||||||
|
|
||||||
|
_arguments "1:toggle:((
|
||||||
|
$profiles
|
||||||
|
))" && return 0
|
33
modules/aws/functions/aws-info
Normal file
33
modules/aws/functions/aws-info
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#
|
||||||
|
# Exposes information about the AWS_PROFILE environment via the $aws_info associative
|
||||||
|
# array.
|
||||||
|
#
|
||||||
|
|
||||||
|
# function aws-info {
|
||||||
|
|
||||||
|
local profile_format
|
||||||
|
local profile_formatted
|
||||||
|
local aws_prompt
|
||||||
|
local aws_region_prompt
|
||||||
|
|
||||||
|
unset aws_info
|
||||||
|
typeset -gA aws_info
|
||||||
|
|
||||||
|
if (( ${+AWS_SECRET_ACCESS_KEY} )); then
|
||||||
|
aws_prompt="${AWS_PROFILE} "
|
||||||
|
elif (( ${+AWS_PROFILE} )); then
|
||||||
|
aws_prompt=$AWS_PROFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( ${+AWS_DEFAULT_REGION} )) && [[ ${_aws_region} = "true" ]]; then
|
||||||
|
AWS_REGION=$(cut -d "-" -f 1 <<<$AWS_DEFAULT_REGION | cut -b 1)$(cut -d "-" -f 2 <<<$AWS_DEFAULT_REGION | cut -b 1)$(cut -d "-" -f 3 <<<$AWS_DEFAULT_REGION | cut -b 1)
|
||||||
|
aws_region_prompt=" $AWS_REGION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( ${+AWS_SECRET_ACCESS_KEY} )) || (( ${+AWS_DEFAULT_REGION} )); then
|
||||||
|
zstyle -s ':prezto:module:aws:info:profile' format 'profile_format'
|
||||||
|
zformat -f profile_formatted "$profile_format" "v:${aws_prompt:t}${aws_region_prompt}"
|
||||||
|
aws_info[profile]="$profile_formatted"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# }
|
172
modules/aws/init.zsh
Normal file
172
modules/aws/init.zsh
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
#
|
||||||
|
# Defines aws cli aliases/functions.
|
||||||
|
#
|
||||||
|
# Authors:
|
||||||
|
# Daniel Carrillo
|
||||||
|
#
|
||||||
|
|
||||||
|
# Get the output parameter
|
||||||
|
zstyle -s ':prezto:module:aws' output '_aws_output' || _aws_output='table'
|
||||||
|
zstyle -s ':prezto:module:aws' show_region '_aws_region' || _aws_region='false'
|
||||||
|
zstyle -s ':prezto:module:aws' profile '_aws_profile' || _aws_profile='default'
|
||||||
|
|
||||||
|
# Return if requirements are not found.
|
||||||
|
if (( ! $+commands[aws] )); then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
function _get_aws_profile {
|
||||||
|
if [[ -z "${AWS_PROFILE+1}" ]]; then
|
||||||
|
echo ${_aws_profile}
|
||||||
|
else
|
||||||
|
echo $AWS_PROFILE
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_i {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
aws ec2 describe-instances --profile $profile --output ${_aws_output} \
|
||||||
|
--query 'Reservations[].Instances[].[Tags[?Key==`Name`] | [0].Value, LaunchTime, State.Name,
|
||||||
|
InstanceType, VpcId, InstanceId, Placement.AvailabilityZone, PrivateIpAddress, PublicIpAddress]'
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_ebs {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
aws ec2 describe-volumes --profile $profile --output ${_aws_output} \
|
||||||
|
--query 'Volumes[].[Tags[?Key==`Name`] | [0].Value, VolumeId, Attachments[0].InstanceId, Size, VolumeType, Iops, AvailabilityZone]'
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_elb {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
aws elb describe-load-balancers --profile $profile --output ${_aws_output} \
|
||||||
|
--query "LoadBalancerDescriptions[*].{type:'elb',scheme:Scheme,dns:DNSName,vpc:VPCId,name:LoadBalancerName,subnets:Subnets[*] | join(',', @)}"
|
||||||
|
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
aws elbv2 describe-load-balancers --profile $profile --output ${_aws_output} \
|
||||||
|
--query "LoadBalancers[*].{type:Type,scheme:Scheme,dns:DNSName,vpc:VpcId,name:LoadBalancerName,subnets:AvailabilityZones[*].SubnetId | join(',', @)}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_userdata {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
aws ec2 describe-instance-attribute --profile $profile --output text \
|
||||||
|
--attribute userData --instance-id $1 \
|
||||||
|
--query 'UserData.Value' | base64 -d
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_vpc {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
aws ec2 describe-vpcs --profile $profile --output ${_aws_output} \
|
||||||
|
--query 'Vpcs[*].{id:VpcId,cidr:CidrBlock,tag:Tags[0].Value}'
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_subnets {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
aws ec2 describe-subnets --profile $profile --output text \
|
||||||
|
--query 'Subnets[].[Tags[?Key==`Name`] | [0].Value, SubnetId, VpcId, CidrBlock]' \
|
||||||
|
| sort -k1 | column -t
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_ag {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
aws autoscaling describe-auto-scaling-groups --profile $profile --output ${_aws_output} \
|
||||||
|
--query 'AutoScalingGroups[*].{name:AutoScalingGroupName,az:VPCZoneIdentifier}'
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_ami {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
aws ec2 describe-images --profile $profile --output ${_aws_output} \
|
||||||
|
--owner self --query 'Images[*].{date:CreationDate,id:ImageId,name:Name,virt:VirtualizationType,st:State}'
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_kms_decrypt {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
|
||||||
|
if [[ -z $1 ]]; then
|
||||||
|
echo "String is missing"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
aws kms --profile $profile decrypt --ciphertext-blob fileb://<(base64 -d <<<$1) \
|
||||||
|
--output text --query Plaintext | base64 -d
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_ssm_session {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
|
||||||
|
if [[ -z $1 ]]; then
|
||||||
|
echo "Instance id is missing"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
aws ssm start-session --profile $profile --target $1
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_ssm_session_any {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
local id
|
||||||
|
|
||||||
|
if [[ -z $1 ]]; then
|
||||||
|
echo "Instance name is missing"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
id=$(aws ec2 describe-instances --profile $profile --output text \
|
||||||
|
--filter "Name=tag:Name,Values=$1" "Name=instance-state-name,Values=running" \
|
||||||
|
--query 'Reservations[0].Instances[0].InstanceId')
|
||||||
|
if [[ $2 == "ssh" ]]; then
|
||||||
|
shift 2
|
||||||
|
AWS_PROFILE=$profile ssh $id $@
|
||||||
|
else
|
||||||
|
aws ssm start-session --profile $profile --target $id
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_cf {
|
||||||
|
local profile=$(_get_aws_profile)
|
||||||
|
|
||||||
|
if ! type "jq" > /dev/null; then
|
||||||
|
echo "ERROR: this function needs jq to be installed"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
aws cloudfront list-distributions --profile $profile --output json \
|
||||||
|
--query "DistributionList.Items[*].{id:Id,domain:DomainName,status:Status,
|
||||||
|
origin:Origins.Items[].DomainName | join(' ', @), aliases:Aliases.Items | join(' ', @)}" \
|
||||||
|
| jq -r ".[] | [.id, .domain, .aliases, .status, .origin] | @csv" | tr -d '"' | column --separator="," --table
|
||||||
|
}
|
||||||
|
|
||||||
|
# ~/.ssh/config
|
||||||
|
#
|
||||||
|
# Host i-*
|
||||||
|
# ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
|
||||||
|
# User <your_user>
|
||||||
|
function ssh_aws_any {
|
||||||
|
host=$1
|
||||||
|
shift
|
||||||
|
extra_params=$@
|
||||||
|
aws_ssm_session_any $host ssh $extra_params
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_switch_profile {
|
||||||
|
local region
|
||||||
|
|
||||||
|
if [[ -z $1 ]]; then
|
||||||
|
echo "Profile can't be an empty string"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Activating profile $1..."
|
||||||
|
unset -m "AWS_*"
|
||||||
|
export AWS_PROFILE=$1
|
||||||
|
if [[ -f ~/.aws/credentials ]]; then #&& (( ! ${+AWS_DEFAULT_REGION} ))
|
||||||
|
region=$(aws configure get region)
|
||||||
|
if [[ ! -z $region ]]; then
|
||||||
|
export AWS_DEFAULT_REGION=$region
|
||||||
|
else
|
||||||
|
unset AWS_DEFAULT_REGION
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function aws_deactivate_profile {
|
||||||
|
echo "Deactivating aws profile..."
|
||||||
|
unset -m "AWS_*"
|
||||||
|
}
|
@ -5,9 +5,10 @@ When you try to use a command that is not available locally, searches
|
|||||||
the package manager for a package offering that command and suggests
|
the package manager for a package offering that command and suggests
|
||||||
the proper install command.
|
the proper install command.
|
||||||
|
|
||||||
Debian-based and Arch Linux-based distributions use the [`command-not-found`][1] tool.
|
Debian and Arch Linux based distributions use the [`command-not-found`][1] tool.
|
||||||
|
|
||||||
macOS uses Homebrew's [`command-not-found` clone][2]. Note that you also need to [follow the instructions to tap the `command-not-found` homebrew repository][3].
|
macOS uses Homebrew's [`command-not-found` clone][2]. Note that you also need to
|
||||||
|
[follow the instructions][3] to tap the `command-not-found` homebrew repository.
|
||||||
|
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
|
@ -12,9 +12,31 @@ if [[ -s '/etc/zsh_command_not_found' ]]; then
|
|||||||
# Load command-not-found on Arch Linux-based distributions.
|
# Load command-not-found on Arch Linux-based distributions.
|
||||||
elif [[ -s '/usr/share/doc/pkgfile/command-not-found.zsh' ]]; then
|
elif [[ -s '/usr/share/doc/pkgfile/command-not-found.zsh' ]]; then
|
||||||
source '/usr/share/doc/pkgfile/command-not-found.zsh'
|
source '/usr/share/doc/pkgfile/command-not-found.zsh'
|
||||||
# Load command-not-found on Mac OS X when homebrew tap is configured.
|
# Load command-not-found on macOS when Homebrew tap is configured.
|
||||||
elif (( $+commands[brew] )) && brew command command-not-found-init > /dev/null 2>&1; then
|
# To avoid performance penalty, we do not use Homebrew's ruby based command
|
||||||
eval "$(brew command-not-found-init)"
|
# lookup mechanism (viz., `brew command command-not-found-init`) and instead
|
||||||
|
# `find` it ourselves from `TAP_DIRECTORY` defined internally in Homebrew.
|
||||||
|
elif (( $+commands[brew] )); then
|
||||||
|
cnf_command=(
|
||||||
|
"$(brew --repository 2> /dev/null)"/Library/Taps/*/*/cmd/brew-command-not-found-init(|.rb)(.N)
|
||||||
|
)
|
||||||
|
if (( $#cnf_command )); then
|
||||||
|
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/brew-command-not-found-cache.zsh"
|
||||||
|
|
||||||
|
if [[ "${${(@o)cnf_command}[1]}" -nt "$cache_file" \
|
||||||
|
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|
||||||
|
|| ! -s "$cache_file" ]]; then
|
||||||
|
mkdir -p "$cache_file:h"
|
||||||
|
# brew command-not-found-init is slow; cache its output.
|
||||||
|
brew command-not-found-init >! "$cache_file" 2> /dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "$cache_file"
|
||||||
|
|
||||||
|
unset cache_file
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset cnf_command
|
||||||
# Return if requirements are not found.
|
# Return if requirements are not found.
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
|
@ -6,6 +6,19 @@ the [zsh-completions][1] project.
|
|||||||
|
|
||||||
This module must be loaded **after** the *utility* module.
|
This module must be loaded **after** the *utility* module.
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
|
||||||
|
- `COMPLETE_IN_WORD` complete from both ends of a word.
|
||||||
|
- `ALWAYS_TO_END` move cursor to the end of a completed word.
|
||||||
|
- `PATH_DIRS` perform path search even on command names with slashes.
|
||||||
|
- `AUTO_MENU` show completion menu on a successive tab press.
|
||||||
|
- `AUTO_LIST` automatically list choices on ambiguous completion.
|
||||||
|
- `AUTO_PARAM_SLASH` if completed parameter is a directory, add a trailing slash.
|
||||||
|
- `EXTENDED_GLOB` needed for file modification glob modifiers with compinit.
|
||||||
|
- `MENU_COMPLETE` do not autoselect the first completion entry.
|
||||||
|
- `FLOW_CONTROL` disable start/stop characters in shell editor.
|
||||||
|
|
||||||
Settings
|
Settings
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
Submodule modules/completion/external updated: 2a30b05a5c...ed4ff5384b
@ -32,13 +32,16 @@ unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor.
|
|||||||
# cache time of 20 hours, so it should almost always regenerate the first time a
|
# cache time of 20 hours, so it should almost always regenerate the first time a
|
||||||
# shell is opened each day.
|
# shell is opened each day.
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
_comp_files=(${ZDOTDIR:-$HOME}/.zcompdump(Nm-20))
|
_comp_path="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/zcompdump"
|
||||||
if (( $#_comp_files )); then
|
# #q expands globs in conditional expressions
|
||||||
compinit -i -C
|
if [[ $_comp_path(#qNmh-20) ]]; then
|
||||||
|
# -C (skip function check) implies -i (skip security check).
|
||||||
|
compinit -C -d "$_comp_path"
|
||||||
else
|
else
|
||||||
compinit -i
|
mkdir -p "$_comp_path:h"
|
||||||
|
compinit -i -d "$_comp_path"
|
||||||
fi
|
fi
|
||||||
unset _comp_files
|
unset _comp_path
|
||||||
|
|
||||||
#
|
#
|
||||||
# Styles
|
# Styles
|
||||||
@ -46,7 +49,7 @@ unset _comp_files
|
|||||||
|
|
||||||
# Use caching to make completion for commands such as dpkg and apt usable.
|
# Use caching to make completion for commands such as dpkg and apt usable.
|
||||||
zstyle ':completion::complete:*' use-cache on
|
zstyle ':completion::complete:*' use-cache on
|
||||||
zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache"
|
zstyle ':completion::complete:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/prezto/zcompcache"
|
||||||
|
|
||||||
# Case-insensitive (all), partial-word, and then substring completion.
|
# Case-insensitive (all), partial-word, and then substring completion.
|
||||||
if zstyle -t ':prezto:module:completion:*' case-sensitive; then
|
if zstyle -t ':prezto:module:completion:*' case-sensitive; then
|
||||||
@ -99,7 +102,7 @@ zstyle ':completion:*:history-words' remove-all-dups yes
|
|||||||
zstyle ':completion:*:history-words' list false
|
zstyle ':completion:*:history-words' list false
|
||||||
zstyle ':completion:*:history-words' menu yes
|
zstyle ':completion:*:history-words' menu yes
|
||||||
|
|
||||||
# Environmental Variables
|
# Environment Variables
|
||||||
zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-}
|
zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-}
|
||||||
|
|
||||||
# Populate hostname completion. But allow ignoring custom entries from static
|
# Populate hostname completion. But allow ignoring custom entries from static
|
||||||
@ -107,7 +110,7 @@ zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-va
|
|||||||
zstyle -a ':prezto:module:completion:*:hosts' etc-host-ignores '_etc_host_ignores'
|
zstyle -a ':prezto:module:completion:*:hosts' etc-host-ignores '_etc_host_ignores'
|
||||||
|
|
||||||
zstyle -e ':completion:*:hosts' hosts 'reply=(
|
zstyle -e ':completion:*:hosts' hosts 'reply=(
|
||||||
${=${=${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2> /dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ }
|
${=${=${=${${(f)"$(cat {/etc/ssh/ssh_,~/.ssh/}known_hosts(|2)(N) 2> /dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ }
|
||||||
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2> /dev/null))"}%%(\#${_etc_host_ignores:+|${(j:|:)~_etc_host_ignores}})*}
|
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2> /dev/null))"}%%(\#${_etc_host_ignores:+|${(j:|:)~_etc_host_ignores}})*}
|
||||||
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2> /dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2> /dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
||||||
)'
|
)'
|
||||||
|
@ -12,7 +12,6 @@ Options
|
|||||||
- `PUSHD_SILENT` does not print the directory stack after `pushd` or `popd`.
|
- `PUSHD_SILENT` does not print the directory stack after `pushd` or `popd`.
|
||||||
- `PUSHD_TO_HOME` pushes to the home directory when no argument is given.
|
- `PUSHD_TO_HOME` pushes to the home directory when no argument is given.
|
||||||
- `CDABLE_VARS` changes directory to a path stored in a variable.
|
- `CDABLE_VARS` changes directory to a path stored in a variable.
|
||||||
- `AUTO_NAME_DIRS` auto adds variable-stored paths to `~` list.
|
|
||||||
- `MULTIOS` writes to multiple descriptors.
|
- `MULTIOS` writes to multiple descriptors.
|
||||||
- `EXTENDED_GLOB` uses extended globbing syntax.
|
- `EXTENDED_GLOB` uses extended globbing syntax.
|
||||||
- `CLOBBER` does not overwrite existing files with `>` and `>>`. Use `>!` and
|
- `CLOBBER` does not overwrite existing files with `>` and `>>`. Use `>!` and
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
Editor
|
Editor
|
||||||
======
|
======
|
||||||
|
|
||||||
Sets key bindings.
|
Sets editor specific key bindings options and variables.
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
|
||||||
|
- `BEEP` beep on error in line editor.
|
||||||
|
|
||||||
|
Variables
|
||||||
|
---------
|
||||||
|
|
||||||
|
- `WORDCHARS` treat a given set of characters as part of a word.
|
||||||
|
|
||||||
Settings
|
Settings
|
||||||
--------
|
--------
|
||||||
@ -96,4 +106,4 @@ Authors
|
|||||||
|
|
||||||
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
||||||
|
|
||||||
[1]: https://github.com/sorin-ionescu/oh-my-zsh/issues
|
[1]: https://github.com/sorin-ionescu/prezto/issues
|
||||||
|
@ -91,6 +91,9 @@ function bindkey-all {
|
|||||||
# Exposes information about the Zsh Line Editor via the $editor_info associative
|
# Exposes information about the Zsh Line Editor via the $editor_info associative
|
||||||
# array.
|
# array.
|
||||||
function editor-info {
|
function editor-info {
|
||||||
|
# Ensure that we're going to set the editor-info for prompts that
|
||||||
|
# are prezto managed and/or compatible.
|
||||||
|
if zstyle -t ':prezto:module:prompt' managed; then
|
||||||
# Clean up previous $editor_info.
|
# Clean up previous $editor_info.
|
||||||
unset editor_info
|
unset editor_info
|
||||||
typeset -gA editor_info
|
typeset -gA editor_info
|
||||||
@ -113,6 +116,7 @@ function editor-info {
|
|||||||
|
|
||||||
unset REPLY
|
unset REPLY
|
||||||
zle zle-reset-prompt
|
zle zle-reset-prompt
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
zle -N editor-info
|
zle -N editor-info
|
||||||
|
|
||||||
@ -269,9 +273,11 @@ bindkey -d
|
|||||||
# Emacs Key Bindings
|
# Emacs Key Bindings
|
||||||
#
|
#
|
||||||
|
|
||||||
for key in "$key_info[Escape]"{B,b} "${(s: :)key_info[ControlLeft]}"
|
for key in "$key_info[Escape]"{B,b} "${(s: :)key_info[ControlLeft]}" \
|
||||||
|
"${key_info[Escape]}${key_info[Left]}"
|
||||||
bindkey -M emacs "$key" emacs-backward-word
|
bindkey -M emacs "$key" emacs-backward-word
|
||||||
for key in "$key_info[Escape]"{F,f} "${(s: :)key_info[ControlRight]}"
|
for key in "$key_info[Escape]"{F,f} "${(s: :)key_info[ControlRight]}" \
|
||||||
|
"${key_info[Escape]}${key_info[Right]}"
|
||||||
bindkey -M emacs "$key" emacs-forward-word
|
bindkey -M emacs "$key" emacs-forward-word
|
||||||
|
|
||||||
# Kill to the beginning of the line.
|
# Kill to the beginning of the line.
|
||||||
@ -312,6 +318,7 @@ bindkey -M vicmd "$key_info[Control]X$key_info[Control]E" edit-command-line
|
|||||||
|
|
||||||
# Undo/Redo
|
# Undo/Redo
|
||||||
bindkey -M vicmd "u" undo
|
bindkey -M vicmd "u" undo
|
||||||
|
bindkey -M viins "$key_info[Control]_" undo
|
||||||
bindkey -M vicmd "$key_info[Control]R" redo
|
bindkey -M vicmd "$key_info[Control]R" redo
|
||||||
|
|
||||||
if (( $+widgets[history-incremental-pattern-search-backward] )); then
|
if (( $+widgets[history-incremental-pattern-search-backward] )); then
|
||||||
|
@ -5,9 +5,6 @@ Sets general shell options and defines environment variables.
|
|||||||
|
|
||||||
This module must be loaded first.
|
This module must be loaded first.
|
||||||
|
|
||||||
Environment Variables
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
------------
|
------------
|
||||||
|
|
||||||
@ -15,6 +12,39 @@ This module **MUST NOT** rely on any command not built in Zsh.
|
|||||||
|
|
||||||
Non-interactive environment variables should be defined in [`zshenv`][1].
|
Non-interactive environment variables should be defined in [`zshenv`][1].
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
|
||||||
|
### General
|
||||||
|
|
||||||
|
- `COMBINING_CHARS` combine zero-length punctuation characters (accents) with
|
||||||
|
the base character.
|
||||||
|
- `INTERACTIVE_COMMENTS` enable comments in interactive shell.
|
||||||
|
- `RC_QUOTES` allow 'Henry''s Garage' instead of 'Henry'\''s Garage'.
|
||||||
|
- `MAIL_WARNING` don't print a warning message if a mail file has been accessed.
|
||||||
|
|
||||||
|
### Jobs
|
||||||
|
|
||||||
|
- `LONG_LIST_JOBS` list jobs in the long format by default.
|
||||||
|
- `AUTO_RESUME` attempt to resume existing job before creating a new process.
|
||||||
|
- `NOTIFY` report status of background jobs immediately.
|
||||||
|
- `BG_NICE` don't run all background jobs at a lower priority.
|
||||||
|
- `HUP` don't kill jobs on shell exit.
|
||||||
|
- `CHECK_JOBS` don't report on jobs when shell exit.
|
||||||
|
|
||||||
|
Variables
|
||||||
|
---------
|
||||||
|
|
||||||
|
### Termcap
|
||||||
|
|
||||||
|
- `LESS_TERMCAP_mb` begins blinking.
|
||||||
|
- `LESS_TERMCAP_md` begins bold.
|
||||||
|
- `LESS_TERMCAP_me` ends mode.
|
||||||
|
- `LESS_TERMCAP_se` ends standout-mode.
|
||||||
|
- `LESS_TERMCAP_so` begins standout-mode.
|
||||||
|
- `LESS_TERMCAP_ue` ends underline.
|
||||||
|
- `LESS_TERMCAP_us` begins underline.
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# paste had a regression. Additionally, 5.2 added bracketed-paste-url-magic
|
# paste had a regression. Additionally, 5.2 added bracketed-paste-url-magic
|
||||||
# which is generally better than url-quote-magic so we load that when possible.
|
# which is generally better than url-quote-magic so we load that when possible.
|
||||||
autoload -Uz is-at-least
|
autoload -Uz is-at-least
|
||||||
if [[ ${ZSH_VERSION} != 5.1.1 ]]; then
|
if [[ ${ZSH_VERSION} != 5.1.1 && ${TERM} != "dumb" ]]; then
|
||||||
if is-at-least 5.2; then
|
if is-at-least 5.2; then
|
||||||
autoload -Uz bracketed-paste-url-magic
|
autoload -Uz bracketed-paste-url-magic
|
||||||
zle -N bracketed-paste bracketed-paste-url-magic
|
zle -N bracketed-paste bracketed-paste-url-magic
|
||||||
@ -38,6 +38,9 @@ setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell.
|
|||||||
setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'.
|
setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'.
|
||||||
unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed.
|
unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed.
|
||||||
|
|
||||||
|
# Allow mapping Ctrl+S and Ctrl+Q shortcuts
|
||||||
|
[[ -r ${TTY:-} && -w ${TTY:-} && $+commands[stty] == 1 ]] && stty -ixon <$TTY >$TTY
|
||||||
|
|
||||||
#
|
#
|
||||||
# Jobs
|
# Jobs
|
||||||
#
|
#
|
||||||
|
Submodule modules/fasd/external updated: 90b531a5da...48220241e7
@ -19,8 +19,10 @@ fi
|
|||||||
# Initialization
|
# Initialization
|
||||||
#
|
#
|
||||||
|
|
||||||
cache_file="${TMPDIR:-/tmp}/prezto-fasd-cache.$UID.zsh"
|
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/fasd-cache.zsh"
|
||||||
if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
if [[ "${commands[fasd]}" -nt "$cache_file" \
|
||||||
|
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|
||||||
|
|| ! -s "$cache_file" ]]; then
|
||||||
# Set the base init arguments.
|
# Set the base init arguments.
|
||||||
init_args=(zsh-hook)
|
init_args=(zsh-hook)
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
|||||||
init_args+=(zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)
|
init_args+=(zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$cache_file:h"
|
||||||
# Cache init code.
|
# Cache init code.
|
||||||
fasd --init "$init_args[@]" >! "$cache_file" 2> /dev/null
|
fasd --init "$init_args[@]" >! "$cache_file" 2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
@ -67,7 +67,7 @@ zstyle ':prezto:module:git:alias' skip 'yes'
|
|||||||
- `gcm` records changes to the repository with the given message.
|
- `gcm` records changes to the repository with the given message.
|
||||||
- `gcS` records changes to the repository. (Signed)
|
- `gcS` records changes to the repository. (Signed)
|
||||||
- `gcSa` stages all modified and deleted files. (Signed)
|
- `gcSa` stages all modified and deleted files. (Signed)
|
||||||
- `gcSm` records changes to the repository with the given message. (Signed) - `gco` checks out a branch or paths to work tree.
|
- `gcSm` records changes to the repository with the given message. (Signed)
|
||||||
- `gcam` stages all modified and deleted files, and records changes to the repository with the given message.
|
- `gcam` stages all modified and deleted files, and records changes to the repository with the given message.
|
||||||
- `gco` checks out a branch or paths to work tree.
|
- `gco` checks out a branch or paths to work tree.
|
||||||
- `gcO` checks out hunks from the index or the tree interactively.
|
- `gcO` checks out hunks from the index or the tree interactively.
|
||||||
@ -81,7 +81,10 @@ zstyle ':prezto:module:git:alias' skip 'yes'
|
|||||||
commits.
|
commits.
|
||||||
- `gcR` removes the *HEAD* commit.
|
- `gcR` removes the *HEAD* commit.
|
||||||
- `gcs` displays various types of objects.
|
- `gcs` displays various types of objects.
|
||||||
|
- `gcsS` displays commits with GPG signature.
|
||||||
- `gcl` lists lost commits.
|
- `gcl` lists lost commits.
|
||||||
|
- `gcy` displays commits yet to be applied to upstream in the short format.
|
||||||
|
- `gcY` displays commits yet to be applied to upstream.
|
||||||
|
|
||||||
### Conflict
|
### Conflict
|
||||||
|
|
||||||
@ -218,6 +221,7 @@ zstyle ':prezto:module:git:alias' skip 'yes'
|
|||||||
- `glg` displays the graph log.
|
- `glg` displays the graph log.
|
||||||
- `glb` displays the brief commit log.
|
- `glb` displays the brief commit log.
|
||||||
- `glc` displays the commit count for each contributor in descending order.
|
- `glc` displays the commit count for each contributor in descending order.
|
||||||
|
- `glS` displays the log and checks the validity of signed commits.
|
||||||
|
|
||||||
### Merge
|
### Merge
|
||||||
|
|
||||||
@ -231,7 +235,8 @@ zstyle ':prezto:module:git:alias' skip 'yes'
|
|||||||
### Push
|
### Push
|
||||||
|
|
||||||
- `gp` updates remote refs along with associated objects.
|
- `gp` updates remote refs along with associated objects.
|
||||||
- `gpf` forcefully updates remote refs along with associated objects.
|
- `gpf` forcefully updates remote refs along with associated objects using the safer `--force-with-lease` option.
|
||||||
|
- `gpF` forcefully updates remote refs along with associated objects using the riskier `--force` option.
|
||||||
- `gpa` updates remote branches along with associated objects.
|
- `gpa` updates remote branches along with associated objects.
|
||||||
- `gpA` updates remote branches and tags along with associated objects.
|
- `gpA` updates remote branches and tags along with associated objects.
|
||||||
- `gpt` updates remote tags along with associated objects.
|
- `gpt` updates remote tags along with associated objects.
|
||||||
@ -288,6 +293,13 @@ zstyle ':prezto:module:git:alias' skip 'yes'
|
|||||||
- `gSu` fetches and merges the latest changes for all submodule.
|
- `gSu` fetches and merges the latest changes for all submodule.
|
||||||
- `gSx` removes a submodule.
|
- `gSx` removes a submodule.
|
||||||
|
|
||||||
|
### Tag
|
||||||
|
|
||||||
|
- `gt` lists tags or creates tag.
|
||||||
|
- `gtl` lists tags matching pattern.
|
||||||
|
- `gts` creates a signed tag.
|
||||||
|
- `gtv` validate a signed tag.
|
||||||
|
|
||||||
### Working directory
|
### Working directory
|
||||||
|
|
||||||
- `gws` displays working-tree status in the short format.
|
- `gws` displays working-tree status in the short format.
|
||||||
@ -307,9 +319,10 @@ zstyle ':prezto:module:git:alias' skip 'yes'
|
|||||||
|
|
||||||
The following aliases may shadow system commands:
|
The following aliases may shadow system commands:
|
||||||
|
|
||||||
- `gpt` shadows the [GUID partition table maintenance utility][4].
|
|
||||||
- `gs` shadows the [Ghostscript][5].
|
|
||||||
- `gb` shadows the [GB][9].
|
- `gb` shadows the [GB][9].
|
||||||
|
- `gm` shadows the [Graphics Magick image processor][11].
|
||||||
|
- `gpt` shadows the [GUID partition table maintenance utility][4].
|
||||||
|
- `gs` shadows the [Ghostscript interpreter and previewer][5].
|
||||||
|
|
||||||
If you frequently use the above commands, you may wish to remove said aliases
|
If you frequently use the above commands, you may wish to remove said aliases
|
||||||
from this module or to disable them at the bottom of the zshrc with `unalias`.
|
from this module or to disable them at the bottom of the zshrc with `unalias`.
|
||||||
@ -434,9 +447,10 @@ Authors
|
|||||||
[2]: https://github.com/defunkt/hub
|
[2]: https://github.com/defunkt/hub
|
||||||
[3]: https://www.github.com
|
[3]: https://www.github.com
|
||||||
[4]: http://www.manpagez.com/man/8/gpt/
|
[4]: http://www.manpagez.com/man/8/gpt/
|
||||||
[5]: http://linux.die.net/man/1/gs
|
[5]: http://www.manpagez.com/man/1/gs/
|
||||||
[6]: https://github.com/sorin-ionescu/prezto/issues
|
[6]: https://github.com/sorin-ionescu/prezto/issues
|
||||||
[7]: https://github.com/sorin-ionescu/prezto/issues/219
|
[7]: https://github.com/sorin-ionescu/prezto/issues/219
|
||||||
[8]: http://www.kernel.org/pub/software/scm/git/docs/git-log.html
|
[8]: http://www.kernel.org/pub/software/scm/git/docs/git-log.html
|
||||||
[9]: https://getgb.io/
|
[9]: https://getgb.io/
|
||||||
[10]: https://github.com/blog/985-git-io-github-url-shortener
|
[10]: https://github.com/blog/985-git-io-github-url-shortener
|
||||||
|
[11]: http://www.manpagez.com/man/1/gm/
|
||||||
|
@ -68,7 +68,10 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
|
|||||||
alias gcr='git revert'
|
alias gcr='git revert'
|
||||||
alias gcR='git reset "HEAD^"'
|
alias gcR='git reset "HEAD^"'
|
||||||
alias gcs='git show'
|
alias gcs='git show'
|
||||||
|
alias gcsS='git show --pretty=short --show-signature'
|
||||||
alias gcl='git-commit-lost'
|
alias gcl='git-commit-lost'
|
||||||
|
alias gcy='git cherry -v --abbrev'
|
||||||
|
alias gcY='git cherry -v'
|
||||||
|
|
||||||
# Conflict (C)
|
# Conflict (C)
|
||||||
alias gCl='git --no-pager diff --name-only --diff-filter=U'
|
alias gCl='git --no-pager diff --name-only --diff-filter=U'
|
||||||
@ -94,7 +97,9 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
|
|||||||
alias gfc='git clone'
|
alias gfc='git clone'
|
||||||
alias gfcr='git clone --recurse-submodules'
|
alias gfcr='git clone --recurse-submodules'
|
||||||
alias gfm='git pull'
|
alias gfm='git pull'
|
||||||
|
alias gfma='git pull --autostash'
|
||||||
alias gfr='git pull --rebase'
|
alias gfr='git pull --rebase'
|
||||||
|
alias gfra='git pull --rebase --autostash'
|
||||||
|
|
||||||
# Flow (F)
|
# Flow (F)
|
||||||
alias gFi='git flow init'
|
alias gFi='git flow init'
|
||||||
@ -185,9 +190,10 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
|
|||||||
alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"'
|
alias gls='git log --topo-order --stat --pretty=format:"${_git_log_medium_format}"'
|
||||||
alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"'
|
alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:"${_git_log_medium_format}"'
|
||||||
alias glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"'
|
alias glo='git log --topo-order --pretty=format:"${_git_log_oneline_format}"'
|
||||||
alias glg='git log --topo-order --all --graph --pretty=format:"${_git_log_oneline_format}"'
|
alias glg='git log --topo-order --graph --pretty=format:"${_git_log_oneline_format}"'
|
||||||
alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"'
|
alias glb='git log --topo-order --pretty=format:"${_git_log_brief_format}"'
|
||||||
alias glc='git shortlog --summary --numbered'
|
alias glc='git shortlog --summary --numbered'
|
||||||
|
alias glS='git log --show-signature'
|
||||||
|
|
||||||
# Merge (m)
|
# Merge (m)
|
||||||
alias gm='git merge'
|
alias gm='git merge'
|
||||||
@ -250,6 +256,12 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
|
|||||||
alias gSu='git submodule foreach git pull origin master'
|
alias gSu='git submodule foreach git pull origin master'
|
||||||
alias gSx='git-submodule-remove'
|
alias gSx='git-submodule-remove'
|
||||||
|
|
||||||
|
# Tag (t)
|
||||||
|
alias gt='git tag'
|
||||||
|
alias gtl='git tag -l'
|
||||||
|
alias gts='git tag -s'
|
||||||
|
alias gtv='git verify-tag'
|
||||||
|
|
||||||
# Working Copy (w)
|
# Working Copy (w)
|
||||||
alias gws='git status --ignore-submodules=${_git_status_ignore_submodules} --short'
|
alias gws='git status --ignore-submodules=${_git_status_ignore_submodules} --short'
|
||||||
alias gwS='git status --ignore-submodules=${_git_status_ignore_submodules}'
|
alias gwS='git status --ignore-submodules=${_git_status_ignore_submodules}'
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ _arguments -C -s -S \
|
|||||||
|
|
||||||
case "$state" in
|
case "$state" in
|
||||||
(remote)
|
(remote)
|
||||||
remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2))
|
remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2))
|
||||||
|
|
||||||
_describe -t branch 'remotes' remotes && ret=0
|
_describe -t branch 'remotes' remotes && ret=0
|
||||||
;;
|
;;
|
||||||
@ -29,7 +29,7 @@ case "$state" in
|
|||||||
remote="$words[(($CURRENT - 1))]"
|
remote="$words[(($CURRENT - 1))]"
|
||||||
|
|
||||||
branches_or_tags=($(
|
branches_or_tags=($(
|
||||||
git ls-remote --heads --tags "$remote" 2> /dev/null | cut -f2
|
command git ls-remote --heads --tags "$remote" 2> /dev/null | cut -f2
|
||||||
))
|
))
|
||||||
|
|
||||||
branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/})
|
branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/})
|
||||||
@ -39,7 +39,7 @@ case "$state" in
|
|||||||
_describe -t tag 'tags' tags && ret=0
|
_describe -t tag 'tags' tags && ret=0
|
||||||
;;
|
;;
|
||||||
(file)
|
(file)
|
||||||
files=(${(0)"$(_call_program files git ls-files -z --exclude-standard 2> /dev/null)"})
|
files=(${(0)"$(_call_program files command git ls-files -z --exclude-standard 2> /dev/null)"})
|
||||||
_wanted file expl 'file' _multi_parts - / files && ret=0
|
_wanted file expl 'file' _multi_parts - / files && ret=0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ case "$state" in
|
|||||||
while IFS=$'\n' read submodule; do
|
while IFS=$'\n' read submodule; do
|
||||||
submodules+=("$submodule")
|
submodules+=("$submodule")
|
||||||
done < <(
|
done < <(
|
||||||
git config --file "$(git-root)/.gitmodules" --list \
|
command git config --file "$(git-root)/.gitmodules" --list \
|
||||||
| grep '.path=' \
|
| grep '.path=' \
|
||||||
| cut -d= -f2-
|
| cut -d= -f2-
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ local submodule
|
|||||||
while IFS=$'\n' read submodule; do
|
while IFS=$'\n' read submodule; do
|
||||||
submodules+=("$submodule")
|
submodules+=("$submodule")
|
||||||
done < <(
|
done < <(
|
||||||
git config --file "$(git-root)/.gitmodules" --list \
|
command git config --file "$(git-root)/.gitmodules" --list \
|
||||||
| grep '.path=' \
|
| grep '.path=' \
|
||||||
| cut -d= -f2-
|
| cut -d= -f2-
|
||||||
)
|
)
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
# function git-branch-current {
|
# function git-branch-current {
|
||||||
|
|
||||||
if ! git rev-parse 2> /dev/null; then
|
if ! command git rev-parse 2> /dev/null; then
|
||||||
print "$0: not a repository: $PWD" >&2
|
print "$0: not a repository: $PWD" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local ref="$(git symbolic-ref HEAD 2> /dev/null)"
|
local ref="$(command git symbolic-ref HEAD 2> /dev/null)"
|
||||||
|
|
||||||
if [[ -n "$ref" ]]; then
|
if [[ -n "$ref" ]]; then
|
||||||
print "${ref#refs/heads/}"
|
print "${ref#refs/heads/}"
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
# function git-commit-lost {
|
# function git-commit-lost {
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
print "$0: not a repository work tree: $PWD" >&2
|
print "$0: not a repository work tree: $PWD" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git fsck 2> /dev/null \
|
command git fsck 2> /dev/null \
|
||||||
| grep "^dangling commit" \
|
| grep "^dangling commit" \
|
||||||
| awk '{print $3}' \
|
| awk '{print $3}' \
|
||||||
| git log \
|
| command git log \
|
||||||
--date-order \
|
--date-order \
|
||||||
--no-walk \
|
--no-walk \
|
||||||
--stdin \
|
--stdin \
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# function git-dir {
|
# function git-dir {
|
||||||
|
|
||||||
local git_dir="${$(git rev-parse --git-dir):A}"
|
local git_dir="${$(command git rev-parse --git-dir):A}"
|
||||||
|
|
||||||
if [[ -n "$git_dir" ]]; then
|
if [[ -n "$git_dir" ]]; then
|
||||||
print "$git_dir"
|
print "$git_dir"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# function git-hub-browse {
|
# function git-hub-browse {
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
print "$0: not a repository work tree: $PWD" >&2
|
print "$0: not a repository work tree: $PWD" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -15,7 +15,7 @@ fi
|
|||||||
local remotes remote references reference file url
|
local remotes remote references reference file url
|
||||||
|
|
||||||
remote="${1:-origin}"
|
remote="${1:-origin}"
|
||||||
remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2))
|
remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2))
|
||||||
|
|
||||||
if (( $remotes[(i)$remote] == $#remotes + 1 )); then
|
if (( $remotes[(i)$remote] == $#remotes + 1 )); then
|
||||||
print "$0: remote not found: $remote" >&2
|
print "$0: remote not found: $remote" >&2
|
||||||
@ -23,14 +23,14 @@ if (( $remotes[(i)$remote] == $#remotes + 1 )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
url=$(
|
url=$(
|
||||||
git config --get "remote.${remote}.url" \
|
command git config --get "remote.${remote}.url" \
|
||||||
| sed -En "s/(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p"
|
| sed -En "s/(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p"
|
||||||
)
|
)
|
||||||
|
|
||||||
reference="${${2:-$(git-branch-current)}:-HEAD}"
|
reference="${${2:-$(git-branch-current)}:-HEAD}"
|
||||||
references=(
|
references=(
|
||||||
HEAD
|
HEAD
|
||||||
${$(git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/}
|
${$(command git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (( $references[(i)$reference] == $#references + 1 )); then
|
if (( $references[(i)$reference] == $#references + 1 )); then
|
||||||
@ -39,7 +39,7 @@ if (( $references[(i)$reference] == $#references + 1 )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$reference" == 'HEAD' ]]; then
|
if [[ "$reference" == 'HEAD' ]]; then
|
||||||
reference="$(git rev-parse HEAD 2> /dev/null)"
|
reference="$(command git rev-parse HEAD 2> /dev/null)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
file="$3"
|
file="$3"
|
||||||
|
@ -178,15 +178,15 @@ function git-info {
|
|||||||
typeset -gA git_info
|
typeset -gA git_info
|
||||||
|
|
||||||
# Return if not inside a Git repository work tree.
|
# Return if not inside a Git repository work tree.
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( $# > 0 )); then
|
if (( $# > 0 )); then
|
||||||
if [[ "$1" == [Oo][Nn] ]]; then
|
if [[ "$1" == [Oo][Nn] ]]; then
|
||||||
git config --bool prompt.showinfo true
|
command git config --bool prompt.showinfo true
|
||||||
elif [[ "$1" == [Oo][Ff][Ff] ]]; then
|
elif [[ "$1" == [Oo][Ff][Ff] ]]; then
|
||||||
git config --bool prompt.showinfo false
|
command git config --bool prompt.showinfo false
|
||||||
else
|
else
|
||||||
print "usage: $0 [ on | off ]" >&2
|
print "usage: $0 [ on | off ]" >&2
|
||||||
fi
|
fi
|
||||||
@ -194,7 +194,7 @@ function git-info {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Return if git-info is disabled.
|
# Return if git-info is disabled.
|
||||||
if ! is-true "${$(git config --bool prompt.showinfo):-true}"; then
|
if ! is-true "${$(command git config --bool prompt.showinfo):-true}"; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ function git-info {
|
|||||||
# Format commit.
|
# Format commit.
|
||||||
zstyle -s ':prezto:module:git:info:commit' format 'commit_format'
|
zstyle -s ':prezto:module:git:info:commit' format 'commit_format'
|
||||||
if [[ -n "$commit_format" ]]; then
|
if [[ -n "$commit_format" ]]; then
|
||||||
commit="$(git rev-parse HEAD 2> /dev/null)"
|
commit="$(command git rev-parse HEAD 2> /dev/null)"
|
||||||
if [[ -n "$commit" ]]; then
|
if [[ -n "$commit" ]]; then
|
||||||
zformat -f commit_formatted "$commit_format" "c:$commit"
|
zformat -f commit_formatted "$commit_format" "c:$commit"
|
||||||
fi
|
fi
|
||||||
@ -212,12 +212,19 @@ function git-info {
|
|||||||
|
|
||||||
# Format stashed.
|
# Format stashed.
|
||||||
zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
|
zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
|
||||||
if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then
|
if [[ -n "$stashed_format" ]]; then
|
||||||
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
commondir=""
|
||||||
|
if [[ -f "$(git-dir)/commondir" ]]; then
|
||||||
|
commondir="$(<$(git-dir)/commondir)"
|
||||||
|
[[ "$commondir" =~ ^/ ]] || commondir="$(git-dir)/$commondir"
|
||||||
|
fi
|
||||||
|
if [[ -f "$(git-dir)/refs/stash" || ( -n "$commondir" && -f "$commondir/refs/stash" ) ]]; then
|
||||||
|
stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
||||||
if [[ -n "$stashed" ]]; then
|
if [[ -n "$stashed" ]]; then
|
||||||
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
|
zformat -f stashed_formatted "$stashed_format" "S:$stashed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Format action.
|
# Format action.
|
||||||
zstyle -s ':prezto:module:git:info:action' format 'action_format'
|
zstyle -s ':prezto:module:git:info:action' format 'action_format'
|
||||||
@ -229,7 +236,7 @@ function git-info {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the branch.
|
# Get the branch.
|
||||||
branch="${$(git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
|
branch="${$(command git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
|
||||||
|
|
||||||
# Format branch.
|
# Format branch.
|
||||||
zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
|
zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
|
||||||
@ -240,7 +247,7 @@ function git-info {
|
|||||||
# Format position.
|
# Format position.
|
||||||
zstyle -s ':prezto:module:git:info:position' format 'position_format'
|
zstyle -s ':prezto:module:git:info:position' format 'position_format'
|
||||||
if [[ -z "$branch" && -n "$position_format" ]]; then
|
if [[ -z "$branch" && -n "$position_format" ]]; then
|
||||||
position="$(git describe --contains --all HEAD 2> /dev/null)"
|
position="$(command git describe --contains --all HEAD 2> /dev/null)"
|
||||||
if [[ -n "$position" ]]; then
|
if [[ -n "$position" ]]; then
|
||||||
zformat -f position_formatted "$position_format" "p:$position"
|
zformat -f position_formatted "$position_format" "p:$position"
|
||||||
fi
|
fi
|
||||||
@ -250,7 +257,7 @@ function git-info {
|
|||||||
zstyle -s ':prezto:module:git:info:remote' format 'remote_format'
|
zstyle -s ':prezto:module:git:info:remote' format 'remote_format'
|
||||||
if [[ -n "$branch" && -n "$remote_format" ]]; then
|
if [[ -n "$branch" && -n "$remote_format" ]]; then
|
||||||
# Gets the remote name.
|
# Gets the remote name.
|
||||||
remote_cmd='git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
|
remote_cmd='command git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
|
||||||
remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
|
remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
|
||||||
if [[ -n "$remote" ]]; then
|
if [[ -n "$remote" ]]; then
|
||||||
zformat -f remote_formatted "$remote_format" "R:$remote"
|
zformat -f remote_formatted "$remote_format" "R:$remote"
|
||||||
@ -261,14 +268,14 @@ function git-info {
|
|||||||
zstyle -s ':prezto:module:git:info:behind' format 'behind_format'
|
zstyle -s ':prezto:module:git:info:behind' format 'behind_format'
|
||||||
if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then
|
if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then
|
||||||
# Gets the commit difference counts between local and remote.
|
# Gets the commit difference counts between local and remote.
|
||||||
ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}'
|
ahead_and_behind_cmd='command git rev-list --count --left-right HEAD...@{upstream}'
|
||||||
|
|
||||||
# Get ahead and behind counts.
|
# Get ahead and behind counts.
|
||||||
ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)"
|
ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)"
|
||||||
|
|
||||||
# Format ahead.
|
# Format ahead.
|
||||||
if [[ -n "$ahead_format" ]]; then
|
if [[ -n "$ahead_format" ]]; then
|
||||||
ahead="$ahead_and_behind[(w)1]"
|
ahead="$ahead_and_behind[(pws:\t:)1]"
|
||||||
if (( ahead > 0 )); then
|
if (( ahead > 0 )); then
|
||||||
zformat -f ahead_formatted "$ahead_format" "A:$ahead"
|
zformat -f ahead_formatted "$ahead_format" "A:$ahead"
|
||||||
fi
|
fi
|
||||||
@ -276,7 +283,7 @@ function git-info {
|
|||||||
|
|
||||||
# Format behind.
|
# Format behind.
|
||||||
if [[ -n "$behind_format" ]]; then
|
if [[ -n "$behind_format" ]]; then
|
||||||
behind="$ahead_and_behind[(w)2]"
|
behind="$ahead_and_behind[(pws:\t:)2]"
|
||||||
if (( behind > 0 )); then
|
if (( behind > 0 )); then
|
||||||
zformat -f behind_formatted "$behind_format" "B:$behind"
|
zformat -f behind_formatted "$behind_format" "B:$behind"
|
||||||
fi
|
fi
|
||||||
@ -290,7 +297,7 @@ function git-info {
|
|||||||
if [[ -n "$indexed_format" ]]; then
|
if [[ -n "$indexed_format" ]]; then
|
||||||
((
|
((
|
||||||
indexed+=$(
|
indexed+=$(
|
||||||
git diff-index \
|
command git diff-index \
|
||||||
--no-ext-diff \
|
--no-ext-diff \
|
||||||
--name-only \
|
--name-only \
|
||||||
--cached \
|
--cached \
|
||||||
@ -310,7 +317,7 @@ function git-info {
|
|||||||
if [[ -n "$unindexed_format" ]]; then
|
if [[ -n "$unindexed_format" ]]; then
|
||||||
((
|
((
|
||||||
unindexed+=$(
|
unindexed+=$(
|
||||||
git diff-files \
|
command git diff-files \
|
||||||
--no-ext-diff \
|
--no-ext-diff \
|
||||||
--name-only \
|
--name-only \
|
||||||
--ignore-submodules=${ignore_submodules:-none} \
|
--ignore-submodules=${ignore_submodules:-none} \
|
||||||
@ -328,7 +335,7 @@ function git-info {
|
|||||||
if [[ -n "$untracked_format" ]]; then
|
if [[ -n "$untracked_format" ]]; then
|
||||||
((
|
((
|
||||||
untracked+=$(
|
untracked+=$(
|
||||||
git ls-files \
|
command git ls-files \
|
||||||
--other \
|
--other \
|
||||||
--exclude-standard \
|
--exclude-standard \
|
||||||
2> /dev/null \
|
2> /dev/null \
|
||||||
@ -343,7 +350,7 @@ function git-info {
|
|||||||
(( dirty = indexed + unindexed + untracked ))
|
(( dirty = indexed + unindexed + untracked ))
|
||||||
else
|
else
|
||||||
# Use porcelain status for easy parsing.
|
# Use porcelain status for easy parsing.
|
||||||
status_cmd="git status --porcelain --ignore-submodules=${ignore_submodules:-none}"
|
status_cmd="command git status --porcelain --ignore-submodules=${ignore_submodules:-none}"
|
||||||
|
|
||||||
# Get current status.
|
# Get current status.
|
||||||
while IFS=$'\n' read line; do
|
while IFS=$'\n' read line; do
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# function git-root {
|
# function git-root {
|
||||||
|
|
||||||
local root="$(git rev-parse --show-toplevel 2> /dev/null)"
|
local root="$(command git rev-parse --show-toplevel 2> /dev/null)"
|
||||||
|
|
||||||
if [[ -n "$root" ]]; then
|
if [[ -n "$root" ]]; then
|
||||||
print "$root"
|
print "$root"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# function git-stash-clear-interactive {
|
# function git-stash-clear-interactive {
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
print "$0: not a repository work tree: $PWD" >&2
|
print "$0: not a repository work tree: $PWD" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -15,10 +15,10 @@ fi
|
|||||||
local stashed
|
local stashed
|
||||||
|
|
||||||
if [[ -f "$(git-dir)/refs/stash" ]]; then
|
if [[ -f "$(git-dir)/refs/stash" ]]; then
|
||||||
stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
|
||||||
if (( $stashed > 0 )); then
|
if (( $stashed > 0 )); then
|
||||||
if read -q "?Clear $stashed stashed state(s) [y/N]? "; then
|
if read -q "?Clear $stashed stashed state(s) [y/N]? "; then
|
||||||
git stash clear
|
command git stash clear
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
# function git-stash-dropped {
|
# function git-stash-dropped {
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
print "$0: not a repository work tree: $PWD" >&2
|
print "$0: not a repository work tree: $PWD" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git fsck --unreachable 2> /dev/null \
|
command git fsck --unreachable 2> /dev/null \
|
||||||
| grep 'commit' \
|
| grep 'commit' \
|
||||||
| awk '{print $3}' \
|
| awk '{print $3}' \
|
||||||
| git log \
|
| command git log \
|
||||||
--pretty=format:${_git_log_oneline_format} \
|
--pretty=format:${_git_log_oneline_format} \
|
||||||
--extended-regexp \
|
--extended-regexp \
|
||||||
--grep="${1:-(WIP )?[Oo]n [^:]+:}" \
|
--grep="${1:-(WIP )?[Oo]n [^:]+:}" \
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# function git-stash-recover {
|
# function git-stash-recover {
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
print "$0: not a repository work tree: $PWD" >&2
|
print "$0: not a repository work tree: $PWD" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -15,8 +15,8 @@ fi
|
|||||||
local commit
|
local commit
|
||||||
|
|
||||||
for commit in "$@"; do
|
for commit in "$@"; do
|
||||||
git update-ref \
|
command git update-ref \
|
||||||
-m "$(git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit"
|
-m "$(command git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit"
|
||||||
done
|
done
|
||||||
|
|
||||||
# }
|
# }
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
# function git-submodule-move {
|
# function git-submodule-move {
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
print "$0: not a repository work tree: $PWD" >&2
|
print "$0: not a repository work tree: $PWD" >&2
|
||||||
return 1
|
return 1
|
||||||
elif [[ "$PWD" != "$(git-root)" ]]; then
|
elif [[ "$PWD" != "$(git-root)" ]]; then
|
||||||
@ -19,7 +19,7 @@ local src="$1"
|
|||||||
local dst="$2"
|
local dst="$2"
|
||||||
local url
|
local url
|
||||||
|
|
||||||
url="$(git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")"
|
url="$(command git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")"
|
||||||
|
|
||||||
if [[ -z "$url" ]]; then
|
if [[ -z "$url" ]]; then
|
||||||
print "$0: submodule not found: $src" >&2
|
print "$0: submodule not found: $src" >&2
|
||||||
@ -29,7 +29,7 @@ fi
|
|||||||
mkdir -p "${dst:h}"
|
mkdir -p "${dst:h}"
|
||||||
|
|
||||||
git-submodule-remove "$src"
|
git-submodule-remove "$src"
|
||||||
git submodule add "$url" "$dst"
|
command git submodule add "$url" "$dst"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -7,22 +7,22 @@
|
|||||||
|
|
||||||
# function git-submodule-remove {
|
# function git-submodule-remove {
|
||||||
|
|
||||||
if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
|
||||||
print "$0: not a repository work tree: $PWD" >&2
|
print "$0: not a repository work tree: $PWD" >&2
|
||||||
return 1
|
return 1
|
||||||
elif [[ "$PWD" != "$(git-root)" ]]; then
|
elif [[ "$PWD" != "$(git-root)" ]]; then
|
||||||
print "$0: must be run from the root of the work tree" >&2
|
print "$0: must be run from the root of the work tree" >&2
|
||||||
return 1
|
return 1
|
||||||
elif ! git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then
|
elif ! command git config --file .gitmodules --get "submodule.${1}.path" &> /dev/null; then
|
||||||
print "$0: submodule not found: $1" >&2
|
print "$0: submodule not found: $1" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git config --file "$(git-dir)/config" --remove-section "submodule.${1}" &>/dev/null
|
command git config --file "$(git-dir)/config" --remove-section "submodule.${1}" &> /dev/null
|
||||||
git config --file "$(git-root)/.gitmodules" --remove-section "submodule.${1}" &>/dev/null
|
command git config --file "$(git-root)/.gitmodules" --remove-section "submodule.${1}" &> /dev/null
|
||||||
git add .gitmodules
|
command git add .gitmodules
|
||||||
|
|
||||||
git rm --cached -rf "${1}"
|
command git rm --cached -rf "${1}"
|
||||||
rm -rf "${1}"
|
rm -rf "${1}"
|
||||||
rm -rf "$(git-dir)/modules/${1}"
|
rm -rf "$(git-dir)/modules/${1}"
|
||||||
|
|
||||||
|
@ -15,16 +15,16 @@ fi
|
|||||||
|
|
||||||
_gnu_utility_cmds=(
|
_gnu_utility_cmds=(
|
||||||
# Coreutils
|
# Coreutils
|
||||||
'[' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown'
|
'[' 'b2sum' 'base32' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown'
|
||||||
'chroot' 'cksum' 'comm' 'cp' 'csplit' 'cut' 'date' 'dd' 'df'
|
'chroot' 'cksum' 'comm' 'cp' 'csplit' 'cut' 'date' 'dd' 'df'
|
||||||
'dir' 'dircolors' 'dirname' 'du' 'echo' 'env' 'expand' 'expr'
|
'dir' 'dircolors' 'dirname' 'du' 'echo' 'env' 'expand' 'expr'
|
||||||
'factor' 'false' 'fmt' 'fold' 'groups' 'head' 'hostid' 'id'
|
'factor' 'false' 'fmt' 'fold' 'groups' 'head' 'hostid' 'id'
|
||||||
'install' 'join' 'kill' 'link' 'ln' 'logname' 'ls' 'md5sum'
|
'install' 'join' 'kill' 'link' 'ln' 'logname' 'ls' 'md5sum' 'mkdir'
|
||||||
'mkdir' 'mkfifo' 'mknod' 'mktemp' 'mv' 'nice' 'nl' 'nohup' 'nproc'
|
'mkfifo' 'mknod' 'mktemp' 'mv' 'nice' 'nl' 'nohup' 'nproc'
|
||||||
'od' 'paste' 'pathchk' 'pinee' 'pr' 'printenv' 'printf' 'ptx'
|
'numfmt' 'od' 'paste' 'pathchk' 'pinky' 'pr' 'printenv' 'printf' 'ptx'
|
||||||
'pwd' 'readlink' 'realpath' 'rm' 'rmdir' 'runcon' 'seq' 'sha1sum'
|
'pwd' 'readlink' 'realpath' 'rm' 'rmdir' 'runcon' 'seq' 'sha1sum'
|
||||||
'sha224sum' 'sha256sum' 'sha384sum' 'sha512sum' 'shred' 'shuf'
|
'sha224sum' 'sha256sum' 'sha384sum' 'sha512sum' 'shred' 'shuf'
|
||||||
'sleep' 'sort' 'split' 'stat' 'stty' 'sum' 'sync' 'tac' 'tail'
|
'sleep' 'sort' 'split' 'stat' 'stdbuf' 'stty' 'sum' 'sync' 'tac' 'tail'
|
||||||
'tee' 'test' 'timeout' 'touch' 'tr' 'true' 'truncate' 'tsort'
|
'tee' 'test' 'timeout' 'touch' 'tr' 'true' 'truncate' 'tsort'
|
||||||
'tty' 'uname' 'unexpand' 'uniq' 'unlink' 'uptime' 'users' 'vdir'
|
'tty' 'uname' 'unexpand' 'uniq' 'unlink' 'uptime' 'users' 'vdir'
|
||||||
'wc' 'who' 'whoami' 'yes'
|
'wc' 'who' 'whoami' 'yes'
|
||||||
|
@ -12,7 +12,7 @@ fi
|
|||||||
|
|
||||||
# Set the default paths to gpg-agent files.
|
# Set the default paths to gpg-agent files.
|
||||||
_gpg_agent_conf="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.conf"
|
_gpg_agent_conf="${GNUPGHOME:-$HOME/.gnupg}/gpg-agent.conf"
|
||||||
_gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env.$UID"
|
_gpg_agent_env="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/gpg-agent.env"
|
||||||
|
|
||||||
# Load environment variables from previous run
|
# Load environment variables from previous run
|
||||||
source "$_gpg_agent_env" 2> /dev/null
|
source "$_gpg_agent_env" 2> /dev/null
|
||||||
@ -21,12 +21,13 @@ source "$_gpg_agent_env" 2> /dev/null
|
|||||||
if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then
|
if [[ -z "$GPG_AGENT_INFO" && ! -S "${GNUPGHOME:-$HOME/.gnupg}/S.gpg-agent" ]]; then
|
||||||
# Start gpg-agent if not started.
|
# Start gpg-agent if not started.
|
||||||
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then
|
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${${${(s.:.)GPG_AGENT_INFO}[2]}:--1} gpg-agent"; then
|
||||||
|
mkdir -p "$_gpg_agent_env:h"
|
||||||
eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
|
eval "$(gpg-agent --daemon | tee "$_gpg_agent_env")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Inform gpg-agent of the current TTY for user prompts.
|
# Inform gpg-agent of the current TTY for user prompts.
|
||||||
export GPG_TTY="$(tty)"
|
export GPG_TTY=$TTY
|
||||||
|
|
||||||
# Integrate with the SSH module.
|
# Integrate with the SSH module.
|
||||||
if grep '^enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then
|
if grep '^enable-ssh-support' "$_gpg_agent_conf" &> /dev/null; then
|
||||||
|
@ -10,8 +10,11 @@ if (( ! $+commands[ghc] )); then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Load dependencies.
|
||||||
|
pmodload 'helper'
|
||||||
|
|
||||||
# Prepend Cabal per user directories to PATH.
|
# Prepend Cabal per user directories to PATH.
|
||||||
if [[ "$OSTYPE" == darwin* && -d $HOME/Library/Haskell ]]; then
|
if is-darwin && [[ -d $HOME/Library/Haskell ]]; then
|
||||||
path=($HOME/Library/Haskell/bin(/N) $path)
|
path=($HOME/Library/Haskell/bin(/N) $path)
|
||||||
else
|
else
|
||||||
path=($HOME/.cabal/bin(/N) $path)
|
path=($HOME/.cabal/bin(/N) $path)
|
||||||
|
@ -29,3 +29,28 @@ function coalesce {
|
|||||||
done
|
done
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# is true on MacOS Darwin
|
||||||
|
function is-darwin {
|
||||||
|
[[ "$OSTYPE" == darwin* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# is true on Linux's
|
||||||
|
function is-linux {
|
||||||
|
[[ "$OSTYPE" == linux* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# is true on BSD's
|
||||||
|
function is-bsd {
|
||||||
|
[[ "$OSTYPE" == *bsd* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# is true on Cygwin (Windows)
|
||||||
|
function is-cygwin {
|
||||||
|
[[ "$OSTYPE" == cygwin* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# is true on termux (Android)
|
||||||
|
function is-termux {
|
||||||
|
[[ "$OSTYPE" == linux-android ]]
|
||||||
|
}
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
pmodload 'editor'
|
pmodload 'editor'
|
||||||
|
|
||||||
# Source module files.
|
# Source module files.
|
||||||
|
if (( ! $+functions[history-substring-search-up] )); then
|
||||||
source "${0:h}/external/zsh-history-substring-search.zsh" || return 1
|
source "${0:h}/external/zsh-history-substring-search.zsh" || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Search
|
# Search
|
||||||
|
@ -3,20 +3,18 @@ History
|
|||||||
|
|
||||||
Sets [history][1] options and defines history aliases.
|
Sets [history][1] options and defines history aliases.
|
||||||
|
|
||||||
Variables
|
**Note:** If you are migrating from oh-my-zsh and want to keep your history, you
|
||||||
---------
|
will either need to set HISTFILE manually to `$HOME/.zsh_history` or rename
|
||||||
|
`~/.zsh_history` to ~/.zhistory`.
|
||||||
- `HISTFILE` stores the path to the history file.
|
|
||||||
- `HISTSIZE` stores the maximum number of events to save in the internal history.
|
|
||||||
- `SAVEHIST` stores the maximum number of events to save in the history file.
|
|
||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
|
|
||||||
- `BANG_HIST` treats the **!** character specially during expansion.
|
- `BANG_HIST` treats the **!** character specially during expansion.
|
||||||
- `EXTENDED_HISTORY` writes the history file in the *:start:elapsed;command* format.
|
- `EXTENDED_HISTORY` writes the history file in the *:start:elapsed;command* format.
|
||||||
- `INC_APPEND_HISTORY` writes to the history file immediately, not when the shell exits.
|
- `SHARE_HISTORY` shares history between all sessions. Note that
|
||||||
- `SHARE_HISTORY` shares history between all sessions.
|
`SHARE_HISTORY`, `INC_APPEND_HISTORY`, and `INC_APPEND_HISTORY_TIME` are
|
||||||
|
mutually exclusive.
|
||||||
- `HIST_EXPIRE_DUPS_FIRST` expires a duplicate event first when trimming history.
|
- `HIST_EXPIRE_DUPS_FIRST` expires a duplicate event first when trimming history.
|
||||||
- `HIST_IGNORE_DUPS` does not record an event that was just recorded again.
|
- `HIST_IGNORE_DUPS` does not record an event that was just recorded again.
|
||||||
- `HIST_IGNORE_ALL_DUPS` deletes an old recorded event if a new event is a duplicate.
|
- `HIST_IGNORE_ALL_DUPS` deletes an old recorded event if a new event is a duplicate.
|
||||||
@ -26,6 +24,13 @@ Options
|
|||||||
- `HIST_VERIFY` does not execute immediately upon history expansion.
|
- `HIST_VERIFY` does not execute immediately upon history expansion.
|
||||||
- `HIST_BEEP` beeps when accessing non-existent history.
|
- `HIST_BEEP` beeps when accessing non-existent history.
|
||||||
|
|
||||||
|
Variables
|
||||||
|
---------
|
||||||
|
|
||||||
|
- `HISTFILE` stores the path to the history file.
|
||||||
|
- `HISTSIZE` stores the maximum number of events to save in the internal history.
|
||||||
|
- `SAVEHIST` stores the maximum number of events to save in the history file.
|
||||||
|
|
||||||
Aliases
|
Aliases
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -6,21 +6,12 @@
|
|||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
#
|
|
||||||
# Variables
|
|
||||||
#
|
|
||||||
|
|
||||||
HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file.
|
|
||||||
HISTSIZE=10000 # The maximum number of events to save in the internal history.
|
|
||||||
SAVEHIST=10000 # The maximum number of events to save in the history file.
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Options
|
# Options
|
||||||
#
|
#
|
||||||
|
|
||||||
setopt BANG_HIST # Treat the '!' character specially during expansion.
|
setopt BANG_HIST # Treat the '!' character specially during expansion.
|
||||||
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
||||||
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
|
|
||||||
setopt SHARE_HISTORY # Share history between all sessions.
|
setopt SHARE_HISTORY # Share history between all sessions.
|
||||||
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
||||||
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
|
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
|
||||||
@ -31,6 +22,14 @@ setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history
|
|||||||
setopt HIST_VERIFY # Do not execute immediately upon history expansion.
|
setopt HIST_VERIFY # Do not execute immediately upon history expansion.
|
||||||
setopt HIST_BEEP # Beep when accessing non-existent history.
|
setopt HIST_BEEP # Beep when accessing non-existent history.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Variables
|
||||||
|
#
|
||||||
|
|
||||||
|
HISTFILE="${HISTFILE:-${ZDOTDIR:-$HOME}/.zhistory}" # The path to the history file.
|
||||||
|
HISTSIZE=10000 # The maximum number of events to save in the internal history.
|
||||||
|
SAVEHIST=10000 # The maximum number of events to save in the history file.
|
||||||
|
|
||||||
#
|
#
|
||||||
# Aliases
|
# Aliases
|
||||||
#
|
#
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
Homebrew
|
Homebrew
|
||||||
========
|
========
|
||||||
|
|
||||||
Defines Homebrew aliases.
|
Defines Homebrew specific environment variables and aliases.
|
||||||
|
|
||||||
|
Variables
|
||||||
|
---------
|
||||||
|
|
||||||
|
Execute the following to list the environment variables loaded in the shell:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
brew shellenv
|
||||||
|
```
|
||||||
|
|
||||||
Aliases
|
Aliases
|
||||||
-------
|
-------
|
||||||
@ -9,8 +18,8 @@ Aliases
|
|||||||
### Homebrew
|
### Homebrew
|
||||||
|
|
||||||
- `brewc` cleans outdated brews and their cached archives.
|
- `brewc` cleans outdated brews and their cached archives.
|
||||||
- `brewC` cleans outdated brews, including keg-only, and their cached archives.
|
|
||||||
- `brewi` installs a formula.
|
- `brewi` installs a formula.
|
||||||
|
- `brewL` lists installed formulae that are not dependencies of another installed formula.
|
||||||
- `brewl` lists installed formulae.
|
- `brewl` lists installed formulae.
|
||||||
- `brewo` lists brews which have an update available.
|
- `brewo` lists brews which have an update available.
|
||||||
- `brews` searches for a formula.
|
- `brews` searches for a formula.
|
||||||
@ -20,12 +29,9 @@ Aliases
|
|||||||
### Homebrew Cask
|
### Homebrew Cask
|
||||||
|
|
||||||
- `cask` is aliased to `brew cask`.
|
- `cask` is aliased to `brew cask`.
|
||||||
- `caskc` cleans up old cached downloads.
|
|
||||||
- `caskC` cleans up all cached downloads.
|
|
||||||
- `caski` installs a cask.
|
- `caski` installs a cask.
|
||||||
- `caskl` lists installed casks.
|
- `caskl` lists installed casks.
|
||||||
- `casko` lists casks which have an update available.
|
- `casko` lists casks which have an update available.
|
||||||
- `casks` searches for a cask.
|
|
||||||
- `caskx` uninstalls a cask.
|
- `caskx` uninstalls a cask.
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
|
@ -5,31 +5,55 @@
|
|||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Load dependencies.
|
||||||
|
pmodload 'helper'
|
||||||
|
|
||||||
# Return if requirements are not found.
|
# Return if requirements are not found.
|
||||||
if [[ "$OSTYPE" != (darwin|linux)* ]]; then
|
if ! is-darwin && ! is-linux; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Variables
|
||||||
|
#
|
||||||
|
|
||||||
|
# Load standard Homebrew shellenv into the shell session.
|
||||||
|
# Load 'HOMEBREW_' prefixed variables only. Avoid loading 'PATH' related
|
||||||
|
# variables as they are already handled in standard zsh configuration.
|
||||||
|
if (( $+commands[brew] )); then
|
||||||
|
eval "${(@M)${(f)"$(brew shellenv 2> /dev/null)"}:#export HOMEBREW*}"
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Aliases
|
# Aliases
|
||||||
#
|
#
|
||||||
|
|
||||||
# Homebrew
|
# Homebrew
|
||||||
alias brewc='brew cleanup'
|
alias brewc='brew cleanup'
|
||||||
alias brewC='brew cleanup --force'
|
|
||||||
alias brewi='brew install'
|
alias brewi='brew install'
|
||||||
|
alias brewL='brew leaves'
|
||||||
alias brewl='brew list'
|
alias brewl='brew list'
|
||||||
alias brewo='brew outdated'
|
alias brewo='brew outdated'
|
||||||
alias brews='brew search'
|
alias brews='brew search'
|
||||||
alias brewu='brew update && brew upgrade'
|
alias brewu='brew upgrade'
|
||||||
alias brewx='brew remove'
|
alias brewx='brew uninstall'
|
||||||
|
|
||||||
# Homebrew Cask
|
# Homebrew Cask
|
||||||
alias cask='brew cask'
|
alias cask='brew cask'
|
||||||
alias caskc='brew cask cleanup --outdated'
|
alias caskc='hb_deprecated brew cask cleanup'
|
||||||
alias caskC='brew cask cleanup'
|
alias caskC='hb_deprecated brew cask cleanup'
|
||||||
alias caski='brew cask install'
|
alias caski='brew cask install'
|
||||||
alias caskl='brew cask list'
|
alias caskl='brew cask list'
|
||||||
alias casko='brew cask outdated'
|
alias casko='brew cask outdated'
|
||||||
alias casks='brew cask search'
|
alias casks='hb_deprecated brew cask search'
|
||||||
alias caskx='brew cask uninstall'
|
alias caskx='brew cask uninstall'
|
||||||
|
|
||||||
|
function hb_deprecated {
|
||||||
|
local cmd="${@[3]}"
|
||||||
|
local cmd_args="${@:4}"
|
||||||
|
|
||||||
|
printf "'brew cask %s' has been deprecated, " "${cmd}"
|
||||||
|
printf "using 'brew %s' instead\n" "${cmd}"
|
||||||
|
|
||||||
|
command brew "${cmd}" "${=cmd_args}"
|
||||||
|
}
|
||||||
|
@ -6,8 +6,11 @@
|
|||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Load dependencies.
|
||||||
|
pmodload 'helper'
|
||||||
|
|
||||||
# Return if requirements are not found.
|
# Return if requirements are not found.
|
||||||
if [[ "$OSTYPE" != darwin* ]]; then
|
if ! is-darwin; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@ nvm
|
|||||||
[nvm][5] allows for managing multiple, isolated Node.js installations in the
|
[nvm][5] allows for managing multiple, isolated Node.js installations in the
|
||||||
home directory.
|
home directory.
|
||||||
|
|
||||||
|
This will be loaded automatically if nvm is installed in `$NVM_DIR`,
|
||||||
|
`~/.nvm`, or nvm is installed with homebrew.
|
||||||
|
|
||||||
nodenv
|
nodenv
|
||||||
------
|
------
|
||||||
|
|
||||||
@ -17,6 +20,9 @@ nodenv
|
|||||||
Node versions. It's simple and predictable, Just Works, and is rock solid in
|
Node versions. It's simple and predictable, Just Works, and is rock solid in
|
||||||
production. nodenv is forked from the popular [rbenv][7].
|
production. nodenv is forked from the popular [rbenv][7].
|
||||||
|
|
||||||
|
This will be loaded automatically if nodenv is installed in `$NODENV_ROOT`,
|
||||||
|
`~/.nodenv`, or `nodenv` is on the path.
|
||||||
|
|
||||||
Functions
|
Functions
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
@ -19,9 +19,11 @@ if (( $+functions[nvm_version] )); then
|
|||||||
version="${$(nvm_version)#v}"
|
version="${$(nvm_version)#v}"
|
||||||
elif (( $+commands[nodenv] )); then
|
elif (( $+commands[nodenv] )); then
|
||||||
version="${${$(nodenv version)#v}[(w)0]}"
|
version="${${$(nodenv version)#v}[(w)0]}"
|
||||||
|
elif (( $+commands[node] )) ; then
|
||||||
|
version="${$(node -v)#v}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$version" != (none|) ]]; then
|
if [[ "$version" != (none|system) ]]; then
|
||||||
zstyle -s ':prezto:module:node:info:version' format 'version_format'
|
zstyle -s ':prezto:module:node:info:version' format 'version_format'
|
||||||
zformat -f version_formatted "$version_format" "v:$version"
|
zformat -f version_formatted "$version_format" "v:$version"
|
||||||
node_info[version]="$version_formatted"
|
node_info[version]="$version_formatted"
|
||||||
|
@ -7,16 +7,18 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Load manually installed NVM into the shell session.
|
# Load manually installed NVM into the shell session.
|
||||||
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
|
if [[ -s "${NVM_DIR:=$HOME/.nvm}/nvm.sh" ]]; then
|
||||||
source "$HOME/.nvm/nvm.sh"
|
source "${NVM_DIR}/nvm.sh"
|
||||||
|
|
||||||
# Load package manager installed NVM into the shell session.
|
# Load package manager installed NVM into the shell session.
|
||||||
elif (( $+commands[brew] )) && [[ -d "$(brew --prefix nvm 2> /dev/null)" ]]; then
|
elif (( $+commands[brew] )) && \
|
||||||
|
[[ -d "${nvm_prefix::="$(brew --prefix 2> /dev/null)"/opt/nvm}" ]]; then
|
||||||
source "$(brew --prefix nvm)/nvm.sh"
|
source "$(brew --prefix nvm)/nvm.sh"
|
||||||
|
unset nvm_prefix
|
||||||
|
|
||||||
# Load manually installed nodenv into the shell session.
|
# Load manually installed nodenv into the shell session.
|
||||||
elif [[ -s "$HOME/.nodenv/bin/nodenv" ]]; then
|
elif [[ -s "${NODENV_ROOT:=$HOME/.nodenv}/bin/nodenv" ]]; then
|
||||||
path=("$HOME/.nodenv/bin" $path)
|
path=("${NODENV_ROOT}/bin" $path)
|
||||||
eval "$(nodenv init - --no-rehash zsh)"
|
eval "$(nodenv init - --no-rehash zsh)"
|
||||||
|
|
||||||
# Load package manager installed nodenv into the shell session.
|
# Load package manager installed nodenv into the shell session.
|
||||||
@ -28,16 +30,29 @@ elif (( ! $+commands[node] )); then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load NPM completion.
|
# Load NPM and known helper completions.
|
||||||
if (( $+commands[npm] )); then
|
typeset -A compl_commands=(
|
||||||
cache_file="${TMPDIR:-/tmp}/prezto-node-cache.$UID.zsh"
|
npm 'npm completion'
|
||||||
|
grunt 'grunt --completion=zsh'
|
||||||
|
gulp 'gulp --completion=zsh'
|
||||||
|
)
|
||||||
|
|
||||||
if [[ "$commands[npm]" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
for compl_command in "${(k)compl_commands[@]}"; do
|
||||||
# npm is slow; cache its output.
|
if (( $+commands[$compl_command] )); then
|
||||||
npm completion >! "$cache_file" 2> /dev/null
|
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/$compl_command-cache.zsh"
|
||||||
|
|
||||||
|
# Completion commands are slow; cache their output if old or missing.
|
||||||
|
if [[ "$commands[$compl_command]" -nt "$cache_file" \
|
||||||
|
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|
||||||
|
|| ! -s "$cache_file" ]]; then
|
||||||
|
mkdir -p "$cache_file:h"
|
||||||
|
command ${=compl_commands[$compl_command]} >! "$cache_file" 2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "$cache_file"
|
source "$cache_file"
|
||||||
|
|
||||||
unset cache_file
|
unset cache_file
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
unset compl_command{s,}
|
||||||
|
23
modules/openstack/functions/os-info
Normal file
23
modules/openstack/functions/os-info
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#
|
||||||
|
# Exposes information about the OpenStack environment via the $os_info associative
|
||||||
|
# array.
|
||||||
|
#
|
||||||
|
|
||||||
|
# function os-info {
|
||||||
|
|
||||||
|
local tenant
|
||||||
|
local tenant_format
|
||||||
|
local tenant_formatted
|
||||||
|
|
||||||
|
unset os_info
|
||||||
|
typeset -gA os_info
|
||||||
|
|
||||||
|
[[ -n "${OS_PROJECT_NAME+1}" ]] && tenant="${OS_PROJECT_NAME}"
|
||||||
|
|
||||||
|
if [[ "$tenant" != (none|) ]]; then
|
||||||
|
zstyle -s ':prezto:module:openstack:info:tenant' format 'tenant_format'
|
||||||
|
zformat -f tenant_formatted "$tenant_format" "v:$tenant"
|
||||||
|
os_info[tenant]="$tenant_formatted"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# }
|
@ -1,7 +1,7 @@
|
|||||||
OSX
|
OSX
|
||||||
===
|
===
|
||||||
|
|
||||||
Defines [Mac OS X][1] aliases and functions.
|
Defines [macOS][1] aliases and functions.
|
||||||
|
|
||||||
Settings
|
Settings
|
||||||
--------
|
--------
|
||||||
@ -34,8 +34,8 @@ Functions
|
|||||||
- `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]).
|
- `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]).
|
||||||
- `ql` previews files in Quick Look.
|
- `ql` previews files in Quick Look.
|
||||||
- `osx-rm-dir-metadata` deletes .DS\_Store, \_\_MACOSX cruft.
|
- `osx-rm-dir-metadata` deletes .DS\_Store, \_\_MACOSX cruft.
|
||||||
- `osx-ls-download-history` displays the Mac OS X download history.
|
- `osx-ls-download-history` displays the macOS download history.
|
||||||
- `osx-rm-download-history` deletes the Mac OS X download history.
|
- `osx-rm-download-history` deletes the macOS download history.
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
-------
|
-------
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Displays the Mac OS X download history.
|
# Displays the macOS download history.
|
||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Deletes the Mac OS X download history.
|
# Deletes the macOS download history.
|
||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
#
|
#
|
||||||
# Defines Mac OS X aliases and functions.
|
# Defines macOS aliases and functions.
|
||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Load dependencies.
|
||||||
|
pmodload 'helper'
|
||||||
|
|
||||||
# Return if requirements are not found.
|
# Return if requirements are not found.
|
||||||
if [[ "$OSTYPE" != darwin* ]]; then
|
if ! is-darwin; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
|
|
||||||
# function pacman-list-disowned {
|
# function pacman-list-disowned {
|
||||||
|
|
||||||
local tmp="${TMPDIR:-/tmp}/pacman-disowned-$UID-$$"
|
local tmp="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/pacman-disowned-$$"
|
||||||
local db="$tmp/db"
|
local db="$tmp/db"
|
||||||
local fs="$tmp/fs"
|
local fs="$tmp/fs"
|
||||||
|
|
||||||
mkdir "$tmp"
|
mkdir -p "$tmp"
|
||||||
trap 'rm -rf "$tmp"' EXIT
|
trap 'rm -rf "$tmp"' EXIT
|
||||||
|
|
||||||
pacman --quiet --query --list | sort --unique > "$db"
|
pacman --quiet --query --list | sort --unique > "$db"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
Perl
|
Perl
|
||||||
====
|
====
|
||||||
|
|
||||||
Enables local [Perl][1] module installation on Mac OS X and defines aliases.
|
Enables local [Perl][1] module installation on macOS and defines aliases.
|
||||||
|
|
||||||
Local Module Installation
|
Local Module Installation
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
Perl versions older than 5.14 do not support the local installation of Perl
|
Perl versions older than 5.14 do not support the local installation of Perl
|
||||||
modules natively. This module allows for local installation of Perl modules on
|
modules natively. This module allows for local installation of Perl modules on
|
||||||
Mac OS X in *~/Library/Perl/5.12* by altering the environment.
|
macOS in *~/Library/Perl/5.12* by altering the environment.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Enables local Perl module installation on Mac OS X and defines aliases.
|
# Enables local Perl module installation on macOS and defines aliases.
|
||||||
#
|
#
|
||||||
# Authors:
|
# Authors:
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
@ -10,6 +10,9 @@ if (( ! $+commands[perl] )); then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Load dependencies.
|
||||||
|
pmodload 'helper'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Load Perlbrew or plenv
|
# Load Perlbrew or plenv
|
||||||
#
|
#
|
||||||
@ -37,13 +40,14 @@ fi
|
|||||||
# Local Module Installation
|
# Local Module Installation
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ "$OSTYPE" == darwin* ]]; then
|
if is-darwin; then
|
||||||
# Perl is slow; cache its output.
|
# Perl is slow; cache its output.
|
||||||
cache_file="${TMPDIR:-/tmp}/prezto-perl-cache.$UID.zsh"
|
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/perl-cache.zsh"
|
||||||
perl_path="$HOME/Library/Perl/5.12"
|
perl_path="$HOME/Library/Perl/5.12"
|
||||||
|
|
||||||
if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
|
if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
|
||||||
if [[ ! -s "$cache_file" ]]; then
|
if [[ "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
||||||
|
mkdir -p "$cache_file:h"
|
||||||
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
|
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -43,6 +43,22 @@ A prompt theme is an autoloadable function file with a special name,
|
|||||||
project, themes **should** be placed in the *modules/prompt/functions*
|
project, themes **should** be placed in the *modules/prompt/functions*
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
|
### Required Variables
|
||||||
|
|
||||||
|
To ensure that your function works with the editor-info module you'll need to
|
||||||
|
set the following variable:
|
||||||
|
|
||||||
|
```
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
```
|
||||||
|
|
||||||
|
This is to ensure compatibility with outside prompts, while allowing prezto
|
||||||
|
and prezto-compatible prompts to take full advantage of the editor module.
|
||||||
|
This should be set in the `prompt_name_setup` function after you've added
|
||||||
|
any additional hooks with `add-zsh-hook precmd prompt_name_precmd`. See below
|
||||||
|
for additional information about functions and hooks.
|
||||||
|
|
||||||
### Theme Functions
|
### Theme Functions
|
||||||
|
|
||||||
There are three theme functions, a setup function, a help function, and
|
There are three theme functions, a setup function, a help function, and
|
||||||
|
2
modules/prompt/external/agnoster
vendored
2
modules/prompt/external/agnoster
vendored
Submodule modules/prompt/external/agnoster updated: 3ad94b6599...6bba672c78
2
modules/prompt/external/async
vendored
2
modules/prompt/external/async
vendored
Submodule modules/prompt/external/async updated: b001fa529a...95c2b1577f
1
modules/prompt/external/powerlevel10k
vendored
Submodule
1
modules/prompt/external/powerlevel10k
vendored
Submodule
Submodule modules/prompt/external/powerlevel10k added at d26bdcd601
2
modules/prompt/external/powerlevel9k
vendored
2
modules/prompt/external/powerlevel9k
vendored
Submodule modules/prompt/external/powerlevel9k updated: 17c069d25a...2f4b15041f
2
modules/prompt/external/pure
vendored
2
modules/prompt/external/pure
vendored
Submodule modules/prompt/external/pure updated: a95d55cc7d...2e354b80de
@ -28,3 +28,4 @@ unset current_pwd
|
|||||||
print "$ret_directory"
|
print "$ret_directory"
|
||||||
|
|
||||||
# }
|
# }
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -104,6 +104,9 @@ function prompt_cloud_setup {
|
|||||||
# Add hook for calling git-info before each command.
|
# Add hook for calling git-info before each command.
|
||||||
add-zsh-hook precmd prompt_cloud_precmd
|
add-zsh-hook precmd prompt_cloud_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Set git-info parameters.
|
# Set git-info parameters.
|
||||||
zstyle ':prezto:module:git:info' verbose 'yes'
|
zstyle ':prezto:module:git:info' verbose 'yes'
|
||||||
zstyle ':prezto:module:git:info:dirty' format "%%B%F{$secondary_color}]%f%%b %F{yellow}⚡%f"
|
zstyle ':prezto:module:git:info:dirty' format "%%B%F{$secondary_color}]%f%%b %F{yellow}⚡%f"
|
||||||
@ -119,3 +122,4 @@ function prompt_cloud_setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_cloud_setup "$@"
|
prompt_cloud_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -27,6 +27,11 @@ prompt_damoekri_precmd() {
|
|||||||
if (( $+functions[ruby-info] )); then
|
if (( $+functions[ruby-info] )); then
|
||||||
ruby-info
|
ruby-info
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get Openstack tenant information.
|
||||||
|
if (( $+functions[os-info] )); then
|
||||||
|
os-info
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function prompt_damoekri_setup {
|
function prompt_damoekri_setup {
|
||||||
@ -40,6 +45,9 @@ function prompt_damoekri_setup {
|
|||||||
# Add hook for calling git-info and ruby-info before each command.
|
# Add hook for calling git-info and ruby-info before each command.
|
||||||
add-zsh-hook precmd prompt_damoekri_precmd
|
add-zsh-hook precmd prompt_damoekri_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Set editor-info parameters.
|
# Set editor-info parameters.
|
||||||
zstyle ':prezto:module:editor:info:keymap:primary' format ' %F{green}»%f'
|
zstyle ':prezto:module:editor:info:keymap:primary' format ' %F{green}»%f'
|
||||||
|
|
||||||
@ -57,9 +65,13 @@ function prompt_damoekri_setup {
|
|||||||
# Set ruby-info parameters.
|
# Set ruby-info parameters.
|
||||||
zstyle ':prezto:module:ruby:info:version' format ' %F{yellow}%v%f'
|
zstyle ':prezto:module:ruby:info:version' format ' %F{yellow}%v%f'
|
||||||
|
|
||||||
|
# Set openstack tenant info
|
||||||
|
zstyle ':prezto:module:openstack:info:tenant' format '%s'
|
||||||
|
|
||||||
# Define prompts.
|
# Define prompts.
|
||||||
PROMPT='%F{cyan}${_prompt_damoekri_pwd}%f${editor_info[keymap]} '
|
PROMPT='${os_info:+${os_info[tenant]} }%F{cyan}${_prompt_damoekri_pwd}%f${editor_info[keymap]} '
|
||||||
RPROMPT='${git_info:+${(e)git_info[rprompt]}}${ruby_info:+${ruby_info[version]}}'
|
RPROMPT='${git_info:+${(e)git_info[rprompt]}}${ruby_info:+${ruby_info[version]}}'
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_damoekri_setup "$@"
|
prompt_damoekri_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -47,6 +47,9 @@ function prompt_giddie_setup {
|
|||||||
# Add hook to set up prompt parameters before each command.
|
# Add hook to set up prompt parameters before each command.
|
||||||
add-zsh-hook precmd prompt_giddie_precmd
|
add-zsh-hook precmd prompt_giddie_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Set editor-info parameters.
|
# Set editor-info parameters.
|
||||||
zstyle ':prezto:module:editor:info:completing' format '%F{green}...%f'
|
zstyle ':prezto:module:editor:info:completing' format '%F{green}...%f'
|
||||||
zstyle ':prezto:module:editor:info:keymap:alternate' format '%F{yellow}--- COMMAND ---%f'
|
zstyle ':prezto:module:editor:info:keymap:alternate' format '%F{yellow}--- COMMAND ---%f'
|
||||||
@ -74,3 +77,4 @@ function prompt_giddie_setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_giddie_setup "$@"
|
prompt_giddie_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -40,6 +40,9 @@ function prompt_kylewest_setup {
|
|||||||
# Add hook for calling git-info before each command.
|
# Add hook for calling git-info before each command.
|
||||||
add-zsh-hook precmd prompt_kylewest_precmd
|
add-zsh-hook precmd prompt_kylewest_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Set editor-info parameters.
|
# Set editor-info parameters.
|
||||||
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
|
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
|
||||||
zstyle ':prezto:module:editor:info:keymap:primary' format "%B%F{green}❯%f%b"
|
zstyle ':prezto:module:editor:info:keymap:primary' format "%B%F{green}❯%f%b"
|
||||||
@ -63,3 +66,4 @@ function prompt_kylewest_setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_kylewest_setup "$@"
|
prompt_kylewest_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -32,6 +32,9 @@ function prompt_minimal_setup {
|
|||||||
# Add hook for calling vcs_info before each command.
|
# Add hook for calling vcs_info before each command.
|
||||||
add-zsh-hook precmd prompt_minimal_precmd
|
add-zsh-hook precmd prompt_minimal_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Set vcs_info parameters.
|
# Set vcs_info parameters.
|
||||||
zstyle ':vcs_info:*' enable bzr git hg svn
|
zstyle ':vcs_info:*' enable bzr git hg svn
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
zstyle ':vcs_info:*' check-for-changes true
|
||||||
@ -47,4 +50,14 @@ function prompt_minimal_setup {
|
|||||||
RPROMPT=''
|
RPROMPT=''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prompt_minimal_preview {
|
||||||
|
local +h PROMPT=''
|
||||||
|
local +h RPROMPT=''
|
||||||
|
local +h SPROMPT=''
|
||||||
|
|
||||||
|
editor-info 2> /dev/null
|
||||||
|
prompt_preview_theme 'minimal'
|
||||||
|
}
|
||||||
|
|
||||||
prompt_minimal_setup "$@"
|
prompt_minimal_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -35,6 +35,9 @@ function prompt_nicoulaj_setup {
|
|||||||
# Add hook for calling vcs_info before each command.
|
# Add hook for calling vcs_info before each command.
|
||||||
add-zsh-hook precmd prompt_nicoulaj_precmd
|
add-zsh-hook precmd prompt_nicoulaj_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Customizable parameters.
|
# Customizable parameters.
|
||||||
local max_path_chars=30
|
local max_path_chars=30
|
||||||
local user_char='❯'
|
local user_char='❯'
|
||||||
@ -58,3 +61,4 @@ function prompt_nicoulaj_setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_nicoulaj_setup "$@"
|
prompt_nicoulaj_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -116,6 +116,9 @@ function prompt_paradox_setup {
|
|||||||
add-zsh-hook preexec prompt_paradox_preexec
|
add-zsh-hook preexec prompt_paradox_preexec
|
||||||
add-zsh-hook precmd prompt_paradox_precmd
|
add-zsh-hook precmd prompt_paradox_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Set editor-info parameters.
|
# Set editor-info parameters.
|
||||||
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
|
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
|
||||||
zstyle ':prezto:module:editor:info:keymap:primary' format '%B%F{blue}❯%f%b'
|
zstyle ':prezto:module:editor:info:keymap:primary' format '%B%F{blue}❯%f%b'
|
||||||
@ -154,3 +157,4 @@ ${(e)$(prompt_paradox_build_prompt)}
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_paradox_setup "$@"
|
prompt_paradox_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -34,6 +34,9 @@ function prompt_peepcode_setup {
|
|||||||
# Add a hook for calling info functions before each command.
|
# Add a hook for calling info functions before each command.
|
||||||
add-zsh-hook precmd prompt_peepcode_precmd
|
add-zsh-hook precmd prompt_peepcode_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Set git-info parameters.
|
# Set git-info parameters.
|
||||||
zstyle ':prezto:module:git:info' verbose 'no'
|
zstyle ':prezto:module:git:info' verbose 'no'
|
||||||
zstyle ':prezto:module:git:info:action' format ' +%s'
|
zstyle ':prezto:module:git:info:action' format ' +%s'
|
||||||
@ -83,3 +86,4 @@ function prompt_peepcode_preview {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_peepcode_setup "$@"
|
prompt_peepcode_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
1
modules/prompt/functions/prompt_powerlevel10k_setup
Symbolic link
1
modules/prompt/functions/prompt_powerlevel10k_setup
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../external/powerlevel10k/powerlevel10k.zsh-theme
|
@ -36,6 +36,9 @@ function prompt_skwp_setup {
|
|||||||
# Add hook to set up prompt parameters before each command.
|
# Add hook to set up prompt parameters before each command.
|
||||||
add-zsh-hook precmd prompt_skwp_precmd
|
add-zsh-hook precmd prompt_skwp_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Use extended color pallete if available.
|
# Use extended color pallete if available.
|
||||||
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
|
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
|
||||||
_prompt_skwp_colors=(
|
_prompt_skwp_colors=(
|
||||||
@ -73,3 +76,4 @@ function prompt_skwp_setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_skwp_setup "$@"
|
prompt_skwp_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -36,11 +36,14 @@ function prompt_smiley_precmd {
|
|||||||
|
|
||||||
function prompt_smiley_setup {
|
function prompt_smiley_setup {
|
||||||
unsetopt XTRACE KSH_ARRAYS
|
unsetopt XTRACE KSH_ARRAYS
|
||||||
prompt_opts=(percent subst)
|
prompt_opts=(cr percent sp subst)
|
||||||
|
|
||||||
# Add hook for calling git-info before each command.
|
# Add hook for calling git-info before each command.
|
||||||
add-zsh-hook precmd prompt_smiley_precmd
|
add-zsh-hook precmd prompt_smiley_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Set editor-info parameters.
|
# Set editor-info parameters.
|
||||||
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
|
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
|
||||||
|
|
||||||
@ -63,3 +66,4 @@ function prompt_smiley_setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_smiley_setup "$@"
|
prompt_smiley_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -54,6 +54,13 @@ function prompt_sorin_async_callback {
|
|||||||
zle && zle reset-prompt
|
zle && zle reset-prompt
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
"[async]")
|
||||||
|
# Code is 1 for corrupted worker output and 2 for dead worker.
|
||||||
|
if [[ $2 -eq 2 ]]; then
|
||||||
|
# Our worker died unexpectedly.
|
||||||
|
typeset -g prompt_prezto_async_init=0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,8 +117,6 @@ function prompt_sorin_setup {
|
|||||||
setopt LOCAL_OPTIONS
|
setopt LOCAL_OPTIONS
|
||||||
unsetopt XTRACE KSH_ARRAYS
|
unsetopt XTRACE KSH_ARRAYS
|
||||||
prompt_opts=(cr percent sp subst)
|
prompt_opts=(cr percent sp subst)
|
||||||
_prompt_sorin_precmd_async_pid=0
|
|
||||||
_prompt_sorin_precmd_async_data=$(mktemp "${TMPDIR:-/tmp}/sorin-prompt-async-XXXXXXXXXX")
|
|
||||||
|
|
||||||
# Load required functions.
|
# Load required functions.
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
@ -120,6 +125,9 @@ function prompt_sorin_setup {
|
|||||||
# Add hook for calling git-info before each command.
|
# Add hook for calling git-info before each command.
|
||||||
add-zsh-hook precmd prompt_sorin_precmd
|
add-zsh-hook precmd prompt_sorin_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Set editor-info parameters.
|
# Set editor-info parameters.
|
||||||
zstyle ':prezto:module:editor:info:completing' format '%B%F{7}...%f%b'
|
zstyle ':prezto:module:editor:info:completing' format '%B%F{7}...%f%b'
|
||||||
zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{1}❯%F{3}❯%F{2}❯%f%b'
|
zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{1}❯%F{3}❯%F{2}❯%f%b'
|
||||||
@ -144,16 +152,17 @@ function prompt_sorin_setup {
|
|||||||
zstyle ':prezto:module:git:info:keys' format \
|
zstyle ':prezto:module:git:info:keys' format \
|
||||||
'status' '%b %p %c:%s%A%B%S%a%d%m%r%U%u'
|
'status' '%b %p %c:%s%A%B%S%a%d%m%r%U%u'
|
||||||
|
|
||||||
|
# Set python-info parameters.
|
||||||
|
zstyle ':prezto:module:python:info:virtualenv' format '%f%F{3}(%v)%F{7} '
|
||||||
|
|
||||||
# Set up non-zero return value display
|
# Set up non-zero return value display
|
||||||
local show_return="✘ "
|
local show_return="✘ "
|
||||||
# Default is to show the return value
|
# Default is to show the return value
|
||||||
if zstyle -T ':prezto:module:prompt' show-return-val; then
|
if zstyle -T ':prezto:module:prompt' show-return-val; then
|
||||||
show_return+='%? '
|
show_return+='%? '
|
||||||
fi
|
fi
|
||||||
# Set python-info format
|
|
||||||
zstyle ':prezto:module:python:info:virtualenv' format '%f%F{3}(%v)%F{7} '
|
|
||||||
|
|
||||||
# Get the async worker set up
|
# Get the async worker set up.
|
||||||
_sorin_cur_git_root=''
|
_sorin_cur_git_root=''
|
||||||
|
|
||||||
_prompt_sorin_git=''
|
_prompt_sorin_git=''
|
||||||
@ -177,3 +186,4 @@ function prompt_sorin_preview {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prompt_sorin_setup "$@"
|
prompt_sorin_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
198
modules/prompt/functions/prompt_sorinmod_setup
Normal file
198
modules/prompt/functions/prompt_sorinmod_setup
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
#
|
||||||
|
# A simple theme that displays relevant, contextual information.
|
||||||
|
#
|
||||||
|
# Authors:
|
||||||
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
|
#
|
||||||
|
# Screenshots:
|
||||||
|
# http://i.imgur.com/nrGV6pg.png
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# 16 Terminal Colors
|
||||||
|
# -- ---------------
|
||||||
|
# 0 black
|
||||||
|
# 1 red
|
||||||
|
# 2 green
|
||||||
|
# 3 yellow
|
||||||
|
# 4 blue
|
||||||
|
# 5 magenta
|
||||||
|
# 6 cyan
|
||||||
|
# 7 white
|
||||||
|
# 8 bright black
|
||||||
|
# 9 bright red
|
||||||
|
# 10 bright green
|
||||||
|
# 11 bright yellow
|
||||||
|
# 12 bright blue
|
||||||
|
# 13 bright magenta
|
||||||
|
# 14 bright cyan
|
||||||
|
# 15 bright white
|
||||||
|
#
|
||||||
|
|
||||||
|
# Load dependencies.
|
||||||
|
pmodload 'helper'
|
||||||
|
|
||||||
|
function prompt_sorin_async_callback {
|
||||||
|
case $1 in
|
||||||
|
prompt_sorin_async_git)
|
||||||
|
# We can safely split on ':' because it isn't allowed in ref names.
|
||||||
|
IFS=':' read _git_target _git_post_target <<<"$3"
|
||||||
|
|
||||||
|
# The target actually contains 3 space separated possibilities, so we need to
|
||||||
|
# make sure we grab the first one.
|
||||||
|
_git_target=$(coalesce ${(@)${(z)_git_target}})
|
||||||
|
|
||||||
|
if [[ -z "$_git_target" ]]; then
|
||||||
|
# No git target detected, flush the git fragment and redisplay the prompt.
|
||||||
|
if [[ -n "$_prompt_sorin_git" ]]; then
|
||||||
|
_prompt_sorin_git=''
|
||||||
|
zle && zle reset-prompt
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Git target detected, update the git fragment and redisplay the prompt.
|
||||||
|
_prompt_sorin_git="${_git_target}${_git_post_target}"
|
||||||
|
zle && zle reset-prompt
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
function prompt_sorin_async_git {
|
||||||
|
cd -q "$1"
|
||||||
|
if (( $+functions[git-info] )); then
|
||||||
|
git-info
|
||||||
|
print ${git_info[status]}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function prompt_sorin_async_tasks {
|
||||||
|
# Initialize async worker. This needs to be done here and not in
|
||||||
|
# prompt_sorin_setup so the git formatting can be overridden by other prompts.
|
||||||
|
if (( !${prompt_prezto_async_init:-0} )); then
|
||||||
|
async_start_worker prompt_sorin -n
|
||||||
|
async_register_callback prompt_sorin prompt_sorin_async_callback
|
||||||
|
typeset -g prompt_prezto_async_init=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Kill the old process of slow commands if it is still running.
|
||||||
|
async_flush_jobs prompt_sorin
|
||||||
|
|
||||||
|
# Compute slow commands in the background.
|
||||||
|
async_job prompt_sorin prompt_sorin_async_git "$PWD"
|
||||||
|
}
|
||||||
|
|
||||||
|
function prompt_sorin_precmd {
|
||||||
|
setopt LOCAL_OPTIONS
|
||||||
|
unsetopt XTRACE KSH_ARRAYS
|
||||||
|
|
||||||
|
# Format PWD.
|
||||||
|
_prompt_sorin_pwd=$(prompt-pwd)
|
||||||
|
|
||||||
|
# Handle updating git data. We also clear the git prompt data if we're in a
|
||||||
|
# different git root now.
|
||||||
|
if (( $+functions[git-dir] )); then
|
||||||
|
local new_git_root="$(git-dir 2> /dev/null)"
|
||||||
|
if [[ $new_git_root != $_sorin_cur_git_root ]]; then
|
||||||
|
_prompt_sorin_git=''
|
||||||
|
_sorin_cur_git_root=$new_git_root
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run python info (this should be fast and not require any async)
|
||||||
|
if (( $+functions[python-info] )); then
|
||||||
|
python-info
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get Openstack tenant information.
|
||||||
|
if (( $+functions[os-info] )); then
|
||||||
|
os-info
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get AWS profile information.
|
||||||
|
if (( $+functions[aws-info] )); then
|
||||||
|
aws-info
|
||||||
|
fi
|
||||||
|
|
||||||
|
prompt_sorin_async_tasks
|
||||||
|
}
|
||||||
|
|
||||||
|
function prompt_sorin_setup {
|
||||||
|
setopt LOCAL_OPTIONS
|
||||||
|
unsetopt XTRACE KSH_ARRAYS
|
||||||
|
prompt_opts=(cr percent sp subst)
|
||||||
|
|
||||||
|
# Load required functions.
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
|
autoload -Uz async && async
|
||||||
|
|
||||||
|
# Add hook for calling git-info before each command.
|
||||||
|
add-zsh-hook precmd prompt_sorin_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
|
# Set editor-info parameters.
|
||||||
|
zstyle ':prezto:module:editor:info:completing' format '%B%F{7}...%f%b'
|
||||||
|
# zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{1}❯%F{3}❯%F{2}❯%f%b'
|
||||||
|
zstyle ':prezto:module:editor:info:keymap:primary' format ' %F{green}»%f'
|
||||||
|
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %F{3}♺%f'
|
||||||
|
zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{2}❮%F{3}❮%F{1}❮%f%b'
|
||||||
|
|
||||||
|
# Set git-info parameters.
|
||||||
|
zstyle ':prezto:module:git:info' verbose 'yes'
|
||||||
|
zstyle ':prezto:module:git:info:action' format '%F{7}:%f%%B%F{9}%s%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:added' format ' %%B%F{2}✚%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:ahead' format ' %%B%F{13}⬆%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:behind' format ' %%B%F{13}⬇%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:branch' format ' %%B%F{2}%b%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:commit' format ' %%B%F{3}%.7c%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:deleted' format ' %%B%F{1}✖%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:modified' format ' %%B%F{4}✱%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:position' format ' %%B%F{13}%p%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:renamed' format ' %%B%F{5}➜%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:stashed' format ' %%B%F{6}✭%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{3}═%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:untracked' format ' %%B%F{7}◼%f%%b'
|
||||||
|
zstyle ':prezto:module:git:info:keys' format \
|
||||||
|
'status' '%b %p %c:%s%A%B%S%a%d%m%r%U%u'
|
||||||
|
|
||||||
|
# Set python-info parameters.
|
||||||
|
zstyle ':prezto:module:python:info:virtualenv' format '%f%F{3} %v%F{7} '
|
||||||
|
|
||||||
|
# Set os-info parameters
|
||||||
|
zstyle ':prezto:module:openstack:info:tenant' format '%f%F{3}[%v]%F{7}'
|
||||||
|
|
||||||
|
# Set aws-info parameters
|
||||||
|
zstyle ':prezto:module:aws:info:profile' format '%f%F{4} %v%F{7}'
|
||||||
|
|
||||||
|
# Set up non-zero return value display
|
||||||
|
local show_return="✘ "
|
||||||
|
# Default is to show the return value
|
||||||
|
if zstyle -T ':prezto:module:prompt' show-return-val; then
|
||||||
|
show_return+='%? '
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the async worker set up.
|
||||||
|
_sorin_cur_git_root=''
|
||||||
|
|
||||||
|
_prompt_sorin_git=''
|
||||||
|
_prompt_sorin_pwd=''
|
||||||
|
|
||||||
|
# Define prompts.
|
||||||
|
PROMPT='${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{4}${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)${editor_info[keymap]} '
|
||||||
|
RPROMPT='${os_info:+${os_info[tenant]} }${aws_info:+${aws_info[profile]} }$python_info[virtualenv]${editor_info[overwrite]}%(?:: %F{1}'
|
||||||
|
RPROMPT+=${show_return}
|
||||||
|
RPROMPT+='%f)${VIM:+" %B%F{6}V%f%b"}${_prompt_sorin_git}'
|
||||||
|
SPROMPT='zsh: correct %F{1}%R%f to %F{2}%r%f [nyae]? '
|
||||||
|
}
|
||||||
|
|
||||||
|
function prompt_sorin_preview {
|
||||||
|
local +h PROMPT=''
|
||||||
|
local +h RPROMPT=''
|
||||||
|
local +h SPROMPT=''
|
||||||
|
|
||||||
|
editor-info 2> /dev/null
|
||||||
|
prompt_preview_theme 'sorin'
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt_sorin_setup "$@"
|
@ -41,6 +41,9 @@ function prompt_steeef_setup {
|
|||||||
# Add hook for calling vcs_info before each command.
|
# Add hook for calling vcs_info before each command.
|
||||||
add-zsh-hook precmd prompt_steeef_precmd
|
add-zsh-hook precmd prompt_steeef_precmd
|
||||||
|
|
||||||
|
# Tell prezto we can manage this prompt
|
||||||
|
zstyle ':prezto:module:prompt' managed 'yes'
|
||||||
|
|
||||||
# Use extended color pallete if available.
|
# Use extended color pallete if available.
|
||||||
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
|
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
|
||||||
_prompt_steeef_colors=(
|
_prompt_steeef_colors=(
|
||||||
@ -72,6 +75,9 @@ function prompt_steeef_setup {
|
|||||||
local unstaged_format="${_prompt_steeef_colors[2]}●%f"
|
local unstaged_format="${_prompt_steeef_colors[2]}●%f"
|
||||||
local staged_format="${_prompt_steeef_colors[5]}●%f"
|
local staged_format="${_prompt_steeef_colors[5]}●%f"
|
||||||
|
|
||||||
|
# Set editor-info parameters.
|
||||||
|
zstyle ':prezto:module:editor:info:keymap:primary' format '$'
|
||||||
|
|
||||||
# Set vcs_info parameters.
|
# Set vcs_info parameters.
|
||||||
zstyle ':vcs_info:*' enable bzr git hg svn
|
zstyle ':vcs_info:*' enable bzr git hg svn
|
||||||
zstyle ':vcs_info:*:prompt:*' check-for-changes true
|
zstyle ':vcs_info:*:prompt:*' check-for-changes true
|
||||||
@ -87,8 +93,18 @@ function prompt_steeef_setup {
|
|||||||
# Define prompts.
|
# Define prompts.
|
||||||
PROMPT="
|
PROMPT="
|
||||||
${_prompt_steeef_colors[3]}%n%f at ${_prompt_steeef_colors[2]}%m%f in ${_prompt_steeef_colors[5]}%~%f "'${vcs_info_msg_0_}'"
|
${_prompt_steeef_colors[3]}%n%f at ${_prompt_steeef_colors[2]}%m%f in ${_prompt_steeef_colors[5]}%~%f "'${vcs_info_msg_0_}'"
|
||||||
"'$python_info[virtualenv]'"$ "
|
"'$python_info[virtualenv]${editor_info[keymap]} '
|
||||||
RPROMPT=''
|
RPROMPT=''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prompt_steeef_preview {
|
||||||
|
local +h PROMPT=''
|
||||||
|
local +h RPROMPT=''
|
||||||
|
local +h SPROMPT=''
|
||||||
|
|
||||||
|
editor-info 2> /dev/null
|
||||||
|
prompt_preview_theme 'steeef'
|
||||||
|
}
|
||||||
|
|
||||||
prompt_steeef_setup "$@"
|
prompt_steeef_setup "$@"
|
||||||
|
# vim: ft=zsh
|
||||||
|
@ -6,7 +6,9 @@ Enables local Python and local Python package installation.
|
|||||||
Settings
|
Settings
|
||||||
--------
|
--------
|
||||||
|
|
||||||
This module supports virtual environments from conda and virtualenvwrapper. By default, only virtualenvwrapper is enabled. To disable virtualenvwrapper, add the following to *zpreztorc*.
|
This module supports virtual environments from conda and virtualenvwrapper. By
|
||||||
|
default, only virtualenvwrapper is enabled. To disable virtualenvwrapper, add
|
||||||
|
the following to *zpreztorc*.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on'
|
zstyle ':prezto:module:python' skip-virtualenvwrapper-init 'on'
|
||||||
@ -33,6 +35,9 @@ execution of `pyenv`.
|
|||||||
|
|
||||||
Install Python versions with `pyenv install` into `~/.pyenv/versions`.
|
Install Python versions with `pyenv install` into `~/.pyenv/versions`.
|
||||||
|
|
||||||
|
This will be loaded automatically if pyenv is installed to `$PYENV_ROOT`,
|
||||||
|
`~/.pyenv`, or if the `pyenv` command is on the path.
|
||||||
|
|
||||||
Local Package Installation
|
Local Package Installation
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
@ -52,8 +57,8 @@ virtualenvwrapper
|
|||||||
|
|
||||||
[`virtualenvwrapper`][2] is a frontend to the popular [`virtualenv`][3] utility.
|
[`virtualenvwrapper`][2] is a frontend to the popular [`virtualenv`][3] utility.
|
||||||
|
|
||||||
`virtualenv` creates isolated Python environments and `virtualenvwrapper` provides
|
`virtualenv` creates isolated Python environments and `virtualenvwrapper`
|
||||||
convenient shell functions to create, switch, and manage them.
|
provides convenient shell functions to create, switch, and manage them.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
|
@ -7,24 +7,25 @@
|
|||||||
# Patrick Bos <egpbos@gmail.com>
|
# Patrick Bos <egpbos@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
# Load manually installed pyenv into the shell session.
|
# Load dependencies
|
||||||
if [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then
|
pmodload 'helper'
|
||||||
path=("$HOME/.pyenv/bin" $path)
|
|
||||||
export PYENV_ROOT=$(pyenv root)
|
|
||||||
eval "$(pyenv init -)"
|
|
||||||
|
|
||||||
# Load package manager installed pyenv into the shell session.
|
# Load manually installed pyenv into the path
|
||||||
|
if [[ -s "${PYENV_ROOT:=$HOME/.pyenv}/bin/pyenv" ]]; then
|
||||||
|
path=("${PYENV_ROOT}/bin" $path)
|
||||||
|
eval "$(pyenv init - --no-rehash zsh)"
|
||||||
|
|
||||||
|
# Load pyenv into the current python session
|
||||||
elif (( $+commands[pyenv] )); then
|
elif (( $+commands[pyenv] )); then
|
||||||
export PYENV_ROOT=$(pyenv root)
|
eval "$(pyenv init - --no-rehash zsh)"
|
||||||
eval "$(pyenv init -)"
|
|
||||||
|
|
||||||
# Prepend PEP 370 per user site packages directory, which defaults to
|
# Prepend PEP 370 per user site packages directory, which defaults to
|
||||||
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH. The
|
# ~/Library/Python on macOS and ~/.local elsewhere, to PATH. The
|
||||||
# path can be overridden using PYTHONUSERBASE.
|
# path can be overridden using PYTHONUSERBASE.
|
||||||
else
|
else
|
||||||
if [[ -n "$PYTHONUSERBASE" ]]; then
|
if [[ -n "$PYTHONUSERBASE" ]]; then
|
||||||
path=($PYTHONUSERBASE/bin $path)
|
path=($PYTHONUSERBASE/bin $path)
|
||||||
elif [[ "$OSTYPE" == darwin* ]]; then
|
elif is-darwin; then
|
||||||
path=($HOME/Library/Python/*/bin(N) $path)
|
path=($HOME/Library/Python/*/bin(N) $path)
|
||||||
else
|
else
|
||||||
# This is subject to change.
|
# This is subject to change.
|
||||||
@ -70,7 +71,7 @@ function _python-workon-cwd {
|
|||||||
if [[ "$ENV_NAME" != "" ]]; then
|
if [[ "$ENV_NAME" != "" ]]; then
|
||||||
# Activate the environment only if it is not already active
|
# Activate the environment only if it is not already active
|
||||||
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
|
if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
|
||||||
if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
|
if [[ -n "$WORKON_HOME" && -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
|
||||||
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
|
workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
|
||||||
elif [[ -e "$ENV_NAME/bin/activate" ]]; then
|
elif [[ -e "$ENV_NAME/bin/activate" ]]; then
|
||||||
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
|
source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
|
||||||
@ -82,6 +83,7 @@ function _python-workon-cwd {
|
|||||||
# Load auto workon cwd hook
|
# Load auto workon cwd hook
|
||||||
if zstyle -t ':prezto:module:python:virtualenv' auto-switch 'yes'; then
|
if zstyle -t ':prezto:module:python:virtualenv' auto-switch 'yes'; then
|
||||||
# Auto workon when changing directory
|
# Auto workon when changing directory
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
add-zsh-hook chpwd _python-workon-cwd
|
add-zsh-hook chpwd _python-workon-cwd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -92,8 +94,11 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
|
|||||||
# Set the directory where virtual environments are stored.
|
# Set the directory where virtual environments are stored.
|
||||||
export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}"
|
export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}"
|
||||||
|
|
||||||
# Disable the virtualenv prompt.
|
# Disable the virtualenv prompt. Note that we use the magic value used by the
|
||||||
VIRTUAL_ENV_DISABLE_PROMPT=1
|
# pure prompt because there's some additional logic in that prompt which tries
|
||||||
|
# to figure out if a user set this variable and disable the python portion of
|
||||||
|
# that prompt based on it which is the exact opposite of what we want to do.
|
||||||
|
export VIRTUAL_ENV_DISABLE_PROMPT=12
|
||||||
|
|
||||||
# Create a sorted array of available virtualenv related 'pyenv' commands to
|
# Create a sorted array of available virtualenv related 'pyenv' commands to
|
||||||
# look for plugins of interest. Scanning shell '$path' isn't enough as they
|
# look for plugins of interest. Scanning shell '$path' isn't enough as they
|
||||||
@ -105,7 +110,7 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
|
|||||||
|
|
||||||
if (( $pyenv_plugins[(i)virtualenv-init] <= $#pyenv_plugins )); then
|
if (( $pyenv_plugins[(i)virtualenv-init] <= $#pyenv_plugins )); then
|
||||||
# Enable 'virtualenv' with 'pyenv'.
|
# Enable 'virtualenv' with 'pyenv'.
|
||||||
eval "$(pyenv virtualenv-init -)"
|
eval "$(pyenv virtualenv-init - zsh)"
|
||||||
|
|
||||||
# Optionally activate 'virtualenvwrapper' plugin when available.
|
# Optionally activate 'virtualenvwrapper' plugin when available.
|
||||||
if (( $pyenv_plugins[(i)virtualenvwrapper(_lazy|)] <= $#pyenv_plugins )); then
|
if (( $pyenv_plugins[(i)virtualenvwrapper(_lazy|)] <= $#pyenv_plugins )); then
|
||||||
@ -142,21 +147,35 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Load PIP completion.
|
# Load PIP completion.
|
||||||
if (( $#commands[(i)pip(|[23])] )); then
|
|
||||||
cache_file="${TMPDIR:-/tmp}/prezto-python-cache.$UID.zsh"
|
|
||||||
|
|
||||||
# Detect and use one available from among 'pip', 'pip2', 'pip3' variants
|
# Detect and use one available from among 'pip', 'pip2', 'pip3' variants
|
||||||
|
if [[ -n "$PYENV_ROOT" ]]; then
|
||||||
|
for pip in pip{,2,3}; do
|
||||||
|
pip_command="$(pyenv which "$pip" 2>/dev/null)"
|
||||||
|
[[ -n "$pip_command" ]] && break
|
||||||
|
done
|
||||||
|
unset pip
|
||||||
|
else
|
||||||
pip_command="$commands[(i)pip(|[23])]"
|
pip_command="$commands[(i)pip(|[23])]"
|
||||||
|
fi
|
||||||
|
if [[ -n "$pip_command" ]]; then
|
||||||
|
cache_file="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/pip-cache.zsh"
|
||||||
|
|
||||||
if [[ "$pip_command" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
if [[ "$pip_command" -nt "$cache_file" \
|
||||||
|
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|
||||||
|
|| ! -s "$cache_file" ]]; then
|
||||||
|
mkdir -p "$cache_file:h"
|
||||||
# pip is slow; cache its output. And also support 'pip2', 'pip3' variants
|
# pip is slow; cache its output. And also support 'pip2', 'pip3' variants
|
||||||
$pip_command completion --zsh \
|
"$pip_command" completion --zsh \
|
||||||
| sed -e "s|compctl -K [-_[:alnum:]]* pip|& pip2 pip3|" >! "$cache_file" 2> /dev/null
|
| sed -e "s/\(compctl -K [-_[:alnum:]]* pip\).*/\1{,2,3}{,.{0..9}}/" \
|
||||||
|
>! "$cache_file" \
|
||||||
|
2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source "$cache_file"
|
source "$cache_file"
|
||||||
unset cache_file pip_command
|
|
||||||
|
unset cache_file
|
||||||
fi
|
fi
|
||||||
|
unset pip_command
|
||||||
|
|
||||||
# Load conda into the shell session, if requested
|
# Load conda into the shell session, if requested
|
||||||
zstyle -T ':prezto:module:python' conda-init
|
zstyle -T ':prezto:module:python' conda-init
|
||||||
|
@ -3,7 +3,7 @@ Rsync
|
|||||||
|
|
||||||
Defines [rsync][1] aliases.
|
Defines [rsync][1] aliases.
|
||||||
|
|
||||||
Mac OS X users are encouraged to use [Bombich's rsync][2], which has HFS+
|
macOS users are encouraged to use [Bombich's rsync][2], which has HFS+
|
||||||
enhancements.
|
enhancements.
|
||||||
|
|
||||||
Aliases
|
Aliases
|
||||||
|
@ -10,19 +10,23 @@ if (( ! $+commands[rsync] )); then
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Load dependencies.
|
||||||
|
pmodload 'helper'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Aliases
|
# Aliases
|
||||||
#
|
#
|
||||||
|
|
||||||
_rsync_cmd='rsync --verbose --progress --human-readable --compress --archive --hard-links --one-file-system'
|
_rsync_cmd='rsync --verbose --progress --human-readable --compress --archive \
|
||||||
|
--hard-links --one-file-system'
|
||||||
|
|
||||||
if grep -q 'xattrs' <(rsync --help 2>&1); then
|
if grep -q 'xattrs' <(rsync --help 2>&1); then
|
||||||
_rsync_cmd="${_rsync_cmd} --acls --xattrs"
|
_rsync_cmd="${_rsync_cmd} --acls --xattrs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mac OS X and HFS+ Enhancements
|
# macOS and HFS+ Enhancements
|
||||||
# http://help.bombich.com/kb/overview/credits#opensource
|
# https://bombich.com/kb/ccc5/credits
|
||||||
if [[ "$OSTYPE" == darwin* ]] && grep -q 'file-flags' <(rsync --help 2>&1); then
|
if is-darwin && grep -q 'file-flags' <(rsync --help 2>&1); then
|
||||||
_rsync_cmd="${_rsync_cmd} --crtimes --fileflags --protect-decmpfs --force-change"
|
_rsync_cmd="${_rsync_cmd} --crtimes --fileflags --protect-decmpfs --force-change"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ multiple, isolated Ruby installations in the home directory.
|
|||||||
While it is not as feature rich as RVM, it is not loaded into the shell and is
|
While it is not as feature rich as RVM, it is not loaded into the shell and is
|
||||||
not known to cause conflicts with shell scripts.
|
not known to cause conflicts with shell scripts.
|
||||||
|
|
||||||
|
This will be loaded automatically if rbenv is installed to `$RBENV_ROOT`,
|
||||||
|
`~/.rbenv`, or if the `rbenv` command is on the path.
|
||||||
|
|
||||||
chruby
|
chruby
|
||||||
------
|
------
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
|
|||||||
source "$HOME/.rvm/scripts/rvm"
|
source "$HOME/.rvm/scripts/rvm"
|
||||||
|
|
||||||
# Load manually installed rbenv into the shell session.
|
# Load manually installed rbenv into the shell session.
|
||||||
elif [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then
|
elif [[ -s "${RBENV_ROOT:=$HOME/.rbenv}/bin/rbenv" ]]; then
|
||||||
path=("$HOME/.rbenv/bin" $path)
|
path=("${RBENV_ROOT}/bin" $path)
|
||||||
eval "$(rbenv init - --no-rehash zsh)"
|
eval "$(rbenv init - --no-rehash zsh)"
|
||||||
|
|
||||||
# Load package manager installed rbenv into the shell session.
|
# Load package manager installed rbenv into the shell session.
|
||||||
@ -25,9 +25,14 @@ elif (( $+commands[rbenv] )); then
|
|||||||
|
|
||||||
# Load package manager installed chruby into the shell session.
|
# Load package manager installed chruby into the shell session.
|
||||||
elif (( $+commands[chruby-exec] )); then
|
elif (( $+commands[chruby-exec] )); then
|
||||||
|
if (( ! $+functions[chruby] )); then
|
||||||
source "${commands[chruby-exec]:h:h}/share/chruby/chruby.sh"
|
source "${commands[chruby-exec]:h:h}/share/chruby/chruby.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
if zstyle -t ':prezto:module:ruby:chruby' auto-switch; then
|
if zstyle -t ':prezto:module:ruby:chruby' auto-switch; then
|
||||||
|
if (( ! $+functions[chruby_auto] )); then
|
||||||
source "${commands[chruby-exec]:h:h}/share/chruby/auto.sh"
|
source "${commands[chruby-exec]:h:h}/share/chruby/auto.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
# If a default Ruby is set, switch to it.
|
# If a default Ruby is set, switch to it.
|
||||||
chruby_auto
|
chruby_auto
|
||||||
|
@ -14,10 +14,10 @@ fi
|
|||||||
_ssh_dir="$HOME/.ssh"
|
_ssh_dir="$HOME/.ssh"
|
||||||
|
|
||||||
# Set the path to the environment file if not set by another module.
|
# Set the path to the environment file if not set by another module.
|
||||||
_ssh_agent_env="${_ssh_agent_env:-${TMPDIR:-/tmp}/ssh-agent.env.$UID}"
|
_ssh_agent_env="${_ssh_agent_env:-${XDG_CACHE_HOME:-$HOME/.cache}/prezto/ssh-agent.env}"
|
||||||
|
|
||||||
# Set the path to the persistent authentication socket.
|
# Set the path to the persistent authentication socket.
|
||||||
_ssh_agent_sock="${TMPDIR:-/tmp}/ssh-agent.sock.$UID"
|
_ssh_agent_sock="${XDG_CACHE_HOME:-$HOME/.cache}/prezto/ssh-agent.sock"
|
||||||
|
|
||||||
# Start ssh-agent if not started.
|
# Start ssh-agent if not started.
|
||||||
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
|
if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
|
||||||
@ -26,12 +26,14 @@ if [[ ! -S "$SSH_AUTH_SOCK" ]]; then
|
|||||||
|
|
||||||
# Start ssh-agent if not started.
|
# Start ssh-agent if not started.
|
||||||
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
|
if ! ps -U "$LOGNAME" -o pid,ucomm | grep -q -- "${SSH_AGENT_PID:--1} ssh-agent"; then
|
||||||
|
mkdir -p "$_ssh_agent_env:h"
|
||||||
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
|
eval "$(ssh-agent | sed '/^echo /d' | tee "$_ssh_agent_env")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a persistent SSH authentication socket.
|
# Create a persistent SSH authentication socket.
|
||||||
if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then
|
if [[ -S "$SSH_AUTH_SOCK" && "$SSH_AUTH_SOCK" != "$_ssh_agent_sock" ]]; then
|
||||||
|
mkdir -p "$_ssh_agent_sock:h"
|
||||||
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock"
|
ln -sf "$SSH_AUTH_SOCK" "$_ssh_agent_sock"
|
||||||
export SSH_AUTH_SOCK="$_ssh_agent_sock"
|
export SSH_AUTH_SOCK="$_ssh_agent_sock"
|
||||||
fi
|
fi
|
||||||
|
@ -3,9 +3,14 @@ Syntax Highlighting
|
|||||||
|
|
||||||
Integrates [zsh-syntax-highlighting][1] into Prezto.
|
Integrates [zsh-syntax-highlighting][1] into Prezto.
|
||||||
|
|
||||||
This module should be loaded *second to last*, where last is the *prompt*
|
This module should be loaded before the *prompt* module.
|
||||||
module, unless used in conjuncture with the *history-substring-search* module
|
|
||||||
where it must be loaded **before** it.
|
Additionally, if this module is used in conjunction with the
|
||||||
|
*history-substring-search* module, this module must be loaded **before** the
|
||||||
|
*history-substring-search* module.
|
||||||
|
|
||||||
|
To elaborate: The relative order of loading the modules would be
|
||||||
|
'syntax-highlighting', 'history-substring-search' and 'prompt'.
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
------------
|
------------
|
||||||
|
Submodule modules/syntax-highlighting/external updated: 434af7b11d...932e29a0c7
@ -62,7 +62,7 @@ Aliases
|
|||||||
Caveats
|
Caveats
|
||||||
-------
|
-------
|
||||||
|
|
||||||
On Mac OS X, launching tmux can cause the error **launch_msg(...): Socket is not
|
On macOS, launching tmux can cause the error **launch_msg(...): Socket is not
|
||||||
connected** to be displayed, which can be fixed by installing
|
connected** to be displayed, which can be fixed by installing
|
||||||
[reattach-to-user-namespace][3], available in [Homebrew][4], and adding the
|
[reattach-to-user-namespace][3], available in [Homebrew][4], and adding the
|
||||||
following to *tmux.conf*:
|
following to *tmux.conf*:
|
||||||
@ -71,7 +71,7 @@ following to *tmux.conf*:
|
|||||||
set-option -g default-command "reattach-to-user-namespace -l $SHELL -l"
|
set-option -g default-command "reattach-to-user-namespace -l $SHELL -l"
|
||||||
```
|
```
|
||||||
|
|
||||||
Furthermore, tmux is known to cause **kernel panics** on Mac OS X. A discussion
|
Furthermore, tmux is known to cause **kernel panics** on macOS. A discussion
|
||||||
about this and Prezto has already been [opened][2].
|
about this and Prezto has already been [opened][2].
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
|
@ -23,7 +23,7 @@ if ([[ "$TERM_PROGRAM" = 'iTerm.app' ]] && \
|
|||||||
_tmux_iterm_integration='-CC'
|
_tmux_iterm_integration='-CC'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" ]] && ( \
|
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && "$TERM_PROGRAM" != "vscode" ]] && ( \
|
||||||
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) ||
|
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) ||
|
||||||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \
|
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \
|
||||||
); then
|
); then
|
||||||
|
@ -8,8 +8,8 @@ Settings
|
|||||||
|
|
||||||
### Highlighting
|
### Highlighting
|
||||||
|
|
||||||
If you have enabled color globally in *zpreztorc*, you may disable it for certain
|
If you have enabled color globally in *zpreztorc*, you may disable it for
|
||||||
commands.
|
certain commands.
|
||||||
|
|
||||||
To disable `ls` color, add the following line to *zpreztorc*; when coloring is
|
To disable `ls` color, add the following line to *zpreztorc*; when coloring is
|
||||||
disabled, type indicators (\*, /, =>, @, =, |, %) will be appended to entries.
|
disabled, type indicators (\*, /, =>, @, =, |, %) will be appended to entries.
|
||||||
@ -18,6 +18,12 @@ disabled, type indicators (\*, /, =>, @, =, |, %) will be appended to entries.
|
|||||||
zstyle ':prezto:module:utility:ls' color 'no'
|
zstyle ':prezto:module:utility:ls' color 'no'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To disable GNU coreutils `ls` to list directories grouped first, add the following line to *zpreztorc*:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zstyle ':prezto:module:utility:ls' dirs-first 'no'
|
||||||
|
```
|
||||||
|
|
||||||
To disable `diff` highlighting, add the following line to *zpreztorc*:
|
To disable `diff` highlighting, add the following line to *zpreztorc*:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@ -56,6 +62,12 @@ Aliases
|
|||||||
- `mysql`
|
- `mysql`
|
||||||
- `rm`
|
- `rm`
|
||||||
|
|
||||||
|
To disable all spelling corrections, add the following line to *zpreztorc*:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zstyle ':prezto:module:utility' correct 'no'
|
||||||
|
```
|
||||||
|
|
||||||
### Disabled File Globbing
|
### Disabled File Globbing
|
||||||
|
|
||||||
- `bower`
|
- `bower`
|
||||||
@ -109,7 +121,8 @@ Aliases
|
|||||||
|
|
||||||
### Resource Usage
|
### Resource Usage
|
||||||
|
|
||||||
- `df` displays free disk space using human readable units (aliases to `pydf`, if installed).
|
- `df` displays free disk space using human readable units (aliases to `pydf`,
|
||||||
|
if installed).
|
||||||
- `du` displays disk usage using human readable units.
|
- `du` displays disk usage using human readable units.
|
||||||
- `top` displays information about processes.
|
- `top` displays information about processes.
|
||||||
- `topc` displays information about processes sorted by CPU usage.
|
- `topc` displays information about processes sorted by CPU usage.
|
||||||
|
@ -17,7 +17,7 @@ function wdiff {
|
|||||||
"$@" \
|
"$@" \
|
||||||
| sed 's/^\(@@\( [+-][[:digit:]]*,[[:digit:]]*\)\{2\} @@\)$/;5;6m\10m/g'
|
| sed 's/^\(@@\( [+-][[:digit:]]*,[[:digit:]]*\)\{2\} @@\)$/;5;6m\10m/g'
|
||||||
elif (( $+commands[git] )); then
|
elif (( $+commands[git] )); then
|
||||||
git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@"
|
command git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@"
|
||||||
else
|
else
|
||||||
command wdiff "$@"
|
command wdiff "$@"
|
||||||
fi
|
fi
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
pmodload 'helper' 'spectrum'
|
pmodload 'helper' 'spectrum'
|
||||||
|
|
||||||
# Correct commands.
|
# Correct commands.
|
||||||
|
if zstyle -T ':prezto:module:utility' correct; then
|
||||||
setopt CORRECT
|
setopt CORRECT
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Aliases
|
# Aliases
|
||||||
@ -64,23 +66,29 @@ alias mvi="${aliases[mv]:-mv} -i"
|
|||||||
alias cpi="${aliases[cp]:-cp} -i"
|
alias cpi="${aliases[cp]:-cp} -i"
|
||||||
alias lni="${aliases[ln]:-ln} -i"
|
alias lni="${aliases[ln]:-ln} -i"
|
||||||
if zstyle -T ':prezto:module:utility' safe-ops; then
|
if zstyle -T ':prezto:module:utility' safe-ops; then
|
||||||
alias rm='rmi'
|
alias rm="${aliases[rm]:-rm} -i"
|
||||||
alias mv='mvi'
|
alias mv="${aliases[mv]:-mv} -i"
|
||||||
alias cp='cpi'
|
alias cp="${aliases[cp]:-cp} -i"
|
||||||
alias ln='lni'
|
alias ln="${aliases[ln]:-ln} -i"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ls
|
# ls
|
||||||
if is-callable 'dircolors'; then
|
if is-callable 'dircolors'; then
|
||||||
# GNU Core Utilities
|
# GNU Core Utilities
|
||||||
alias ls='ls --group-directories-first'
|
|
||||||
|
if zstyle -T ':prezto:module:utility:ls' dirs-first; then
|
||||||
|
alias ls="${aliases[ls]:-ls} --group-directories-first"
|
||||||
|
fi
|
||||||
|
|
||||||
if zstyle -t ':prezto:module:utility:ls' color; then
|
if zstyle -t ':prezto:module:utility:ls' color; then
|
||||||
|
# Call dircolors to define colors if they're missing
|
||||||
|
if [[ -z "$LS_COLORS" ]]; then
|
||||||
if [[ -s "$HOME/.dir_colors" ]]; then
|
if [[ -s "$HOME/.dir_colors" ]]; then
|
||||||
eval "$(dircolors --sh "$HOME/.dir_colors")"
|
eval "$(dircolors --sh "$HOME/.dir_colors")"
|
||||||
else
|
else
|
||||||
eval "$(dircolors --sh)"
|
eval "$(dircolors --sh)"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
alias ls="${aliases[ls]:-ls} --color=auto"
|
alias ls="${aliases[ls]:-ls} --color=auto"
|
||||||
else
|
else
|
||||||
@ -89,11 +97,15 @@ if is-callable 'dircolors'; then
|
|||||||
else
|
else
|
||||||
# BSD Core Utilities
|
# BSD Core Utilities
|
||||||
if zstyle -t ':prezto:module:utility:ls' color; then
|
if zstyle -t ':prezto:module:utility:ls' color; then
|
||||||
# Define colors for BSD ls.
|
# Define colors for BSD ls if they're not already defined
|
||||||
|
if [[ -z "$LSCOLORS" ]]; then
|
||||||
export LSCOLORS='exfxcxdxbxGxDxabagacad'
|
export LSCOLORS='exfxcxdxbxGxDxabagacad'
|
||||||
|
fi
|
||||||
|
|
||||||
# Define colors for the completion system.
|
# Define colors for the completion system if they're not already defined
|
||||||
|
if [[ -z "$LS_COLORS" ]]; then
|
||||||
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:'
|
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:'
|
||||||
|
fi
|
||||||
|
|
||||||
alias ls="${aliases[ls]:-ls} -G"
|
alias ls="${aliases[ls]:-ls} -G"
|
||||||
else
|
else
|
||||||
@ -121,13 +133,17 @@ if zstyle -t ':prezto:module:utility:grep' color; then
|
|||||||
alias grep="${aliases[grep]:-grep} --color=auto"
|
alias grep="${aliases[grep]:-grep} --color=auto"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Mac OS X Everywhere
|
# macOS Everywhere
|
||||||
if [[ "$OSTYPE" == darwin* ]]; then
|
if is-darwin; then
|
||||||
alias o='open'
|
alias o='open'
|
||||||
elif [[ "$OSTYPE" == cygwin* ]]; then
|
elif is-cygwin; then
|
||||||
alias o='cygstart'
|
alias o='cygstart'
|
||||||
alias pbcopy='tee > /dev/clipboard'
|
alias pbcopy='tee > /dev/clipboard'
|
||||||
alias pbpaste='cat /dev/clipboard'
|
alias pbpaste='cat /dev/clipboard'
|
||||||
|
elif is-termux; then
|
||||||
|
alias o='termux-open'
|
||||||
|
alias pbcopy='termux-clipboard-set'
|
||||||
|
alias pbpaste='termux-clipboard-get'
|
||||||
else
|
else
|
||||||
alias o='xdg-open'
|
alias o='xdg-open'
|
||||||
|
|
||||||
@ -151,15 +167,10 @@ elif (( $+commands[wget] )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Resource Usage
|
# Resource Usage
|
||||||
if (( $+commands[pydf] )); then
|
|
||||||
alias df=pydf
|
|
||||||
else
|
|
||||||
alias df='df -kh'
|
alias df='df -kh'
|
||||||
fi
|
|
||||||
|
|
||||||
alias du='du -kh'
|
alias du='du -kh'
|
||||||
|
|
||||||
if [[ "$OSTYPE" == (darwin*|*bsd*) ]]; then
|
if is-darwin || is-bsd; then
|
||||||
alias topc='top -o cpu'
|
alias topc='top -o cpu'
|
||||||
alias topm='top -o vsize'
|
alias topm='top -o vsize'
|
||||||
else
|
else
|
||||||
|
9
modules/yank/README.md
Normal file
9
modules/yank/README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Yank
|
||||||
|
===
|
||||||
|
|
||||||
|
Defines [yank](https://github.com/mptre/yank) aliases.
|
||||||
|
|
||||||
|
Aliases
|
||||||
|
-------
|
||||||
|
|
||||||
|
See [init.zsh](init.zsh) script.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user