GitHub Pages deploy: fc15f0984b

This commit is contained in:
Sebastian Gniazdowski [Travis CI] 2017-09-26 08:18:18 +00:00
commit a9ab2d0fae
19 changed files with 33973 additions and 0 deletions

87
.gitignore vendored Normal file
View file

@ -0,0 +1,87 @@
tags
TAGS
*.o
*.o.c
*.orig
*.a
*.so
*.dll
*~
.*.sw?
\#*
/zmodules/META-FAQ
/zmodules/config.cache
/zmodules/config.h
/zmodules/config.log
/zmodules/config.modules
/zmodules/config.modules.sh
/zmodules/config.status
/zmodules/config.status.lineno
/zmodules/cscope.out
/zmodules/stamp-h
/zmodules/autom4te.cache
zmodules/Config/defs.mk
CVS
.#*
zmodules/Src/*.epro
zmodules/Src/*.export
zmodules/Src/*.mdh
zmodules/Src/*.mdh.tmp
zmodules/Src/*.mdhi
zmodules/Src/*.mdhs
zmodules/Src/*.syms
zmodules/Src/Makemod.in
zmodules/Src/Makemod
zmodules/Src/[_a-zA-Z0-9]*.pro
zmodules/Src/ansi2knr
zmodules/Src/bltinmods.list
zmodules/Src/cscope.out
zmodules/Src/libzsh.so*
zmodules/Src/modules-bltin
zmodules/Src/modules.index
zmodules/Src/modules.index.tmp
zmodules/Src/modules.stamp
zmodules/Src/patchlevel.h
zmodules/Src/sigcount.h
zmodules/Src/signames.c
zmodules/Src/signames2.c
zmodules/Src/stamp-modobjs
zmodules/Src/stamp-modobjs.tmp
zmodules/Src/tags
zmodules/Src/TAGS
zmodules/Src/version.h
zmodules/Src/zshcurses.h
zmodules/Src/zshpaths.h
zmodules/Src/zshterm.h
zmodules/Src/zshxmods.h
zmodules/Src/zdharma/Makefile.in
zmodules/Src/zdharma/*.export
zmodules/Src/zdharma/so_locations
zmodules/Src/zdharma/*.pro
zmodules/Src/zdharma/*.epro
zmodules/Src/zdharma/*.syms
zmodules/Src/zdharma/*.mdh
zmodules/Src/zdharma/*.mdhi
zmodules/Src/zdharma/*.mdhs
zmodules/Src/zdharma/*.mdh.tmp
zmodules/Src/zdharma/errnames.c
zmodules/Src/zdharma/errcount.h
zmodules/Src/zdharma/curses_keys.h
test
var
*.txt
*.zini
.ycm_extra_conf.py
zmodules/COMPILED_AT
zmodules/Src/*.dSYM
zmodules/Src/zdharma/*.dSYM
zmodules/Test/*.tmp
/.project
zmodules/ValTest/test_type

27
.travis.yml Normal file
View file

@ -0,0 +1,27 @@
language: ruby
dist: trusty
rvm:
- 2.2
install: gem install asciidoctor-pdf --pre
git:
depth: 1
branches:
only:
- master
addons:
apt:
packages:
- zsh
env:
global:
- ENCRYPTION_LABEL: "de1faff15945"
- COMMIT_AUTHOR_EMAIL: "psprint@zdharma.org"
before_script:
- zsh --version
script:
- make
- make -C zsdoc pdf
- share/deploy_doc.sh

22
LICENSE Normal file
View file

@ -0,0 +1,22 @@
This software is licensed under MIT.
MIT License
-----------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

15
Makefile Normal file
View file

@ -0,0 +1,15 @@
all: zplugin.zsh.zwc zplugin-side.zsh.zwc zplugin-install.zsh.zwc zplugin-autoload.zsh.zwc
%.zwc : %
doc/zcompile $<
doc: zplugin.zsh zplugin-side.zsh zplugin-install.zsh zplugin-autoload.zsh
rm -rf zsdoc/data zsdoc/*.adoc
zsd -v --cignore '(\#*FUNCTION:*{{{*|\#[[:space:]]#}}}*)' zplugin.zsh zplugin-side.zsh zplugin-install.zsh zplugin-autoload.zsh
clean:
rm -f zplugin.zsh.zwc zplugin-side.zsh.zwc zplugin-install.zsh.zwc zplugin-autoload.zsh.zwc
rm -rf zsdoc/data
.PHONY: clean
# vim:noet:sts=8:ts=8

416
README.md Normal file
View file

@ -0,0 +1,416 @@
![zplugin logo](https://raw.githubusercontent.com/psprint/zplugin/master/doc/img/zplugin.png)
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D6XDCHDSBDSDG)
# Zplugin
Zplugin gives **reports** from plugin load. Plugins are no longer black boxes,
report will tell what aliases, functions, bindkeys, Zle widgets, zstyles,
completions, variables, `PATH` and `FPATH` elements a plugin has set up. Supported is
**unloading** of plugin and ability to list, uninstall, reinstall and selectively
disable, enable plugin's completions. Also, every plugin is compiled and user
can control this function. The system does not use `$FPATH`, it's kept clean!
Code is immune to `KSH_ARRAYS`, `emulate sh`, `emulate ksh`, thoroughly tested to
support any user setup, be as transparent as plain `source` command. Completion
management functionality is provided to allow user call `compinit` only once in
`.zshrc`.
**NEW**: **[Code documentation](zsdoc)**
# Quick start
To install, execute:
```SystemVerilog
sh -c "$(curl -fsSL https://raw.githubusercontent.com/psprint/zplugin/master/doc/install.sh)"
```
Then add to `~/.zshrc`, at bottom:
```SystemVerilog
zplugin load psprint zsh-navigation-tools
zplugin ice from"notabug" atload"echo loaded zui" if"(( 1 ))"
zplugin load zdharma/zui
zplugin load zsh-users/zsh-autosuggestions
zplugin light zsh-users/zsh-syntax-highlighting
# This one to be ran just once, in interactive session
zplugin creinstall %HOME/my_completions # Handle completions without loading the plugin, see "clist" command
```
(No need to add:
```SystemVerilog
source "$HOME/.zplugin/bin/zplugin.zsh"
```
because the install script does this.)
`ZNT` multi-word searching of history (Ctrl-R), `zui`  textual UI library for Zshell.
The `ice` subcommand  modifiers for following single command. `notabug`  the site `notabug.org`
# News
* 24-09-2017
- **[Code documentation](zsdoc)** for contributors and interested people.
* 20-09-2017
- New feature - **plugin load time statistics**
```SystemVerilog
% zplg times
Plugin loading times:
0.002 sec - psprint/history-search-multi-word
0.005 sec - psprint/zsh-navigation-tools
0.002 sec - rimraf/k
0.020 sec - zdharma/fast-syntax-highlighting
0.005 sec - zsh-users/zsh-autosuggestions
```
* 13-06-2017
- Plugins can now be absolute paths:
```SystemVerilog
% zplg load %HOME/github/{directory}
% zplg load /Users/sgniazdowski/github/{directory}
% zplg load %/Users/sgniazdowski/github/{directory}
```
Completions are not automatically managed, but user can run `zplg creinstall %HOME/github/{directory}`, etc.
* 23-05-2017
- New `ice` modifier: `if`, to which you can provide a conditional expression
```SystemVerilog
% zplg ice if"(( 0 ))"
% zplg snippet --command https://github.com/b4b4r07/httpstat/blob/master/httpstat.sh
% zplg ice if"(( 1 ))"
% zplg snippet --command https://github.com/b4b4r07/httpstat/blob/master/httpstat.sh
Setting up snippet httpstat.sh
Downloading httpstat.sh...
```
* 16-05-2017
- A very slick feature: **adding ice to commands**. Ice is something added and something that
melts. You add modifiers to single next command, and the format (using quotes) guarantees
you will see syntax highlighting in editors:
```SystemVerilog
% zplg ice from"notabug" atload"echo --Loaded--" atclone"echo --Cloned--"
% zplg load zdharma/zui
Downloading zdharma/zui...
...
Checking connectivity... done.
--Cloned--
Compiling zui.plugin.zsh...
--Loaded--
% grep notabug ~/.zplugin/plugins/zdharma---zui/.git/config
url = https://notabug.org/zdharma/zui
```
One other `ice` is `proto`. Use `proto"git"` with Github to be able to use private repositories.
- Completion-management supports completions provided in subdirectory, like in `zsh-users/zsh-completions`
plugin. With `ice` modifier `blockf` (block-fpath), you can manage such completions:
```SystemVerilog
% zplg ice blockf
% zplg load zsh-users/zsh-completions
...
Symlinking completion `_ack' to /Users/sgniazdowski/.zplugin/completions
Forgetting completion `_ack'...
Symlinking completion `_afew' to /Users/sgniazdowski/.zplugin/completions
Forgetting completion `_afew'...
...
Compiling zsh-completions.plugin.zsh...
% echo $fpath
/Users/sgniazdowski/.zplugin/completions /usr/local/share/zsh/site-functions
% zplg cdisable vagrant
Disabled vagrant completion belonging to zsh-users/zsh-completions
Forgetting completion `_vagrant'...
Initializing completion system (compinit)...
```
* 14-05-2017
- The `all`-variants of commands (e.g. `update-all`) have been merged into normal variants (with `--all` switch)
* 13-05-2017
- Bug fixes related to local plugins
- `100` `ms` gain in performance
- When updating plugin a list of new commits is shown
- `lftp` as fallback transport support for snippets
- Snippets support `ftp` and `scp` protocols
- With snippets you can load a file as **command** that is added to PATH:
```SystemVerilog
% zplg snippet --command https://github.com/b4b4r07/httpstat/blob/master/httpstat.sh
% httpstat.sh
too few arguments
```
- Snippets are updated on `update --all` command
# Screencasts
**Dtrace:**
![dtrace](http://imageshack.com/a/img924/2539/eCfnUD.gif)
**Code recognition with recently, changes, glance, report, stress:**
![code recognition](http://imageshack.com/a/img923/6404/5mOUl2.gif)
# Introduction
![zplugin-refcard](http://imageshack.com/a/img924/7014/KKkzny.png)
**Example use:**
```SystemVerilog
% . ~/github/zplugin/zplugin.zsh
% zplugin light zsh-users/zsh-syntax-highlighting
% zplugin load psprint/zsh-cmd-architect
```
**Example plugin report:**
![report example](http://imageshack.com/a/img923/4237/OHC0i5.png)
**Example plugin unload:**
![unload example](http://imageshack.com/a/img921/9896/rMMnQ1.png)
**Example `csearch` invocation (completion management):**
![csearch example](http://imageshack.com/a/img921/5741/QJaO8q.png)
**Example `compile` invocation:**
![compile example](http://imageshack.com/a/img923/6655/gexv8M.png)
**Example `create` invocation:**
![create example](http://imageshack.com/a/img921/8966/NURP24.png)
# Ice Modifiers
Following `ice` modifiers are passed to `zplg ice ...` to obtain described effects.
| Modifier | Description |
|-----------|-------------|
| `from` | Clone from given site (Github is the default), supported are `from"gitlab"`, `..."bitbucket"`, `..."notabug"` (short names: `gh`, `gl`, `bb`, `nb`) |
| `blockf` | Disallow plugin to modify `fpath` |
| `atclone` | Run command after cloning, within plugin's directory, e.g. `zplg ice atclone"echo Cloned"` |
| `atload` | Run command after loading, within plugin's directory |
| `atpull` | Run command after updating, within plugin's directory |
| `if` | Load plugin or snippet when condition is meet, e.g. `zplg ice if'[[ -n "$commands[otool]" ]]'; zplugin load ...` |
| `proto` | Change protocol to `git`,`ftp`,`ftps`,`ssh`, etc. |
# Installation
Execute:
```sh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/psprint/zplugin/master/doc/install.sh)"
```
To update run the command again (or just execute `doc/install.sh`) or run `zplugin self-update`.
`Zplugin` will be installed into `~/.zplugin/bin`. `.zshrc` will be updated with
three lines of code that will be added to the bottom (the lines will be sourcing
`zplugin.zsh` and setting up completion).
Completion will be available, for command **zplugin** and aliases **zpl**, **zplg**.
After installing and reloading shell give `Zplugin` a quick try with `zplugin help`.
## Manual installation
To manually install `Zplugin` clone the repo to e.g. `~/.zplugin/bin`:
```sh
mkdir ~/.zplugin
git clone https://github.com/psprint/zplugin.git ~/.zplugin/bin
```
and source it from `.zshrc` (**above compinit**):
```sh
source ~/.zplugin/bin/zplugin.zsh
```
If you place the `source` below `compinit`, then add those two lines after the `source`:
```sh
autoload -Uz _zplugin
(( ${+_comps} )) && _comps[zplugin]=_zplugin
```
After installing and reloading shell give `Zplugin` a quick try with `zplugin help`.
# Compilation
It's good to compile `zplugin` into `Zsh` bytecode:
```sh
zcompile ~/.zplugin/bin/zplugin.zsh
```
Zplugin will compile each newly downloaded plugin. You can clear compilation of
a plugin by invoking `zplugin uncompile {plugin-spec}`. There are also commands
`compile`, `compiled` that control the functionality of compiling plugins.
# Usage
```
% zpl help
Usage:
-h|--help|help - usage information
man - manual
self-update - updates Zplugin
zstatus - overall Zplugin status
times - statistics on plugin loading times
load {plugin-name} - load plugin, can also receive absolute local path
light {plugin-name} - light plugin load, without reporting (faster)
unload {plugin-name} - unload plugin (needs reporting)
snippet [-f] [--command] {url} - source (or add to PATH with --command) local or remote file (-f: force - don't use cache)
ice <ice specification> - add ICE to next command, argument is e.g. from\"gitlab\"
update {plugin-name} - Git update plugin (or all plugins and snippets if --all passed)
status {plugin-name} - Git status for plugin (or all plugins if --all passed)
report {plugin-name} - show plugin's report (or all plugins' if --all passed)
loaded|list [keyword] - show what plugins are loaded (filter with `keyword')
cd {plugin-name} - cd into plugin's directory (does completion on TAB)
create {plugin-name} - create plugin (also together with Github repository)
edit {plugin-name} - edit plugin's file with $EDITOR
glance {plugin-name} - look at plugin's source (pygmentize, highlight, GNU source-highlight)
stress {plugin-name} - test plugin for compatibility with set of options
changes {plugin-name} - view plugin's git log
recently [time-spec] - show plugins that changed recently, argument is e.g. 1 month 2 days
clist|completions - list completions in use
cdisable {cname} - disable completion `cname'
cenable {cname} - enable completion `cname'
creinstall {plugin-name} - install completions for plugin; can also receive absolute local path
cuninstall {plugin-name} - uninstall completions for plugin
csearch - search all for available completions from any plugin, even unused ones
compinit - reload installed completions
dtrace|dstart - start tracking what's going on in session
dstop - stop tracking what's going on in session
dunload - revert changes recorded between dstart and dstop
dreport - report what was going on in session
dclear - clear report of what was going on in session
compile {plugin-name} - compile plugin (or all plugins if --all passed)
uncompile {plugin-name} - remove compiled version of plugin (or of all plugins if --all passed)
compiled - list plugins that are compiled
```
To use themes created for `Oh-My-Zsh` you might want to first source the `git` library there:
```sh
zplugin snippet 'http://github.com/robbyrussell/oh-my-zsh/raw/master/lib/git.zsh'
```
Then you can use the themes as snippets (`zplugin snippet {file path or Github URL}`).
Some themes require not only
`Oh-My-Zsh's` `git` library, but also `git` plugin (error about function `current_branch` appears).
Source it as snippet directly from `Oh-My-Zsh`:
```sh
zplugin snippet 'https://github.com/robbyrussell/oh-my-zsh/raw/master/plugins/git/git.plugin.zsh'
```
Such lines should be added to `.zshrc`. Snippets are cached locally, use `-f` option to download
a fresh version of a snippet.
Most themes require `promptsubst` option (`setopt promptsubst` in `zshrc`), if it isn't set prompt
will appear as something like: `$(build_prompt)`.
You might want to supress completions provided by the git plugin by issuing `zplugin cdclear -q`
(`-q` is for quiet)  see below **Ignoring Compdefs**.
To summarize:
```SystemVerilog
zplugin snippet 'http://github.com/robbyrussell/oh-my-zsh/raw/master/lib/git.zsh'
zplugin snippet 'https://github.com/robbyrussell/oh-my-zsh/raw/master/plugins/git/git.plugin.zsh'
zplugin cdclear -q # <- forget completions provided up to this moment
setopt promptsubst
# Load theme
zplugin snippet 'https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/dstufft.zsh-theme'
# Load plugin-theme depending on OMZ git library
zplugin light NicoSantangelo/Alpharized
```
# Calling compinit
Compinit should be called after loading of all plugins and before possibly calling `cdreply`.
`Zplugin` takes control over completions, symlinks them to `~/.zplugin/completions` and adds
this directory to `$FPATH`. You manage those completions via commands starting with `c`:
`csearch`, `clist`, `creinstall`, `cuninstall`, `cenable`, `cdisable`.
All this brings order to `$FPATH`, there is only one directory there.
Also, plugins aren't allowed to simply run `compdefs`. You can decide whether to run `compdefs`
by issuing `zplugin cdreplay` (`compdef`-replay). To summarize:
```sh
source ~/.zplugin/bin/zplugin.zsh
zplugin load "some/plugin"
...
zplugin load "other/plugin"
autoload -Uz compinit
compinit
zplugin cdreplay -q # -q is for quiet
```
This allows to call compinit once.
Performance gains are huge, example shell startup time with double `compinit`: **0.980** sec, with
`cdreplay` and single `compinit`: **0.156** sec.
# Ignoring Compdefs
If you want to ignore `compdef`s provided by some plugins or snippets, place their load commands
before commands loading other plugins or snippets, and issue `zplugin cdclear`:
```sh
source ~/.zplugin/bin/zplugin.zsh
zplugin snippet https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git/git.plugin.zsh
zplugin cdclear -q # <- forget completions provided up to this moment
zplugin load "some/plugin"
...
zplugin load "other/plugin"
autoload -Uz compinit
compinit
zplugin cdreplay -q # <- execute compdefs provided by rest of plugins
zplugin cdlist # look at gathered compdefs
```
# Non-Github (local) plugins
Use `create` command with user name `_local` (the default) to create plugin's
skeleton. It will be not connected with Github repository (because of user name
being `_local`). To enter the plugin's directory use `cd` command with just
plugin's name (without `_local`).
The special user name `_local` is optional also for other commands, e.g. for
`load` (i.e. `zplugin load myplugin` is sufficient, there's no need for
`zplugin load _local/myplugin`).
# Customizing paths
Following variables can be set to custom values, before sourcing Zplugin:
```
local -A ZPLGM # (initial Zplugin hash definition)
ZPLGM[BIN_DIR]  where Zplugin code resides, e.g.: "/home/user/.zplugin/bin"
ZPLGM[HOME_DIR]  where Zplugin should create all working directories, e.g.: "/home/user/.zplugin"
ZPLGM[PLUGINS_DIR] override single working directory for plugins, e.g. "/opt/zsh/zplugin/plugins"
ZPLGM[COMPLETIONS_DIR] as above, for completion files, e.g. "/opt/zsh/zplugin/root_completions"
ZPLGM[SNIPPETS_DIR]  as above, for snippets
```
# IRC channel
Simply connect to [chat.freenode.net:6697](ircs://chat.freenode.net:6697/%23zplugin) (SSL) or [chat.freenode.net:6667](irc://chat.freenode.net:6667/%23zplugin) and join #zplugin.
Following is a quick access via Webchat [![IRC](https://kiwiirc.com/buttons/chat.freenode.net/zplugin.png)](https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin)

242
_zplugin Normal file
View file

@ -0,0 +1,242 @@
#compdef zplugin
local context state state_descr line ret=1
typeset -A opt_args
typeset -a commands
commands=(
zstatus:'overall Zplugin status'
times:'statistics on plugin loading times'
self-update:'updates Zplugin'
help:'usage information'
man:'manual'
load:'load plugin'
unload:'unload plugin'
snippet:"source (or add to PATH with --command) local or remote file (-f: force - don't use cache)"
update:'Git update plugin (or all plugins and snippets if --all passed)'
status:'Git status for plugin (or all plugins if --all passed)'
report:'show plugin'"'"'s report (or all plugins'"'"' if --all passed)'
loaded:'show what plugins are loaded'
list:'show what plugins are loaded'
cd:"go into plugin's directory"
create:'create plugin (also together with Github repository)'
edit:"edit plugin's file with \$EDITOR"
glance:"look at plugin's source (pygmentize, {,source-}highlight)"
stress:'test plugin for compatibility with set of options'
changes:"view plugin's git log"
recently:"show plugins that changed recently, argument is e.g. 1 month 2 days"
clist:'list completions in use'
cclear:'clear stray and improper completions'
completions:'list completions in use'
cdisable:'disable completion'
cenable:'enable completion'
creinstall:'install completions for plugin'
cuninstall:'uninstall completions for plugin'
csearch:'search for available completions from any plugin'
compinit:'refresh installed completions'
dtrace:"start tracking what's going on in session"
dstart:"start tracking what's going on in session"
dstop:"stop tracking what's going on in session"
dunload:'revert changes recorded between dstart and dstop'
dreport:"report what was going on in session"
dclear:'clear report of what was going on in session'
compile:'compile plugin (or all plugins if --all passed)'
uncompile:'remove compiled version of plugin (or of all plugins if --all passed)'
compiled:'show which plugins are compiled'
cdlist:'show compdef replay list'
cdreplay:'replay compdefs (to be done after compinit)'
cdclear:'clear compdef replay list'
)
_arguments -C \
'1: :->command'\
'*: :->argument' && ret=0
case $state in
command)
_describe -t commands "Zplugin command" commands && ret=0
;;
argument)
case $words[2] in
help)
_message "Hit enter to get usage information" && ret=0
;;
man)
_message "Hit enter to view manual" && ret=0
;;
zstatus)
_message "Hit enter to get overall status information" && ret=0
;;
times)
_message "Hit enter to get plugin load time statistics" && ret=0
;;
load|light|update|status|compile|stress|cd|edit|glance|changes)
typeset -a plugins
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N:t) )
plugins=( "${plugins[@]/---//}" )
plugins=( "${plugins[@]:#_local/zplugin}" )
plugins=( "${plugins[@]:#custom}" )
_wanted plugins expl "Plugins" \
compadd "$@" -a - plugins && ret=0
;;
unload|report)
typeset -a plugins absolute normal
plugins=( "${ZPLG_REGISTERED_PLUGINS[@]:#_local/zplugin}" )
normal=( "${plugins[@]:#%*}" )
absolute=( "${(M)plugins[@]:#%*}" )
absolute=( "${absolute[@]/\%\/\//%/}" )
local hm="${HOME%/}"
absolute=( "${absolute[@]/$hm/HOME}" )
plugins=( $absolute $normal )
_wanted plugins expl "Plugins" \
compadd "$@" -a - plugins && ret=0
;;
all-reports)
_message "Hit enter to get all reports (for all loaded plugins)" && ret=0
;;
loaded|list)
_message "Hit enter or give part of plugin name" && ret=0
;;
clist|completions)
_message "Hit enter to get list of completions" && ret=0
;;
cclear)
_message "Hit enter to clear stray and improper completions" && ret=0
;;
cdisable)
# Find enabled completions
typeset -a completions
completions=( "${ZPLGM[COMPLETIONS_DIR]}"/_*(N:t) )
completions=( "${completions[@]#_}" )
compadd "$@" -a - completions && ret=0
;;
cenable)
# Find disabled
typeset -a completions
completions=( "${ZPLGM[COMPLETIONS_DIR]}"/[^_]*(N:t) )
compadd "$@" -a - completions && ret=0
;;
creinstall)
# Complete only plugins that have any completions
# We must iterate each plugin to check
# for completions that can be installed
typeset -a plugins completions
local p c user plugin
for p in "${ZPLGM[PLUGINS_DIR]}"/*; do
completions=( "$p"/**/_[^_.][^.]#(N) )
for c in "${completions[@]}"; do
p="${p:t}"
user="${p%%---*}"
plugin="${p#*---}"
plugins+=( "$user/$plugin" )
break
done
done
_wanted plugins expl "Plugins" \
compadd "$@" -a - plugins && ret=0
;;
cuninstall)
# We must iterate each plugin and check if
# it has completions that are installed
typeset -a plugins completions
local p c user plugin
for p in "${ZPLGM[PLUGINS_DIR]}"/*; do
completions=( "$p"/**/_[^_.][^.]#(N) )
for c in "${completions[@]}"; do
cfile="${c:t}"
bkpfile="${cfile#_}"
# Completion installed, either enabled or disabled?
if [[ -e "${ZPLGM[COMPLETIONS_DIR]}"/"$cfile" || -e "${ZPLGM[COMPLETIONS_DIR]}"/"$bkpfile" ]]; then
p="${p:t}"
user="${p%%---*}"
plugin="${p#*---}"
plugins+=( "$user/$plugin" )
break
fi
done
done
_wanted plugins expl "Plugins" \
compadd "$@" -a - plugins && ret=0
;;
compinit)
_message "Hit enter to refresh completion system" && ret=0
;;
snippet)
typeset -a soptions
soptions=( "-f" "--command" )
_wanted soptions expl "Options" \
compadd "$@" -a - soptions && ret=0
;;
dstart|dtrace)
_message "Hit enter to start tracking this session" && ret=0
;;
dstop)
_message "Hit enter to stop tracking this session" && ret=0
;;
dunload)
_message "Hit enter to revert changes recorded between dstart and dstop" && ret=0
;;
dreport)
_message "Hit enter to show report of what was going on in session" && ret=0
;;
dclear)
_message "Hit enter to clear report of what was going on in session" && ret=0
;;
compile-all)
_message 'Hit enter to compile all downloaded plugins' && ret=0
;;
uncompile)
typeset -a plugins
plugins=( "${ZPLGM[PLUGINS_DIR]}"/*(N) )
typeset -a show_plugins p matches
for p in "${plugins[@]}"; do
matches=( $p/*.zwc(N) )
if [ "$#matches" -ne "0" ]; then
p="${p:t}"
[ "$p" = "_local---zplugin" ] && continue
[ "$p" = "custom" ] && continue
p="${p/---//}"
show_plugins+=( "$p" )
fi
done
_wanted show_plugins expl "Plugins" \
compadd "$@" -a - show_plugins && ret=0
;;
uncompile-all)
_message 'Hit enter remove compiled versions of all downloaded plugins' && ret=0
;;
compiled)
_message 'Hit enter to get list of compiled plugins' && ret=0
;;
cdlist)
_message 'Hit enter to show compdef replay list' && ret=0
;;
cdreplay)
_message 'Hit enter to replay recorded compdefs' && ret=0
;;
cdclear)
_message 'Hit enter to clear compdef replay list' && ret=0
;;
recently)
typeset -a timespecs
timespecs=(
"3 days":"code modified during last 3 days"
"1 week":"code modified during last 7 days (default)"
"1 month":"code modified during last month"
)
_describe -t timespecs "Time spec" timespecs && ret=0
;;
create)
_message 'Plugin spec or just enter, to create new plugin' && ret=0
;;
*)
ret=1
;;
esac
esac
return "$ret"

16
zmodules/.cvsignore Normal file
View file

@ -0,0 +1,16 @@
Makefile
META-FAQ
config.cache
config.h
config.h.in
config.log
config.modules
config.modules.sh
config.status
configure
cscope.out
stamp-h
stamp-h.in
autom4te.cache
*.swp
.git

4
zmodules/.distfiles Normal file
View file

@ -0,0 +1,4 @@
DISTFILES_SRC='
META-FAQ
configure config.h.in stamp-h.in
'

15
zmodules/.editorconfig Normal file
View file

@ -0,0 +1,15 @@
# Top-most editorconfig file
root = true
[*]
end_of_line = lf
tab_width = 8
indent_size = 2
indent_style = tab
[ChangeLog]
indent_size = 8
[*.[ch]]
indent_size = 4

155
zmodules/.gitignore vendored Normal file
View file

@ -0,0 +1,155 @@
Makefile
tags
TAGS
*.o
*.o.c
*.orig
*.a
*.so
*.dll
*~
.*.sw?
\#*
/META-FAQ
/config.cache
/config.h
/config.log
/config.modules
/config.modules.sh
/config.status
/config.status.lineno
/cscope.out
/stamp-h
/autom4te.cache
Config/defs.mk
CVS
.#*
Doc/help
Doc/help.txt
Doc/help/[_a-zA-Z0-9]*
Doc/intro.pdf
Doc/intro.ps
Doc/intro.a4.pdf
Doc/intro.a4.ps
Doc/intro.us.pdf
Doc/intro.us.ps
Doc/version.yo
Doc/texi2html.conf
Doc/zsh*.1
Doc/zsh.texi
Doc/zsh.info*
Doc/*.html
Doc/zsh.aux
Doc/zsh.toc
Doc/zsh.cp
Doc/zsh.cps
Doc/zsh.fn
Doc/zsh.fns
Doc/zsh.ky
Doc/zsh.kys
Doc/zsh.pg
Doc/zsh.pgs
Doc/zsh.vr
Doc/zsh.vrs
Doc/zsh.log
Doc/zsh.dvi
Doc/zsh_a4.dvi
Doc/zsh_us.dvi
Doc/zsh.tp
Doc/zsh.tps
Doc/zsh.idx
Doc/zsh_*.ps
Doc/infodir
Doc/zsh.pdf
Doc/zsh_a4.pdf
Doc/zsh_us.pdf
Doc/Zsh/modlist.yo
Doc/Zsh/modmenu.yo
Doc/Zsh/manmodmenu.yo
Etc/FAQ
Etc/FAQ.html
Src/*.epro
Src/*.export
Src/*.mdh
Src/*.mdh.tmp
Src/*.mdhi
Src/*.mdhs
Src/*.syms
Src/Makemod.in
Src/Makemod
Src/[_a-zA-Z0-9]*.pro
Src/ansi2knr
Src/bltinmods.list
Src/cscope.out
Src/libzsh.so*
Src/modules-bltin
Src/modules.index
Src/modules.index.tmp
Src/modules.stamp
Src/patchlevel.h
Src/sigcount.h
Src/signames.c
Src/signames2.c
Src/stamp-modobjs
Src/stamp-modobjs.tmp
Src/tags
Src/TAGS
Src/version.h
Src/zsh
Src/zsh.exe
Src/zshcurses.h
Src/zshpaths.h
Src/zshterm.h
Src/zshxmods.h
Src/Builtins/Makefile.in
Src/Builtins/*.export
Src/Builtins/so_locations
Src/Builtins/*.pro
Src/Builtins/*.epro
Src/Builtins/*.syms
Src/Builtins/*.mdh
Src/Builtins/*.mdhi
Src/Builtins/*.mdhs
Src/Builtins/*.mdh.tmp
Src/Builtins/rlimits.h
Src/Modules/Makefile.in
Src/Modules/*.export
Src/Modules/so_locations
Src/Modules/*.pro
Src/Modules/*.epro
Src/Modules/*.syms
Src/Modules/*.mdh
Src/Modules/*.mdhi
Src/Modules/*.mdhs
Src/Modules/*.mdh.tmp
Src/Modules/errnames.c
Src/Modules/errcount.h
Src/Modules/curses_keys.h
Src/Zle/Makefile.in
Src/Zle/*.export
Src/Zle/so_locations
Src/Zle/*.pro
Src/Zle/*.epro
Src/Zle/*.syms
Src/Zle/*.mdh
Src/Zle/*.mdhi
Src/Zle/*.mdhs
Src/Zle/*.mdh.tmp
Src/Zle/thingies.list
Src/Zle/widgets.list
Src/Zle/zle_things.h
Src/Zle/zle_widget.h
Test/*.tmp
/.project

7
zmodules/.preconfig Executable file
View file

@ -0,0 +1,7 @@
#! /bin/sh
set -e
autoconf
autoheader
echo > stamp-h.in

2044
zplugin-autoload.zsh Normal file

File diff suppressed because it is too large Load diff

14877
zplugin-autoload.zsh.pdf Normal file

File diff suppressed because it is too large Load diff

194
zplugin-install.zsh Normal file
View file

@ -0,0 +1,194 @@
# -*- mode: shell-script -*-
# vim:ft=zsh
builtin source ${ZPLGM[BIN_DIR]}"/zplugin-side.zsh"
# FUNCTION: -zplg-setup-plugin-dir {{{
# Clones given plugin into PLUGIN_DIR. Supports multiple
# sites (respecting `from' and `proto' ice modifiers).
# Invokes compilation of plugin's main file.
#
# $1 - user
# $2 - plugin
-zplg-setup-plugin-dir() {
local user="$1" plugin="$2" remote_url_path="$1/$2"
if [[ ! -d "${ZPLGM[PLUGINS_DIR]}/${user}---${plugin}" ]]; then
local -A sites
sites=(
"github" "github.com"
"gh" "github.com"
"bitbucket" "bitbucket.org"
"bb" "bitbucket.org"
"gitlab" "gitlab.com"
"gl" "gitlab.com"
"notabug" "notabug.org"
"nb" "notabug.org"
)
if [[ "$user" = "_local" ]]; then
print "Warning: no local plugin \`$plugin\'"
print "(looked in ${ZPLGM[PLUGINS_DIR]}/${user}---${plugin})"
return 1
fi
-zplg-any-colorify-as-uspl2 "$user" "$plugin"
print "Downloading $REPLY..."
# Return with error when any problem
local site
[[ -n "${ZPLG_ICE[from]}" ]] && site="${sites[${ZPLG_ICE[from]}]}"
case "${ZPLG_ICE[proto]}" in
(|https)
git clone --recursive "https://${site:-github.com}/$remote_url_path" "${ZPLGM[PLUGINS_DIR]}/${user}---${plugin}" || return 1
;;
(git|http|ftp|ftps|rsync|ssh)
git clone --recursive "${ZPLG_ICE[proto]}://${site:-github.com}/$remote_url_path" "${ZPLGM[PLUGINS_DIR]}/${user}---${plugin}" || return 1
;;
(*)
print "${ZPLGM[col-error]}Unknown protocol:${ZPLGM[col-rst]} ${ZPLG_ICE[proto]}"
return 1
esac
# Install completions
-zplg-install-completions "$user" "$plugin" "0"
( (( ${+ZPLG_ICE[atclone]} )) && { cd "${ZPLGM[PLUGINS_DIR]}/${user}---${plugin}"; eval "${ZPLG_ICE[atclone]}" } )
# Compile plugin
-zplg-compile-plugin "$user" "$plugin"
fi
return 0
} # }}}
# FUNCTION: -zplg-install-completions {{{
# Installs all completions of given plugin. After that they are
# visible to `compinit'. Visible completions can be selectively
# disabled and enabled. User can access completion data with
# `clist' or `completions' subcommand.
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
# $3 - if 1, then reinstall, otherwise only install completions that aren't there
-zplg-install-completions() {
local reinstall="${3:-0}"
builtin setopt localoptions nullglob extendedglob unset
-zplg-any-to-user-plugin "$1" "$2"
local user="${reply[-2]}"
local plugin="${reply[-1]}"
-zplg-exists-physically-message "$user" "$plugin" || return 1
# Symlink any completion files included in plugin's directory
typeset -a completions already_symlinked backup_comps
local c cfile bkpfile
[[ "$user" = "%" ]] && completions=( "${plugin}"/**/_[^_.][^.]#~*(zplg_functions|/zsdoc/)* ) || completions=( "${ZPLGM[PLUGINS_DIR]}/${user}---${plugin}"/**/_[^_.][^.]#~*(zplg_functions|/zsdoc/)* )
already_symlinked=( "${ZPLGM[COMPLETIONS_DIR]}"/_[^_.][^.]# )
backup_comps=( "${ZPLGM[COMPLETIONS_DIR]}"/[^_.][^.]# )
# Symlink completions if they are not already there
# either as completions (_fname) or as backups (fname)
# OR - if it's a reinstall
for c in "${completions[@]}"; do
cfile="${c:t}"
bkpfile="${cfile#_}"
if [[ -z "${already_symlinked[(r)*/$cfile]}" &&
-z "${backup_comps[(r)*/$bkpfile]}" ||
"$reinstall" = "1"
]]; then
if [[ "$reinstall" = "1" ]]; then
# Remove old files
command rm -f "${ZPLGM[COMPLETIONS_DIR]}/$cfile"
command rm -f "${ZPLGM[COMPLETIONS_DIR]}/$bkpfile"
fi
print "${ZPLGM[col-info2]}Symlinking completion \`$cfile' to ${ZPLGM[COMPLETIONS_DIR]}${ZPLGM[col-rst]}"
command ln -s "$c" "${ZPLGM[COMPLETIONS_DIR]}/$cfile"
# Make compinit notice the change
-zplg-forget-completion "$cfile"
else
print "${ZPLGM[col-error]}Not symlinking completion \`$cfile', it already exists${ZPLGM[col-rst]}"
print "${ZPLGM[col-error]}Use \`creinstall {plugin-name}' to force install${ZPLGM[col-rst]}"
fi
done
} # }}}
# FUNCTION: -zplg-download-file-stdout {{{
# Downloads file to stdout. Supports following backend commands:
# curl, wget, lftp, lynx. Used by snippet loading.
-zplg-download-file-stdout() {
local url="$1"
local restart="$2"
if [[ "$restart" = "1" ]]; then
path+=( "/usr/local/bin" )
if (( ${+commands[curl]} )) then
curl -fsSL "$url"
elif (( ${+commands[wget]} )); then
wget -q "$url" -O -
elif (( ${+commands[lftp]} )); then
lftp -c "cat $url"
elif (( ${+commands[lynx]} )) then
lynx -dump "$url"
else
[[ "${(t)path}" != *unique* ]] && path[-1]=()
return 1
fi
[[ "${(t)path}" != *unique* ]] && path[-1]=()
else
if ! type curl 2>/dev/null 1>&2; then
curl -fsSL "$url" || -zplg-download-file-stdout "$url" "1"
elif type wget 2>/dev/null 1>&2; then
wget -q "$url" -O - || -zplg-download-file-stdout "$url" "1"
elif type lftp 2>/dev/null 1>&2; then
lftp -c "cat $url" || -zplg-download-file-stdout "$url" "1"
else
-zplg-download-file-stdout "$url" "1"
fi
fi
return 0
} # }}}
# FUNCTION: -zplg-forget-completion {{{
# Implements alternation of Zsh state so that already initialized
# completion stops being visible to Zsh.
#
# $1 - completion function name, e.g. "_cp"; can also be "cp"
-zplg-forget-completion() {
local f="$1"
typeset -a commands
commands=( "${(k@)_comps[(R)$f]}" )
[[ "${#commands}" -gt 0 ]] && print "Forgetting commands completed by \`$f':"
local k
for k in "${commands[@]}"; do
[[ -n "$k" ]] || continue
unset "_comps[$k]"
print "Unsetting $k"
done
print "${ZPLGM[col-info2]}Forgetting completion \`$f'...${ZPLGM[col-rst]}"
print
unfunction -- 2>/dev/null "$f"
} # }}}
# FUNCTION: -zplg-compile-plugin {{{
# Compiles given plugin (its main source file, and also an
# additional "....zsh" file if it exists).
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
-zplg-compile-plugin() {
-zplg-first "$1" "$2" || {
print "${ZPLGM[col-error]}No files for compilation found${ZPLGM[col-rst]}"
return 1
}
local dname="${reply[-2]}" first="${reply[-1]}"
local fname="${first#$dname/}"
print "Compiling ${ZPLGM[col-info]}$fname${ZPLGM[col-rst]}..."
zcompile "$first" || {
print "Compilation failed. Don't worry, the plugin will work also without compilation"
print "Consider submitting an error report to the plugin's author"
}
# Try to catch possible additional file
zcompile "${first%.plugin.zsh}.zsh" 2>/dev/null
} # }}}

2226
zplugin-install.zsh.pdf Normal file

File diff suppressed because it is too large Load diff

95
zplugin-side.zsh Normal file
View file

@ -0,0 +1,95 @@
# -*- mode: shell-script -*-
# vim:ft=zsh
# FUNCTION: -zplg-exists-physically {{{
# Checks if directory of given plugin exists in PLUGIN_DIR.
#
# Testable.
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
-zplg-exists-physically() {
-zplg-any-to-user-plugin "$1" "$2"
if [[ "${reply[-2]}" = "%" ]]; then
[[ -d "${reply[-1]}" ]] && return 0 || return 1
else
[[ -d "${ZPLGM[PLUGINS_DIR]}/${reply[-2]}---${reply[-1]}" ]] && return 0 || return 1
fi
} # }}}
# FUNCTION: -zplg-exists-physically-message {{{
# Checks if directory of given plugin exists in PLUGIN_DIR,
# and outputs error message if it doesn't.
#
# Testable.
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
-zplg-exists-physically-message() {
if ! -zplg-exists-physically "$1" "$2"; then
-zplg-any-colorify-as-uspl2 "$1" "$2"
print "${ZPLGM[col-error]}No such plugin directory${ZPLGM[col-rst]} $REPLY"
return 1
fi
return 0
} # }}}
# FUNCTION: -zplg-first {{{
# Finds the main file of plugin. There are multiple file name
# formats, they are ordered in order starting from more correct
# ones, and matched. -zplg-load-plugin() has similar code parts
# and doesn't call -zplg-first() for performance. Obscure matching
# is done in -zplg-find-other-matches, here and in -zplg-load().
# Obscure = non-standard main-file naming convention.
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
-zplg-first() {
-zplg-any-to-user-plugin "$1" "$2"
local user="${reply[-2]}" plugin="${reply[-1]}"
# There are plugins having ".plugin.zsh"
# in ${plugin} directory name, also some
# have ".zsh" there
if [[ "$user" = "%" ]]; then
local pdir="${${${${plugin:t}%.plugin.zsh}%.zsh}%.git}"
local dname="$plugin"
else
local pdir="${${${plugin%.plugin.zsh}%.zsh}%.git}"
local dname="${ZPLGM[PLUGINS_DIR]}/${user}---${plugin}"
fi
# Look for file to compile. First look for the most common one
# (optimization) then for other possibilities
if [[ ! -e "$dname/${pdir}.plugin.zsh" ]]; then
-zplg-find-other-matches "$dname" "$pdir"
else
reply=( "$dname/${pdir}.plugin.zsh" )
fi
if [[ "${#reply}" -eq "0" ]]; then
reply=( "$dname" "" )
return 1
fi
# Take first entry
integer correct=0
[[ -o "KSH_ARRAYS" ]] && correct=1
local first="${reply[1-correct]}"
reply=( "$dname" "$first" )
return 0
} # }}}
# FUNCTION: -zplg-any-colorify-as-uspl2 {{{
# Returns ANSI-colorified "user/plugin" string, from any supported
# plugin spec (user--plugin, user/plugin, user plugin, plugin).
#
# $1 - plugin spec (4 formats: user---plugin, user/plugin, user, plugin)
# $2 - plugin (only when $1 - i.e. user - given)
# $REPLY = ANSI-colorified "user/plugin" string
-zplg-any-colorify-as-uspl2() {
-zplg-any-to-user-plugin "$1" "$2"
local user="${reply[-2]}" plugin="${reply[-1]}"
[[ "$user" = "%" ]] && {
plugin="${plugin/$HOME/HOME}"
REPLY="${ZPLGM[col-uname]}%${ZPLGM[col-rst]}${ZPLGM[col-pname]}${plugin}${ZPLGM[col-rst]}"
} || REPLY="${ZPLGM[col-uname]}${user}${ZPLGM[col-rst]}/${ZPLGM[col-pname]}${plugin}${ZPLGM[col-rst]}"
} # }}}

2266
zplugin-side.zsh.pdf Normal file

File diff suppressed because it is too large Load diff

1500
zplugin.zsh Normal file

File diff suppressed because it is too large Load diff

9765
zplugin.zsh.pdf Normal file

File diff suppressed because it is too large Load diff