`yank-pop` relies on the fact that the last zle command is `yank` or
`yank-pop` to work correctly. Rewriting them prevents this check to work
correctly breaking `yank-pop`.
This fix just disallow overriding of those two zle commands. As a
side-effect, syntax highlighting will not happen when using.
This fixes#99.
* Allow to override highlighters directory through `ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR`
* Handle spaces in the directory path
* Use Zsh builtin "h" modifier instead of `dirname`
* Don't override user defined styles
* Better modularisation of highlighters
* Allow to define which highlighters are activated
* Allow to define the order in which they are defined
* Minor performance optimizations
* Fixed some variables leak
* Improve documentation
* Brackets highlighter: use ZSH_HIGHLIGHT_STYLES instead of a specific array
Originally, zsh-syntax-highlighting called highlight functions at every inputs.
It's OK for user's keyboard inputs. But when long inputs come from clipboard,
it cause noticeable slowdown.
The script still works on its own, highlighters in highlighters/ are
loaded as addons if present.
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
For easily extending the highlighting behavior, split the
actual highlighting function into some pieces.
For example "_zsh_main-highlight" transformed into,
1) An actual highlighting function which updates the
`region_highlight` on its own. (_zsh_main-highlight)
2) A predicate which determines whether its highlighting function
(in this case `_zsh_main-highlight`) should be called or not.
(_zsh_buffer-modified-p)
Likewise, `_zsh_highlight-bracket-match` and
`_zsh_highlight-bracket-match-p` are born.
Eventually, `_zsh_highlight-zle-buffer` coordinates above these
functions and maintain some internal state variables.
Finally, added `_zsh_add-highlighter` a little syntactic-sugar-ish
function to register the highlighting functions in an appropriate manner.
Signed-off-by: Takeshi Banse <takebi@laafc.net>
Make `_zsh_highlight-zle-buffer` just a hands-off.
Now, `_zsh_highlight-zle-buffer` calls each ZSH_HIGHLIGHT_FUNCTIONS
in turn. The former `_zsh_highlight-zle-buffer` is renamed to
`_zsh_main-highlight.`
Signed-off-by: Takeshi Banse <takebi@laafc.net>
% bindkey "^I" complete-word
% bi<TAB>
If we had not source the zsh-syntax-highlighting.zsh, it could
complete something. This is due to that `complete-word` will be
rebinded with 'zle -N $clean_event'.
Signed-off-by: Takeshi Banse <takebi@laafc.net>