Commit graph

200 commits

Author SHA1 Message Date
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
Takeshi Banse
07588d2165 Make core syntax highlighting a function.
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>
2011-01-16 20:26:50 +09:00
Julien Nicoulaud
e162de6f51 Add BSD license
(http://www.zsh.org/mla/users//2011/msg00030.html)

Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-01-10 10:11:35 +01:00
Julien Nicoulaud
0392fdc46a Issue 34: Do not highlight non commands as commands.
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
2011-01-08 18:03:52 +01:00
Arlen Cuss
a40d777860 Use ${(Q)arg} to expand a level of quotes, such that files/directories with spaces in their name (escaped with backslash) are noticed correctly. 2011-01-08 15:51:26 +11:00
Takeshi Banse
d2f641ca50 Carefully rebind the $clean_event.
% 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>
2011-01-07 21:51:39 +09:00
Takeshi Banse
2fd0845b77 Recreate the completion widget with its own function.
Currently, each completion widgets will be re-installed, but its
function will be statically associated with `_main_complete`.

We can get this function name via $widget[$event] which is the
zsh's zsh/zleparameter module's feature. We can use this information
for `zle -C`ing.

Signed-off-by: Takeshi Banse <takebi@laafc.net>
2011-01-07 21:46:17 +09:00
Takeshi Banse
802583ea94 Make this clause function and call it afterward.
Signed-off-by: Takeshi Banse <takebi@laafc.net>
2011-01-07 21:35:43 +09:00
Julien Nicoulaud
f962bdf1e7 Fix regression 2011-01-06 23:28:41 +01:00
Julien Nicoulaud
83372a5cee Issue 38: Conflict with command-not-found 2011-01-06 22:25:16 +01:00
Julien Nicoulaud
fc5caa4e2d Fix error when sourcing twice the script 2011-01-06 14:59:23 +01:00
Mounier Florian
7e963c6c7e Fix issue 31 2011-01-06 09:16:15 +01:00
Julien Nicoulaud
0a50e2a830 Issue 32: 'xargs' and 'zargs' are followed by commands (thanks to claytron) 2011-01-06 08:41:52 +01:00
Julien Nicoulaud
a9da4e6c76 Harmonize exported variables names 2011-01-05 23:07:56 +01:00
Julien Nicoulaud
60842aa75b Define a style for hashed commands 2011-01-05 22:51:00 +01:00
Sorin Ionescu
a7746077bf Added hashed commands highlighting to zsh-syntax-highlighting oh-my-zsh plugin. 2011-01-06 05:47:42 +08:00
Julien Nicoulaud
b45891cdf4 Fix variable scope and make variable names even more obvious 2011-01-05 22:16:17 +01:00
Julien Nicoulaud
0e55450a0b Issue 26: The script unplugs user defined events 2011-01-05 22:11:00 +01:00
Mounier Florian
701cc303fe Highlighting bracket pair, when one is under the cursor (Issue 24) 2011-01-05 17:08:34 +01:00
Mounier Florian
f78e444451 Fix highlighting on new line with same buffer 2011-01-05 14:27:22 +01:00
Mounier Florian
a765f76656 Remove the huge zle functions array and replace it with zle -la output 2011-01-05 14:10:57 +01:00
Mounier Florian
2ca730ed17 Merge branch 'master' of gh:nicoulaj/zsh-syntax-highlighting 2011-01-05 13:50:19 +01:00
Mounier Florian
1da1aeb6f8 Simple rainbow style bracket matching 2011-01-05 13:48:23 +01:00
Julien Nicoulaud
a640bb8b96 Fix for aliases (from zsh-users)
http://www.zsh.org/mla/users/2011/msg00005.html
2011-01-05 11:28:24 +01:00
Mounier Florian
5afa8fcb32 Add all zle hookable functions 2011-01-05 10:54:25 +01:00
Julien Nicoulaud
0c138706a7 'where' and 'whereis' are both followed by commands 2011-01-02 18:19:56 +01:00
Julien Nicoulaud
f4a5493d12 'whence' and 'which' are both followed by commands 2011-01-02 18:19:25 +01:00
Julien Nicoulaud
94ecf1b111 'nocorrect' is followed by a command 2011-01-02 00:09:05 +01:00
Julien Nicoulaud
3befdc552f The script should not be executable, it is meant to be sourced 2011-01-01 23:42:24 +01:00
Julien Nicoulaud
6db0692d5e Make sure the ZSH_HIGHLIGHT_STYLES array is exported 2011-01-01 22:17:56 +01:00
Julien Nicoulaud
f713934f6c Fix issue with substrings extraction 2011-01-01 19:17:02 +01:00
Julien Nicoulaud
90e661bd69 Issue 17: Update README with "How to override the default styles"
Harmonize variable names
2011-01-01 17:34:35 +01:00
Julien Nicoulaud
e50d47ae1b Rename variable with obsolete/confusing name 2011-01-01 16:32:37 +01:00
Julien Nicoulaud
d4a9baa4ae Issue 15: History expansion is highlighted as unknown token (partial fix, only covers common cases) 2011-01-01 16:30:35 +01:00
Julien Nicoulaud
9f9e6c24c6 Issue 19: No duplicates in ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS 2011-01-01 16:11:13 +01:00
Julien Nicoulaud
5958662772 Issue 14: Do not highlight globbing if noglob is present 2011-01-01 16:01:30 +01:00
Wayne Davison
a4e7eddae7 Avoid processing the same buffer multiple times. 2010-12-31 15:16:50 -08:00
Julien Nicoulaud
ce15291cfb Make default styles identic to Fish 2010-12-31 14:45:03 +01:00
Julien Nicoulaud
c19bef7714 Issue 12: Highlight isearch like fish
Bind highlighting to more history navigation ZLE events
2010-12-31 14:35:38 +01:00
Julien Nicoulaud
a56a085ca7 Fix tokens followed by commands and aliases bug (thanks to hchbaw) 2010-12-31 02:07:24 +01:00
Julien Nicoulaud
a2f022c70f Fix vim header 2010-12-30 23:06:24 +01:00
Julien Nicoulaud
887f06131e Replace tabs with spaces... 2010-12-30 20:06:46 +01:00
Wayne Davison
0e73dee10f Also need to affect delete-char-or-list. 2010-12-30 10:49:14 -08:00
Julien Nicoulaud
c6dcd93691 Remove fg=white from path style, confusing for white background terminals 2010-12-30 19:49:04 +01:00
Wayne Davison
19de6c9e92 Fix renamed function reference. 2010-12-30 10:36:51 -08:00
Wayne Davison
6a3bbe72da Fix some _hl_string issues:
- Avoid unset variable warning at $arg[0].
- Fix highlighting of "\$" and "\\".
- Tweak the code style a bit.
2010-12-30 10:29:50 -08:00
Wayne Davison
030cabee59 Avoid some variables bleeding into the user's env. 2010-12-30 10:23:26 -08:00
Wayne Davison
fe3ac1a25b Also affect the accept-line* and more zle *complete* functions. 2010-12-30 10:23:25 -08:00
Wayne Davison
75eba65836 A bit more code formatting. 2010-12-30 10:22:59 -08:00
Julien Nicoulaud
204e8f1b93 Issue 9: take into account aliases for tokens followed by commands 2010-12-30 19:18:17 +01:00
Julien Nicoulaud
97d944743a Some refactoring to avoid names collisions
Code cleaning
2010-12-30 18:53:42 +01:00
Julien Nicoulaud
91760946f3 Declare styles in an associative array to make it easily overridable 2010-12-30 18:35:28 +01:00
Julien Nicoulaud
00427081d1 Format code 2010-12-30 17:05:00 +01:00
Julien Nicoulaud
2cf6e4844b Merge branch 'master' of git://github.com/x-way/zsh-syntax-highlighting 2010-12-30 16:53:40 +01:00
Julien Nicoulaud
e1c078c628 Issue 8: Trigger highlighting on magic-space (thanks to sunaku) 2010-12-30 16:20:43 +01:00
Julien Nicoulaud
9971f900a7 Issue 4: Force option bareglobqual 2010-12-30 16:13:48 +01:00
Andreas Jaggi
7dea99007a Merge branch 'master' of https://github.com/nicoulaj/zsh-syntax-highlighting 2010-12-27 12:59:10 +01:00
Andreas Jaggi
48b3897479 Highlight special chars in double-quoted strings 2010-12-27 12:57:05 +01:00
Wayne Davison
d35af74603 More ZLE_TOKENS_FOLLOWED_BY_COMMANDS entries. 2010-12-26 17:08:46 -08:00
Wayne Davison
be71887386 Fix highlighting of external commands & simplify matching. 2010-12-26 17:02:59 -08:00
Andreas Jaggi
9f88ab66ee Merge branch 'master' of https://github.com/nicoulaj/zsh-syntax-highlighting 2010-12-26 23:49:58 +01:00
Wayne Davison
ff908d1128 Removing '§' from ZLE_TOKENS_FOLLOWED_BY_COMMANDS. 2010-12-26 11:56:05 -08:00
Wayne Davison
57da7c9a28 Some changes from Bart's issue 6. 2010-12-25 23:51:46 -08:00
Wayne Davison
44fd26a0cc Fix potential errors for some setopt variations. 2010-12-25 20:42:00 -08:00
Andreas Jaggi
b253ce8050 Underline text at curor if matching path exists 2010-12-26 06:14:54 +08:00
Andreas Jaggi
899c83d0cd Underline text at curor if matching path exists 2010-12-25 22:38:07 +01:00
Andreas Jaggi
2bf1933f2d Merge branch 'master' of https://github.com/nicoulaj/zsh-syntax-highlighting 2010-12-25 22:36:47 +01:00
Julien Nicoulaud
5ba105efdb Issue 2: Fix for those using option NO_UNSET (thanks to WayneD) 2010-12-25 22:03:27 +01:00
Andreas Jaggi
12ffa71c17 Underline existing paths 2010-12-26 03:57:20 +08:00
Andreas Jaggi
732faaa252 Personalize colors 2010-12-25 20:52:44 +01:00
Andreas Jaggi
2ff771eaa9 Underline existing paths 2010-12-25 20:51:55 +01:00
Julien Nicoulaud
f4502a2f5c Add README 2010-12-25 18:47:12 +01:00
Julien Nicoulaud
89e3c632ef Add Zsh syntax highlighting script 2010-12-25 18:33:08 +01:00