Commit Graph

122 Commits

Author SHA1 Message Date
Daniel Shahaf
35c4bb7bdc More WARN_CREATE_GLOBAL cleanups.
Followup to 908c4fe150.
Found by test-perfs.zsh.
2015-09-25 13:04:37 +00:00
Daniel Shahaf
908c4fe150 Stop leaking variables into global namespace.
Set WARN_CREATE_GLOBAL to prevent recurrence.

Fixes zsh-users/zsh-syntax-highlighting#192.
2015-09-24 18:01:06 +00:00
Daniel Shahaf
9e80fe8f02 Bump copyright years. 2015-09-24 16:46:28 +00:00
Daniel Shahaf
00862cf4fa Followup to e5c2a88db0 (merged in 51102bf83f):
Have widgets return EXIT_SUCCESS.
2015-09-18 12:38:24 +00:00
Daniel Shahaf
e5c2a88db0 Highlight yanks/pastes on top of syntax highlighting.
Let $zle_highlight[paste] override $region_highlight.
2015-09-10 19:31:36 +00:00
Daniel Shahaf
0e31d6e1a2 Highlight the region on top of syntax highlighting.
Let $zle_highlight[region] override $region_highlight.
2015-09-08 20:22:22 +00:00
Daniel Shahaf
f78919d941 Preserve $? of wrapped widgets. 2015-09-05 21:44:11 +00:00
Daniel Shahaf
8e7c26f489 Do wrap the 'yank' widget, because that works.
Partly reverts eb9870f4db which was PR #143 to
fix issue #99.
2015-09-05 12:50:32 +00:00
nicoulaj
3dc5741900 Merge pull request #140 from randomize/pr_fix_issue_#77
Pr fix issue #77
2014-09-24 22:58:20 +02:00
Vincent Bernat
74a183447d zle: don't override yank/yank-pop
`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.
2014-06-29 11:52:32 +02:00
Randy
7edd08156e Chaned main highlighter alorithm to resolve issue #77 2014-03-29 22:52:10 +02:00
Evan Pitstick
dffbab0c92 a more simple and universal way (for zsh projects) to find highlight dir path 2013-10-09 12:02:34 -04:00
Evan Pitstick
0fcc2629d2 Finds highlighters dir a little better 2013-03-08 00:57:16 -05:00
Jan M. Binder
966eb851ca Added quotes to suppress error 2012-04-07 11:48:11 +02:00
NAKAMURA Yoshitaka
56b134f5d6 fix "_zsh_highlight_widget_XXX:zle: unknown option: X" error 2011-11-01 20:02:03 +09:00
Andreas Gahr
603fce64b5 autoload add-zsh-hook && provide a nicer error message if that fails due to old zsh version, or similar situations. Reset another variable in hook function; it can't hurt 2011-09-28 16:35:19 +02:00
Andreas Gahr
304ddb9400 make highlighting work for first entry in history. fixes #79 2011-09-27 16:08:23 +02:00
Takeshi Banse
b0fee4e758 pass args down to each original zle call
Signed-off-by: Takeshi Banse <takebi@laafc.net>
2011-09-07 01:39:52 +08:00
Takeshi Banse
9706996d3b make _zsh_highlight nounset-able
Signed-off-by: Takeshi Banse <takebi@laafc.net>
2011-08-24 14:18:23 +09:00
Simon Heimlicher
854038010f Added || true to ensure zero exit code 2011-08-03 09:40:19 +00:00
Julien Nicoulaud
186d80054a Fix #65, sourcing the script multiples times should not cause issues anymore 2011-08-02 20:25:49 +02:00
Julien Nicoulaud
0e331cd654 Isolate setup code in functions to ease messing with zsh-syntax-highlighting 2011-07-31 17:59:55 +02:00
Julien Nicoulaud
5003fa7c9b We don't need this hook as we have already bound every widget we could find (stop me if I'm wrong) 2011-07-31 17:14:56 +02:00
Julien Nicoulaud
4ff08dcfa6 Fix #53: Prefix all defined functions with _zsh_highlight 2011-07-26 23:16:52 +02:00
Julien Nicoulaud
776453cb5b Fix #46: Conflict with url-quote-magic 2011-07-26 22:50:53 +02:00
Julien Nicoulaud
3b27ad778d More efficient way to strip leading dot 2011-07-25 22:30:06 +02:00
Valodim
5f68accccf Don't highlight if buffer is longer than $ZSH_HIGHLIGHT_MAXLENGTH 2011-07-25 14:51:43 +02:00
garinger
1858be26bd exclude .beep 2011-07-07 00:25:44 +08:00
Julien Nicoulaud
28720c77aa Some fixes consecutive to pull request #61 merge
* Allow to override highlighters directory through `ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR`
* Handle spaces in the directory path
* Use Zsh builtin "h" modifier instead of `dirname`
2011-06-30 20:08:43 +02:00
Ted Naleid
4ed9f9a68f fix for issue #60, unrecognized modifier 'A' on startup 2011-06-29 21:32:58 -05:00
Julien Nicoulaud
e04f6ab862 Safety checks before looking up cursor position 2011-06-17 12:36:07 +02:00
Julien Nicoulaud
f6af27b8a6 More reliable way to hook precmd 2011-06-17 12:35:26 +02:00
Guido
71e797a8b5 Much easier and less error prone way to start highlighting immediately after the creation of a new command line. 2011-06-16 13:57:34 -07:00
Guido
56801a6b42 * added a workaround to start highlighting immediately after the creation of a new command line. 2011-06-16 04:26:51 -07:00
Julien Nicoulaud
bb7fcb79fa Fix #56: tolerance to WARN_GLOBAL option 2011-06-12 23:09:59 +02:00
Julien Nicoulaud
55e6a85fbb Merge branch 'master' of github.com:nicoulaj/zsh-syntax-highlighting
Conflicts:
	zsh-syntax-highlighting.zsh
2011-06-12 23:04:33 +02:00
Julien Nicoulaud
0772ddd346 Big refactoring.
* 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
2011-06-12 22:57:14 +02:00
NAKAMURA Yoshitaka
0999ab05ba do nothing if PENDING inputs are exist
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.
2011-03-12 16:31:18 +09:00
Julien Nicoulaud
19f16752bb Issue 49: Don't use readlink, options differ between systems
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-03-02 00:34:12 +01:00
Julien Nicoulaud
bc788f3f19 Start splitting highlighters to separate files.
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>
2011-02-17 23:41:01 +01:00
Julien Nicoulaud
2f0fb81af4 More efficient way to look for elements in arrays
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-02-17 22:27:31 +01:00
Julien Nicoulaud
3abf463753 More code style fixes
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-02-17 21:02:23 +01:00
Julien Nicoulaud
2670c93e05 Make sure functions names match _zsh_highlight_*
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-02-17 20:58:22 +01:00
Julien Nicoulaud
dd84bff854 Code style
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-02-17 19:51:07 +01:00
Julien Nicoulaud
6879d3c29f Issue 47: Removing styling of 'isearch' and 'special', as it has no effect
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-02-17 19:31:20 +01:00
Julien Nicoulaud
e1479022a0 Merge branch 'hchbaw-for-nicoulaj' 2011-02-17 19:20:32 +01:00
NAKAMURA Yoshitaka
390ab0fc32 Highlight variable assignment 2011-02-14 19:26:24 +09:00
Julien Nicoulaud
78ff61eddc Fix typo
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-02-01 21:01:37 +01:00
Takeshi Banse
0948c3d676 Introduce _zsh_add-highlighter.
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>
2011-01-16 20:32:53 +09:00
Takeshi Banse
6663c5647d Make bracket match a function.
Append it to ZSH_HIGHLIGHT_FUNCTIONS.

Signed-off-by: Takeshi Banse <takebi@laafc.net>
2011-01-16 20:32:20 +09:00