Commit Graph

50 Commits

Author SHA1 Message Date
jimmijj
b0f13404a0 Added information about redirection operators to README file. 2015-01-17 17:17:23 +01:00
jimmijj
b85b225dfb Added style for redirection operators. 2015-01-17 17:12:25 +01:00
jimmijj
25b83ca8a9 Prevent matching of command prefix if path is written explicitly. This solves issue that prefix '/l' matches '/bin//ls' (with two slashes what is valid syntax for zsh). 2014-10-04 17:12:20 +00:00
jimmijj
f728546b74 Defined predicate_switcher function in order to be able to use main highlighter when cursor has moved. Normally turning on this feature for the whole main highlighter is not advisable, however it is still helpful in edge cases and solves the problem with highlighting the prefix of the path and file. To prevent slowdown the predicate_switcher is defined in such a way that it activates main highlighter with respect to cursor movement just for one call, and after that returns automatically to the default mode, i.e. highlighting only after buffer is modified. 2014-10-04 00:36:01 +00:00
jimmijj
df99f5f61a Bug fix: when editing multi-line complex command highlighting was shifted by one character starting from second line. This behaviour was due to splitting of BUFFER using shell parser ${(z)BUFFER}, which basically changes all newlines to semicolons. 2014-10-03 17:26:14 +00:00
jimmijj
6d9a34065c Add condition that path_approx should be highlighted only if $#arg > 3, otherwise it matches too many things. (but do we need path_approx at all?) 2014-10-03 13:37:52 +00:00
jimmijj
4a82aab578 Check for TOKENS_COMMANDSEPARATOR even if $new_expression=false to highlight properly consecutive command separators like 'echo a; ; ; echo b'. 2014-10-03 13:01:27 +00:00
jimmijj
df2041e2d6 Make a few variables local 2014-09-29 13:30:26 +00:00
jimmijj
7e334e7fe8 Add ZSH_HIGHLIGHT_STYLES[file] style to change color for all files at once 2014-09-26 20:14:45 +00:00
jimmijj
d69a3685fc Add description of highlighting style for files to highlighter/main/README.md 2014-09-26 19:26:10 +00:00
jimmijj
03822157ac Merge remote-tracking branch 'upstream/master' 2014-09-26 16:27:32 +00:00
jimmijj
f342c5e0cd Added missing separators: '&|', '|&' and '&!' 2014-09-24 00:04:49 +00:00
jimmijj
28a5c6e3f0 Add highlighting for files based on $LS_COLORS environment variable. 2014-09-23 23:44:45 +00:00
jimmijj
85d1268b5a Changed ${#BUFFER} to ${#LBUFFER} in function _zsh_highlight_main_highlighter_check_path() in order to allow edit in the middle of the line without losing path colors in some cases 2014-09-23 23:02:54 +00:00
jimmijj
1a8e14fad2 Add command_prefix style 2014-09-23 22:38:27 +00:00
sonnym
04f9c8884f highlight ^old^new pattern
by extending the already in place mechanism of checking for the first
histchar to check for the second as well
2013-12-07 05:11:19 -05:00
Julien Nicoulaud
f289a9f8e7 Merge pull request #125 from acatton/fix-121
Fix #121: sudo syntax highlighting incorrectly
2013-11-19 11:42:03 -08:00
Julien Nicoulaud
8ac964186d Merge pull request #131 from MarkLodato/array-assignments
Properly highlight array assignments
2013-11-19 11:40:29 -08:00
Julien Nicoulaud
ffce2a0b20 Merge pull request #133 from lucc/master
protect alias expansion from interpreting aliases as options
2013-11-19 11:39:40 -08:00
Lucas Hoffmann
784a5dc35b protect alias expansion from interpreting aliases as options
If one defines aliases like `++` the alias builtin tries to interprete these
as options so they have to be protected like this

    alias -- ++=true

The same goes for a call to `alias` in order to expand the alias again.
2013-11-05 00:50:20 +01:00
Mark Lodato
441f1a8aad highlight array assignments of the form x[y]=...
This code is more lenient than bash.  Examples:

    $ x[y[]=
    zsh: no matches found: x[y[]=
    $ x[][]=
    zsh: no matches found: x[][]=

The proper solution is to look inside the [...] and make sure that all
unescaped/unquoted square brackes are matched, but that is a heck of
a lot more complicated than this simple 8-character patch.
2013-10-30 00:53:46 -04:00
Mark Lodato
c62cb54e9d do not remove quotes when checking assignments
Zsh does not allow the variable name or the equals sign to be quoted or
escaped.  The previous code incorrectly highlighted the following
examples as assignments:

    $ 'x=y'
    zsh: command not found: x=y
    $ x\=y
    zsh: command not found: x=y
    $ "x"=y
    zsh: command not found: x=y
    $ \x=y
    zsh: command not found: x=y
2013-10-30 00:00:16 -04:00
Akinori MUSHA
0fc6b07509 Do not leak a variable: cdpath_dir.
Leaking a variable that holds a path in CDPATH could easily end up appearing on your prompt like `~cdpath_dir/subdir`.
2013-10-21 21:18:38 +09:00
Antoine Catton
3b3a58be91 Fix #121: sudo syntax highlighting incorrectly
Parse sudo command line in order to highlight the options correctly
2013-09-28 19:33:34 -06:00
Julien Nicoulaud
dbd27cb30a #155: document path_prefix/path_approx 2013-08-09 09:56:28 +02:00
Julien Nicoulaud
08b80022ca Merge pull request #123 from Shura0/master
Highlighted dollar variable ver. 2
2013-08-09 00:47:32 -07:00
Shura
a7ee0597ef Update main-highlighter.zsh
Comments added
2013-08-09 10:24:14 +04:00
Julien Nicoulaud
3677b75731 Merge pull request #115 from Valodim/master
add separate path_prefix and path_approx hilights
2013-08-08 07:31:46 -07:00
Владимир
57c01d19de Update main-highlighter.zsh
Add support of CDPATH
2013-08-07 03:21:15 +03:00
Shura
8abcf187f6 dollar variable and backslash codes highlighting 2013-07-29 17:33:34 +04:00
Vincent Breitmoser
228f5a6aad add separate path_prefix and path_approx hilights 2013-07-25 04:41:09 +02:00
evan
19981ef9ea added sudo as a precommand 2012-08-17 15:52:09 -04:00
Jud Porter
d82eee5212 add emulate -L zsh to _zsh_highlight_main_highlighter. resolves issue #83 2011-12-02 16:44:33 -05:00
Julien Nicoulaud
f824e5e84d Options should only be set locally 2011-09-24 14:42:55 +02:00
Andreas Gahr
024c1c46f7 next try. fix for issue #76 without brakeing fix for #21 2011-09-24 20:39:34 +08:00
Julien Nicoulaud
8d4cde6301 (Hopefully) fix #21 (tilde and hashed directories in paths) 2011-09-20 19:13:37 +02:00
Julien Nicoulaud
db8f98fc53 Set default style for pipes and stuff to none 2011-09-20 19:13:37 +02:00
Andreas Gahr
287167d453 fix for issue #76. This was more ore less forgotten in pull request #75 2011-09-20 19:13:37 +02:00
Andreas Gahr
670961ad01 handle highlighting for precommands; handle highlighting for commands separators 2011-09-20 19:13:37 +02:00
Andreas Gahr
f84f9319d8 supposed fix for issue #73 and issue #74 2011-09-09 16:07:49 +02:00
Julien Nicoulaud
a6d105131c Fix #21: No highlighting when using tilde 2011-09-06 19:21:40 +02:00
Takeshi Banse
1d729202ec add tests for handling tildes
Signed-off-by: Takeshi Banse <takebi@laafc.net>
2011-09-07 01:14:45 +08:00
Takeshi Banse
48a18291f9 add some tests
Signed-off-by: Takeshi Banse <takebi@laafc.net>
2011-09-07 01:14:45 +08:00
Takeshi Banse
4a8b184632 pass ${arg} explicit
Signed-off-by: Takeshi Banse <takebi@laafc.net>
2011-09-07 01:14:45 +08:00
Andreas Gahr
33813c6a52 simple testcases for bracket highlighter 2011-08-05 16:25:47 +02:00
Valodim
f27ef7a279 after exec token we can expect a command 2011-08-02 00:55:55 +08:00
Julien Nicoulaud
e7d7ccfe35 Group if statements in f26310d97e 2011-06-16 14:54:24 +02:00
Guido
f26310d97e * enable command lines starting with a hyphen. 2011-06-16 04:28:59 -07:00
Julien Nicoulaud
ef4f5ed638 Fix READMEs 2011-06-12 23:16:41 +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