* Vim syntax file for zsh @ 2004-12-01 7:40 Felix Rosencrantz 2004-12-01 8:43 ` Danek Duvall ` (2 more replies) 0 siblings, 3 replies; 34+ messages in thread From: Felix Rosencrantz @ 2004-12-01 7:40 UTC (permalink / raw) To: zsh-users Anyone have a better version of zsh.vim? The version that comes with vim 6.3 is ok, but could be much better. It has a few bugs, like unmatched single quotes within double quotes, confuse it. Also, it's missing some standard keywords (e.g. repeat, until, foreach, select). It would be nice if it recognized completion related functions, variables, syntax (e.g. #compdef lines). The _chown completion function exhibits some of the problems. -FR ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-01 7:40 Vim syntax file for zsh Felix Rosencrantz @ 2004-12-01 8:43 ` Danek Duvall 2004-12-01 12:02 ` Nikolai Weibull 2004-12-01 15:32 ` Ziggy 2 siblings, 0 replies; 34+ messages in thread From: Danek Duvall @ 2004-12-01 8:43 UTC (permalink / raw) To: Felix Rosencrantz; +Cc: zsh-users On Tue, Nov 30, 2004 at 11:40:41PM -0800, Felix Rosencrantz wrote: > Anyone have a better version of zsh.vim? Here's what I'm currently using: http://www.comfychair.org/~duvall/sh.vim You'll need to make mods to filetype.vim and scripts.vim to get this to work (it make zsh a peer of bash and ksh), but you can do those to an individual user's copy of those files. I can provide those too, if you like. Danek ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-01 7:40 Vim syntax file for zsh Felix Rosencrantz 2004-12-01 8:43 ` Danek Duvall @ 2004-12-01 12:02 ` Nikolai Weibull 2004-12-03 8:02 ` Felix Rosencrantz 2004-12-01 15:32 ` Ziggy 2 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-01 12:02 UTC (permalink / raw) To: zsh-users [-- Attachment #1: Type: text/plain, Size: 462 bytes --] * Felix Rosencrantz <f.rosencrantz@gmail.com> [Dec 01, 2004 12:40]: > Anyone have a better version of zsh.vim? Yes, but it isn't great. You may definetely give enhancement tips, nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} [-- Attachment #2: zsh.vim --] [-- Type: text/plain, Size: 5133 bytes --] " Vim syntax file " Language: Zsh shell script " Maintainer: Nikolai Weibull <source@pcppopper.org> " URL: http://www.pcppopper.org/vim/syntax/pcp/zsh/ " Latest Revision: 2004-10-20 " arch-tag: 2e2c7097-99cb-4b87-a771-3a819b69995e if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " Set iskeyword since we need `-' (and potentially others) in keywords. " For version 5.x: Set it globally " For version 6.x: Set it locally if version >= 600 command -nargs=1 SetIsk setlocal iskeyword=<args> else command -nargs=1 SetIsk set iskeyword=<args> endif SetIsk @,48-57,_,- delcommand SetIsk " Todo syn keyword zshTodo contained TODO FIXME XXX NOTE " Comments syn region zshComment matchgroup=zshComment start='\(^\|\s\)#' end='$' contains=zshTodo " Strings syn match zshQuoted '\\.' syn region zshString matchgroup=zshString start=+"+ skip=+\\"+ end=+"+ contains=zshQuoted syn region zshString matchgroup=zshString start=+'+ end=+'+ syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' " Precommand Modifiers syn keyword zshPrecommand noglob nocorrect exec command builtin syn match zshPrecommand '\<-\s' " Delimiters syn keyword zshDelimiter do done " Conditionals syn keyword zshConditional if then elif else fi case in esac select " Loops syn keyword zshRepeat for while until repeat foreach " Keywords syn keyword zshKeyword function time " Functions syn match zshFunction '\k\+\s*\ze()' " Redirections syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)' syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' syn match zshRedir '|&\=' " Here Documents if version < 600 " Do nothing for now TODO: do something else syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' end='^\s*\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(["'\\]\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(["'\\]\S*\)' end='^\s*\z1$' endif " Variables syn match zshShellVar '\$[!#$*@?_-]' syn match zshShellVar '\$\d\+' "syn match zshShellVar '$\(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\| " Commands syn match zshCommands '\s[.:]\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd chdir syn keyword zshCommands clone comparguments compcall compctl compdescribe syn keyword zshCommands compfiles compgroups compquote comptags comptry syn keyword zshCommands compvalues continue declare dirs disable disown syn keyword zshCommands echo echotc echoti emulate enable eval exec exit syn keyword zshCommands export false fc fg functions getcap getln syn keyword zshCommands getopts hash history jobs kill let limit syn keyword zshCommands log logout popd print printf pushd pushln syn keyword zshCommands pwd r read readonly rehash return sched set syn keyword zshCommands setcap setopt shift source stat suspend test times syn keyword zshCommands trap true ttyctl type ulimit umask unalias syn keyword zshCommands unfunction unhash unlimit unset unsetopt vared syn keyword zshCommands wait whence where which zcompile zformat zftp zle syn keyword zshCommands zmodload zparseopts zprof zpty zregexparse zsocket syn keyword zshCommands zstyle ztcp " Types syn keyword zshTypes float integer local typeset " Switches " XXX: this may be too much syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' " Numbers syn match zshNumber '\<-\=\(\d\+#\|0x\=\)\=\d\+' syn match zshNumber '\<-\=\d\+.\d\+' " Substitution syn region zshSubst matchgroup=zshShellVar transparent start='\$(' end=')' syn region zshSubst matchgroup=zshShellVar transparent start='\$((' end='))' syn region zshSubst matchgroup=zshShellVar start='\${' skip='\\}' end='}' contains=zshSubst " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_zsh_syn_inits") if version < 508 let did_zsh_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink zshTodo Todo HiLink zshComment Comment HiLink zshQuoted SpecialChar HiLink zshString String HiLink zshJobSpec Special HiLink zshPrecommand Special HiLink zshDelimiter Keyword HiLink zshConditional Conditional HiLink zshRepeat Repeat HiLink zshKeyword Keyword HiLink zshFunction Function HiLink zshHereDoc String HiLink zshRedir Operator HiLink zshShellVar Identifier HiLink zshCommands Keyword HiLink zshTypes Type HiLink zshSwitches Special HiLink zshNumber Number HiLink zshSubst Identifier delcommand HiLink endif let b:current_syntax = "zsh" " vim: set sts=2 sw=2: ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-01 12:02 ` Nikolai Weibull @ 2004-12-03 8:02 ` Felix Rosencrantz 2004-12-04 15:54 ` Clint Adams 2004-12-04 16:42 ` Vim syntax file for zsh Nikolai Weibull 0 siblings, 2 replies; 34+ messages in thread From: Felix Rosencrantz @ 2004-12-03 8:02 UTC (permalink / raw) To: zsh-users I'm not a vim expert, I'm thinking there might be a better way to allow me compare these syntax files side-by-side in the same process. I had to do it in separate runs. Viewing completion function files under the cvs tree (e.g. Completion/Unix/Type/_files) It seems like both of these syntax files had some problems with variable syntax. Though Nikolai's seems to behave better. The one Danek sent marked some of the variables with red (meaning syntax errors.) Neither knows about the new always keyword. Though Nikolai's had problems with variables not listed in braces (e.g. $#foo would only highlight the '$#'). It would only highlight the first character. I would like to see the syntax files be able to handle more of the parameter expansion syntax and flags (like found in man zshexpn) . It would be nice if it could color things like: "${(@j:|:M)${(@)tmp#-}#?}" or show an error if it saw code like "${(b)tmp} ('b' is not a valid flag). Also things like the first line #compdef or #autoload lines are not marked or highlighted in any way, other than as a comment. My focus is on completion functions, since they provide a good body of source that use the zsh syntax. Also, they contain quite a bit of parameter syntax. Both files seem better than the default one that comes with vim. Very nice. -FR. On Wed, 1 Dec 2004 13:02:02 +0100, Nikolai Weibull > Yes, but it isn't great. You may definetely give enhancement tips, > nikolai ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-03 8:02 ` Felix Rosencrantz @ 2004-12-04 15:54 ` Clint Adams 2004-12-04 16:42 ` Nikolai Weibull 2004-12-04 16:42 ` Vim syntax file for zsh Nikolai Weibull 1 sibling, 1 reply; 34+ messages in thread From: Clint Adams @ 2004-12-04 15:54 UTC (permalink / raw) To: Felix Rosencrantz; +Cc: zsh-users > I'm not a vim expert, I'm thinking there might be a better way to > allow me compare these syntax files side-by-side in the same process. > I had to do it in separate runs. vimdiff? > Both files seem better than the default one that comes with vim. Very nice. Perhaps someone should share these improvements with vim upstream. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-04 15:54 ` Clint Adams @ 2004-12-04 16:42 ` Nikolai Weibull 2004-12-04 17:00 ` OT: vim maintainer [Re: Vim syntax file for zsh] Clint Adams 0 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-04 16:42 UTC (permalink / raw) To: zsh-users * Clint Adams <clint@zsh.org> [Dec 04, 2004 17:00]: > > Both files seem better than the default one that comes with vim. > Perhaps someone should share these improvements with vim upstream. Maintainer has been unavailable, nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} ^ permalink raw reply [flat|nested] 34+ messages in thread
* OT: vim maintainer [Re: Vim syntax file for zsh] 2004-12-04 16:42 ` Nikolai Weibull @ 2004-12-04 17:00 ` Clint Adams 2004-12-04 22:04 ` Nikolai Weibull 0 siblings, 1 reply; 34+ messages in thread From: Clint Adams @ 2004-12-04 17:00 UTC (permalink / raw) To: zsh-users > Maintainer has been unavailable, FWIW, he's posted to (and issued patches to) mailing lists within the past few hours. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: OT: vim maintainer [Re: Vim syntax file for zsh] 2004-12-04 17:00 ` OT: vim maintainer [Re: Vim syntax file for zsh] Clint Adams @ 2004-12-04 22:04 ` Nikolai Weibull 0 siblings, 0 replies; 34+ messages in thread From: Nikolai Weibull @ 2004-12-04 22:04 UTC (permalink / raw) To: zsh-users * Clint Adams <clint@zsh.org> [Dec 04, 2004 18:10]: > > Maintainer has been unavailable, > FWIW, he's posted to (and issued patches to) mailing lists within the > past few hours. Oh? I haven't seen them. Are we talking about " Vim syntax file " Language: Z shell (zsh) " Maintainer: Felix von Leitner <leitner@math.fu-berlin.de> " Heavily based on sh.vim by Lennart Schultz " Last Change: 2003 May 11 ? Anyway, nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-03 8:02 ` Felix Rosencrantz 2004-12-04 15:54 ` Clint Adams @ 2004-12-04 16:42 ` Nikolai Weibull 2004-12-08 8:13 ` Felix Rosencrantz 2004-12-08 13:15 ` Doug Kearns 1 sibling, 2 replies; 34+ messages in thread From: Nikolai Weibull @ 2004-12-04 16:42 UTC (permalink / raw) To: zsh-users [-- Attachment #1: Type: text/plain, Size: 3058 bytes --] * Felix Rosencrantz <f.rosencrantz@gmail.com> [Dec 03, 2004 15:11]: > Viewing completion function files under the cvs tree (e.g. > Completion/Unix/Type/_files) It seems like both of these syntax files > had some problems with variable syntax. Though Nikolai's seems to > behave better. It should, it doesn't try to highlight very much. > Though Nikolai's had problems with variables not listed in braces > (e.g. $#foo would only highlight the '$#'). It would only highlight > the first character. This is intentional. Well, at least somewhat. The $# in the part of $#foo shouldn't be, I fixed that (but $# on its own should). My reasoning is that you want "special" variables, such as $#, $n, and the like to be highlighted, as well as advanced stuff such as ${...} allows, but not necesarilly $foo, as the highlighting can become rather cluttered, as in the standard Vim one. The question is, does this make sense to most other people? I'm actually thinking that none of them should be highlighted, not even those that are "special". Any input? Three choices: 1. Highlight all variable references alike. 2. Highlight only "special" variables, such as $$, $#, and $n. 3. Highlight no variable references at all. If you look at the C syntax definition, no variable references are highlighted, and this isn't only due to the fact that it is infinitely much harder to determine what a variable in C (no marking $) is but also to keep things simple and clean. Variables are everywhere, so highlighting all of them makes the display cluttered. > I would like to see the syntax files be able to handle more of the > parameter expansion syntax and flags (like found in man zshexpn) . > It would be nice if it could color things like: > "${(@j:|:M)${(@)tmp#-}#?}" or show an error if it saw code like > "${(b)tmp} ('b' is not a valid flag). I have come, after much experimentation and many syntax definitions for many different kinds of formats and languages, that trying to do syntax validation in a syntax definition is not the right place. One may debate that certain errors can and should be caught in the syntax definition, but I hardly see ${(b)tmp} to be an instance of this case. The problem is that once the 'b' becomes a valid flag, the syntax definition is more or less useless, as it will report false information to its user. > Also things like the first line #compdef or #autoload lines are not > marked or highlighted in any way, other than as a comment. Hm, that's an interesting suggestion. The #! /bin/shell stuff should perhaps also be highlighted. It's simple enough to add. Could you perhaps point me to where I find the exact information that may appear in a beginning comment line? I always seem to lose that page in the info pages. nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} [-- Attachment #2: zsh.vim --] [-- Type: text/plain, Size: 5227 bytes --] " Vim syntax file " Language: Zsh shell script " Maintainer: Nikolai Weibull <source@pcppopper.org> " URL: http://www.pcppopper.org/vim/syntax/pcp/zsh/ " Latest Revision: 2004-12-04 " arch-tag: 2e2c7097-99cb-4b87-a771-3a819b69995e if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " Set iskeyword since we need `-' (and potentially others) in keywords. " For version 5.x: Set it globally " For version 6.x: Set it locally if version >= 600 command -nargs=1 SetIsk setlocal iskeyword=<args> else command -nargs=1 SetIsk set iskeyword=<args> endif SetIsk @,48-57,_,- delcommand SetIsk " Todo syn keyword zshTodo contained TODO FIXME XXX NOTE " Comments syn region zshComment matchgroup=zshComment start='\(^\|\s\)#' end='$' contains=zshTodo " Strings syn match zshQuoted '\\.' syn region zshString matchgroup=zshString start=+"+ skip=+\\"+ end=+"+ contains=zshQuoted syn region zshString matchgroup=zshString start=+'+ end=+'+ syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' " Precommand Modifiers syn keyword zshPrecommand noglob nocorrect exec command builtin syn match zshPrecommand '\<-\s' " Delimiters syn keyword zshDelimiter do done " Conditionals syn keyword zshConditional if then elif else fi case in esac select " Exceptions syn keyword zshException always " Loops syn keyword zshRepeat for while until repeat foreach " Keywords syn keyword zshKeyword function time " Functions syn match zshFunction '\k\+\s*\ze()' " Redirections syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)' syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' syn match zshRedir '|&\=' " Here Documents if version < 600 " Do nothing for now TODO: do something else syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' end='^\s*\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(["'\\]\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(["'\\]\S*\)' end='^\s*\z1$' endif " Variables syn match zshShellVar '\$[!#$*@?_-]\w\@!' syn match zshShellVar '\$\d\+\>' "syn match zshShellVar '$\(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\| " Commands syn match zshCommands '\s[.:]\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd chdir syn keyword zshCommands clone comparguments compcall compctl compdescribe syn keyword zshCommands compfiles compgroups compquote comptags comptry syn keyword zshCommands compvalues continue declare dirs disable disown syn keyword zshCommands echo echotc echoti emulate enable eval exec exit syn keyword zshCommands export false fc fg functions getcap getln syn keyword zshCommands getopts hash history jobs kill let limit syn keyword zshCommands log logout popd print printf pushd pushln syn keyword zshCommands pwd r read readonly rehash return sched set syn keyword zshCommands setcap setopt shift source stat suspend test times syn keyword zshCommands trap true ttyctl type ulimit umask unalias syn keyword zshCommands unfunction unhash unlimit unset unsetopt vared syn keyword zshCommands wait whence where which zcompile zformat zftp zle syn keyword zshCommands zmodload zparseopts zprof zpty zregexparse zsocket syn keyword zshCommands zstyle ztcp " Types syn keyword zshTypes float integer local typeset " Switches " XXX: this may be too much syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' " Numbers syn match zshNumber '\<-\=\(\d\+#\|0x\=\)\=\d\+\>' syn match zshNumber '\<-\=\d\+.\d\+\>' " Substitution syn region zshSubst matchgroup=zshShellVar transparent start='\$(' end=')' syn region zshSubst matchgroup=zshShellVar transparent start='\$((' end='))' syn region zshSubst matchgroup=zshShellVar start='\${' skip='\\}' end='}' contains=zshSubst " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_zsh_syn_inits") if version < 508 let did_zsh_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink zshTodo Todo HiLink zshComment Comment HiLink zshQuoted SpecialChar HiLink zshString String HiLink zshJobSpec Special HiLink zshPrecommand Special HiLink zshDelimiter Keyword HiLink zshConditional Conditional HiLink zshException Exception HiLink zshRepeat Repeat HiLink zshKeyword Keyword HiLink zshFunction Function HiLink zshHereDoc String HiLink zshRedir Operator HiLink zshShellVar Identifier HiLink zshCommands Keyword HiLink zshTypes Type HiLink zshSwitches Special HiLink zshNumber Number HiLink zshSubst Identifier delcommand HiLink endif let b:current_syntax = "zsh" " vim: set sts=2 sw=2: ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-04 16:42 ` Vim syntax file for zsh Nikolai Weibull @ 2004-12-08 8:13 ` Felix Rosencrantz 2004-12-08 13:47 ` Nikolai Weibull 2004-12-08 13:15 ` Doug Kearns 1 sibling, 1 reply; 34+ messages in thread From: Felix Rosencrantz @ 2004-12-08 8:13 UTC (permalink / raw) To: zsh-users On Sat, 4 Dec 2004 17:42:17 +0100, Nikolai Weibull <mailing-lists.zsh-users@rawuncut.elitemail.org> wrote: > I'm actually thinking that none of them should be highlighted, not even > those that are "special". Any input? > > Three choices: > > 1. Highlight all variable references alike. > 2. Highlight only "special" variables, such as $$, $#, and $n. > 3. Highlight no variable references at all. I would prefer 1&2 together, and then 1 in that order. > If you look at the C syntax definition, no variable references are > highlighted, and this isn't only due to the fact that it is infinitely > much harder to determine what a variable in C (no marking $) is but also > to keep things simple and clean. Variables are everywhere, so > highlighting all of them makes the display cluttered. I appreciate your point about the cluttering. Though I like the perl syntax coloring. It deals with all the little context regions special to perl like different types of quotes, search regex, replace strings, heredocs, etc. I think zsh is closer to perl than C in that it has a lot of little special contexts with their own rules. (Not sure what you call this language property.) Having the coloring expose those special areas can make code more readable. My interest is looking at existing code and trying to understand it. I'm typically looking at the completion and zle widget code that comes with zsh, and that code contains a lot of these nested parameter expressions. And with no highlighting or with a single color highlighting, the coloring doesn't help as much as it seems like it could. > Also things like the first line #compdef or #autoload lines are not > > marked or highlighted in any way, other than as a comment. > > Hm, that's an interesting suggestion. The #! /bin/shell stuff should > perhaps also be highlighted. It's simple enough to add. > > Could you perhaps point me to where I find the exact information that > may appear in a beginning comment line? I always seem to lose that > page in the info pages. This looks like this contains the information you would need: http://zsh.sunsite.dk/Doc/Release/zsh_19.html#SEC116 -FR. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-08 8:13 ` Felix Rosencrantz @ 2004-12-08 13:47 ` Nikolai Weibull 2004-12-08 18:14 ` Nikolai Weibull 0 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-08 13:47 UTC (permalink / raw) To: zsh-users * Felix Rosencrantz <f.rosencrantz@gmail.com> [Dec 08, 2004 14:00]: > > I'm actually thinking that none of them should be highlighted, not even > > those that are "special". Any input? > > > > Three choices: > > 1. Highlight all variable references alike. > > 2. Highlight only "special" variables, such as $$, $#, and $n. > > 3. Highlight no variable references at all. > I would prefer 1&2 together, and then 1 in that order. OK, but as Doug said, I'l make it configurable. I just tried a test out and it turned everything blue basically, so I couldn't live with it myself. I'll try to get an updated version out soon. nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-08 13:47 ` Nikolai Weibull @ 2004-12-08 18:14 ` Nikolai Weibull 2004-12-09 13:59 ` lists 0 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-08 18:14 UTC (permalink / raw) To: zsh-users [-- Attachment #1: Type: text/plain, Size: 1203 bytes --] * Nikolai Weibull [Dec 08, 2004 14:50]: > OK, but as Doug said, I'l make it configurable. I just tried a test > out and it turned everything blue basically, so I couldn't live with > it myself. I'll try to get an updated version out soon. OK, here it is. It's quite updated, so something may still have changed for the worse, but all substitutions seem to work fine, even with nested crap. Also, the dereferencing is now controllable through an option: let zsh_syntax_variables = 'short,long,all' where all encloses the previous two, and any combination of the other two may be used. short is for short special variables, e.g., $$ and $0 whereas long is for $ARGC, $status, and so on... I also added code to highlight variable assignments, which perhaps makes some sense. The color of variable dereferencing has also changed from Identifier to PreProc to match the colors of syntax/sh.vim. What do you think? nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} [-- Attachment #2: zsh.vim --] [-- Type: text/plain, Size: 6825 bytes --] " Vim syntax file " Language: Zsh shell script " Maintainer: Nikolai Weibull <source@pcppopper.org> " URL: http://www.pcppopper.org/vim/syntax/pcp/zsh/ " Latest Revision: 2004-12-08 " arch-tag: 2e2c7097-99cb-4b87-a771-3a819b69995e if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " Set iskeyword since we need `-' (and potentially others) in keywords. " For version 5.x: Set it globally " For version 6.x: Set it locally if version >= 600 command -nargs=1 SetIsk setlocal iskeyword=<args> else command -nargs=1 SetIsk set iskeyword=<args> endif SetIsk @,48-57,_,- delcommand SetIsk " Todo syn keyword zshTodo contained TODO FIXME XXX NOTE " Comments syn region zshComment matchgroup=zshComment start='\(^\|\s\)#' end='$' contains=zshTodo " PreProc syn match zshPreProc '^\%1l#\(!\|compdef\|autoload\).*$' " Strings syn match zshQuoted '\\.' syn region zshString matchgroup=zshString start=+"+ end=+"+ contains=zshQuoted syn region zshString matchgroup=zshString start=+'+ end=+'+ " XXX: This should probably be more precise, but Zsh seems a bit confused about it itself syn region zshPOSIXString matchgroup=zshString start=+\$'+ end=+'+ contains=zshQuoted syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' " Precommand Modifiers syn keyword zshPrecommand noglob nocorrect exec command builtin - time " Delimiters syn keyword zshDelimiter do done " Conditionals syn keyword zshConditional if then elif else fi case in esac select " Loops syn keyword zshRepeat for while until repeat foreach " Exceptions syn keyword zshException always " Keywords syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite " Functions syn match zshKSHFunction contained '\k\+' syn match zshFunction '\k\+\s*\ze()' " Redirections syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)' syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' syn match zshRedir '|&\=' " Here Documents if version < 600 " Do nothing for now TODO: do something else syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' end='^\s*\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(["'\\]\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(["'\\]\S*\)' end='^\s*\z1$' endif " Variable Assignments syn match zshVariable '\<\h\w*\ze+\==' " XXX: how safe is this? syn region zshVariable matchgroup=zshVariable start='\$\@<!\<\h\w*\[' end='\]\ze+\==' contains=@zshSubst " Variable Dereferencing if !exists("g:zsh_syntax_variables") let s:zsh_syntax_variables = 'all' else let s:zsh_syntax_variables = g:zsh_syntax_variables endif if s:zsh_syntax_variables =~ 'short\|all' syn match zshShortDeref '\$[!#$*@?_-]\w\@!' syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' endif if s:zsh_syntax_variables =~ 'long\|all' syn match zshLongDeref '\$\(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' syn match zshLongDeref '\$\(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' syn match zshLongDeref '\$\(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' endif if s:zsh_syntax_variables =~ 'all' syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' endif " Commands syn match zshCommands '\s[.:]\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd chdir syn keyword zshCommands clone comparguments compcall compctl compdescribe syn keyword zshCommands compfiles compgroups compquote comptags comptry syn keyword zshCommands compvalues continue declare dirs disable disown syn keyword zshCommands echo echotc echoti emulate enable eval exec exit syn keyword zshCommands export false fc fg functions getcap getln syn keyword zshCommands getopts hash history jobs kill let limit syn keyword zshCommands log logout popd print printf pushd pushln syn keyword zshCommands pwd r read readonly rehash return sched set syn keyword zshCommands setcap setopt shift source stat suspend test times syn keyword zshCommands trap true ttyctl type ulimit umask unalias syn keyword zshCommands unfunction unhash unlimit unset unsetopt vared syn keyword zshCommands wait whence where which zcompile zformat zftp zle syn keyword zshCommands zmodload zparseopts zprof zpty zregexparse zsocket syn keyword zshCommands zstyle ztcp " Types syn keyword zshTypes float integer local typeset " Switches " XXX: this may be too much syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' " Numbers syn match zshNumber '\<-\=\(\d\+#\|0x\=\)\=\d\+\>' syn match zshNumber '\<-\=\d\+.\d\+\>' " Substitution " XXX: is this right? something may be wrong here syn cluster zshSubst contains=zshSubst,zshBrackets syn region zshBrackets transparent start='(' skip='\\)' end=')' contains=TOP syn region zshBrackets transparent start='{' skip='\\}' end='}' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$(' skip='\\)' end=')' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$((' end='))' contains=TOP syn region zshSubst matchgroup=zshSubst start='\${' skip='\\}' end='}' contains=@zshSubst " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_zsh_syn_inits") if version < 508 let did_zsh_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink zshTodo Todo HiLink zshComment Comment HiLink zshPreProc PreProc HiLink zshQuoted SpecialChar HiLink zshString String HiLink zshPOSIXString zshString HiLink zshJobSpec Special HiLink zshPrecommand Special HiLink zshDelimiter Keyword HiLink zshConditional Conditional HiLink zshException Exception HiLink zshRepeat Repeat HiLink zshKeyword Keyword HiLink zshFunction Function HiLink zshKSHFunction zshFunction HiLink zshHereDoc String HiLink zshRedir Operator HiLink zshVariable Identifier HiLink zshShortDeref zshDeref HiLink zshLongDeref zshDeref HiLink zshDeref PreProc HiLink zshCommands Keyword HiLink zshTypes Type HiLink zshSwitches Special HiLink zshNumber Number HiLink zshSubst zshDeref delcommand HiLink endif let b:current_syntax = "zsh" " vim: set sts=2 sw=2: ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-08 18:14 ` Nikolai Weibull @ 2004-12-09 13:59 ` lists 2004-12-09 14:45 ` Nikolai Weibull 0 siblings, 1 reply; 34+ messages in thread From: lists @ 2004-12-09 13:59 UTC (permalink / raw) To: zsh-users; +Cc: Nikolai Weibull Thanks! This is easier on the eyes in most cases than the standard zsh.vim. I noticed one thing that was a bit odd, though. Consider the following line: ${(M)${$(dscl /LDAPv3/127.0.0.1 . /Users/${USER} authAuthority)[(w)2]}#;*;} Your updated file isn't confused by the final # like the standard zsh.vim file, but it does color most of 127.0.0.1 a different color from the rest of the line. I'm not sure how to go about fixing that, but if you ever do update your zsh.vim file, please post it to the list. Thanks, Ryan On Dec 8, 2004, at 12:14 PM, Nikolai Weibull wrote: > * Nikolai Weibull [Dec 08, 2004 14:50]: >> OK, but as Doug said, I'l make it configurable. I just tried a test >> out and it turned everything blue basically, so I couldn't live with >> it myself. I'll try to get an updated version out soon. > > OK, here it is. It's quite updated, so something may still have > changed > for the worse, but all substitutions seem to work fine, even with > nested > crap. Also, the dereferencing is now controllable through an option: > > let zsh_syntax_variables = 'short,long,all' > > where all encloses the previous two, and any combination of the other > two may be used. short is for short special variables, e.g., $$ and $0 > whereas long is for $ARGC, $status, and so on... > > I also added code to highlight variable assignments, which perhaps > makes > some sense. The color of variable dereferencing has also changed from > Identifier to PreProc to match the colors of syntax/sh.vim. > > What do you think? > nikolai > > -- > ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: > ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: > ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: > main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} > <zsh.vim> ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 13:59 ` lists @ 2004-12-09 14:45 ` Nikolai Weibull 2004-12-09 16:36 ` Felix Rosencrantz 0 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-09 14:45 UTC (permalink / raw) To: zsh-users * lists <lists@kalama.no-ip.org> [Dec 09, 2004 15:00]: > Thanks! This is easier on the eyes in most cases than the standard > zsh.vim. Yeah, that's why I wrote it in the first place ;-). > I noticed one thing that was a bit odd, though. Consider the > following line: > ${(M)${$(dscl /LDAPv3/127.0.0.1 . /Users/${USER} > authAuthority)[(w)2]}#;*;} > Your updated file isn't confused by the final # like the standard > zsh.vim file, but it does color most of 127.0.0.1 a different color > from the rest of the line. I'm not sure how to go about fixing that, > but if you ever do update your zsh.vim file, please post it to the > list. It is seen as a number. One could debate the appropriateness of it, but I can't say that I see much harm in it. nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 14:45 ` Nikolai Weibull @ 2004-12-09 16:36 ` Felix Rosencrantz 2004-12-09 18:18 ` Nikolai Weibull 0 siblings, 1 reply; 34+ messages in thread From: Felix Rosencrantz @ 2004-12-09 16:36 UTC (permalink / raw) To: zsh-users Still looks good. :) A couple things: 1. When I first read your message, I sort of expected that it would highlight the special variables differently, even if I used the "all" setting. It doesn't do that, though that might be nice. 2. Strings: These snippets of code all color the same and probably shouldn't, the embedded variable reference in double quotes should be colored. 'SUSFU' 'SU$FU' "SU$FU" 3. Backquotes: While `su$fu` does not highlight the string itself, except for the variable reference. 4. Keyword Highlighting: Some unusualness with the local keyword and it's args: In _files, I notice at the very start some odd coloring on the word type, since it is a keyword. Though in this situation it is meant to be a local variable name: local type sdef Also for keywords that seem to be arguments, same file the argument "r:" stands out when it shouldn't: zparseopts blah blah r: blah blah This is more a problem with where keywords are found. Many keywords should only be marked as keywords when they are in a command position. Not sure if this is easy to do... 5. Assignments in Local: The assignment on the local line causes the left side of the assignment to be colored, which causes "ret=0" to standout in a distracting way, since the other variables are not highlighted... In this case it seems like the other variables should either be highlighted like lvalues or the "ret" should not be highlighted....: local sus fu foo ret=0 bar -FR. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 16:36 ` Felix Rosencrantz @ 2004-12-09 18:18 ` Nikolai Weibull 2004-12-09 18:23 ` Nikolai Weibull 0 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-09 18:18 UTC (permalink / raw) To: zsh-users * Felix Rosencrantz <f.rosencrantz@gmail.com> [Dec 09, 2004 17:40]: > 1. When I first read your message, I sort of expected that it would > highlight the special variables differently, even if I used the "all" > setting. It doesn't do that, though that might be nice. Hm, this'll make it too complex. One of the reasons i wrote this was because the distributed one was highlighting all kinds of craps as special, which are in turn highlighted as dark red on my display...very annoying. > 2. Strings: These snippets of code all color the same and probably > shouldn't, the embedded variable reference in double quotes should be > colored. > 'SUSFU' > 'SU$FU' > "SU$FU" True, I'll contain stuff like that in "..." strings. > 3. Backquotes: While `su$fu` does not highlight the string itself, > except for the variable reference. Ah, seems I forgot about the old-style command expansions, either intentionaly or otherwise. They should be frowned upon, but I'll add highlighting for them nonetheless. As it is now, embedded \` will be highlighted as special characters, which they aren't (they're recursive backquotes), but I think that works out as an advantage, as it will make them more visible. > 4. Keyword Highlighting: Some unusualness with the local keyword and > it's args: In _files, I notice at the very start some odd coloring on > the word type, since it is a keyword. Though in this situation it is > meant to be a local variable name: local type sdef > Also for keywords that seem to be arguments, same file the argument > "r:" stands out when it shouldn't: zparseopts blah blah r: blah blah > This is more a problem with where keywords are found. Many keywords > should only be marked as keywords when they are in a command position. > Not sure if this is easy to do... Yeah, this can be rather hard to get right, as commands can occur at so many different places. It would really require a parser to get this right. The upshot is, don't call variables by names that are also keywords. > 5. Assignments in Local: The assignment on the local line causes the > left side of the assignment to be colored, which causes "ret=0" to > standout in a distracting way, since the other variables are not > highlighted... In this case it seems like the other variables should > either be highlighted like lvalues or the "ret" should not be > highlighted....: > local sus fu foo ret=0 bar Well, that could be up for debate as well. Since it is an assignment, it should be highlighted as such in my opinion...surely sus, fu, foo, and bar get assigned to further down as well, where they will be highlighted correctly. That it stands out should only hint further that ret has been assigned to separately from the others, making sure that ret will be initialized correctly before use. Perhaps this should all be covered by another variable, like zsh_syntax_assignments? My big issue with assignments are with array subscript assignments, with which I'm not sure that it's working correctly for every instance. It has to be implemented as a region, as the subscript can be just about anything (well a substitution of some sort at least). nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 18:18 ` Nikolai Weibull @ 2004-12-09 18:23 ` Nikolai Weibull 2004-12-09 20:09 ` Wayne Davison 0 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-09 18:23 UTC (permalink / raw) To: zsh-users [-- Attachment #1: Type: text/plain, Size: 343 bytes --] * Nikolai Weibull [Dec 09, 2004 19:20]: Forgot attachment... nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} [-- Attachment #2: zsh.vim --] [-- Type: text/plain, Size: 7050 bytes --] " Vim syntax file " Language: Zsh shell script " Maintainer: Nikolai Weibull <source@pcppopper.org> " URL: http://www.pcppopper.org/vim/syntax/pcp/zsh/ " Latest Revision: 2004-12-09 " arch-tag: 2e2c7097-99cb-4b87-a771-3a819b69995e if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " Set iskeyword since we need `-' (and potentially others) in keywords. " For version 5.x: Set it globally " For version 6.x: Set it locally if version >= 600 command -nargs=1 SetIsk setlocal iskeyword=<args> else command -nargs=1 SetIsk set iskeyword=<args> endif SetIsk @,48-57,_,- delcommand SetIsk " Todo syn keyword zshTodo contained TODO FIXME XXX NOTE " Comments syn region zshComment matchgroup=zshComment start='\(^\|\s\)#' end='$' contains=zshTodo " PreProc syn match zshPreProc '^\%1l#\(!\|compdef\|autoload\).*$' " Strings syn match zshQuoted '\\.' syn region zshString matchgroup=zshString start=+"+ end=+"+ contains=zshQuoted,@zshDerefs,zshSubst syn region zshString matchgroup=zshString start=+'+ end=+'+ " XXX: This should probably be more precise, but Zsh seems a bit confused about it itself syn region zshPOSIXString matchgroup=zshString start=+\$'+ end=+'+ contains=zshQuoted syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' " Precommand Modifiers syn keyword zshPrecommand noglob nocorrect exec command builtin - time " Delimiters syn keyword zshDelimiter do done " Conditionals syn keyword zshConditional if then elif else fi case in esac select " Loops syn keyword zshRepeat for while until repeat foreach " Exceptions syn keyword zshException always " Keywords syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite " Functions syn match zshKSHFunction contained '\k\+' syn match zshFunction '\k\+\s*\ze()' " Redirections syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)' syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' syn match zshRedir '|&\=' " Here Documents if version < 600 " Do nothing for now TODO: do something else syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' end='^\s*\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(["'\\]\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(["'\\]\S*\)' end='^\s*\z1$' endif " Variable Assignments syn match zshVariable '\<\h\w*\ze+\==' " XXX: how safe is this? syn region zshVariable matchgroup=zshVariable start='\$\@<!\<\h\w*\[' end='\]\ze+\==' contains=@zshSubst " Variable Dereferencing syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref if !exists("g:zsh_syntax_variables") let s:zsh_syntax_variables = 'all' else let s:zsh_syntax_variables = g:zsh_syntax_variables endif if s:zsh_syntax_variables =~ 'short\|all' syn match zshShortDeref '\$[!#$*@?_-]\w\@!' syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' endif if s:zsh_syntax_variables =~ 'long\|all' syn match zshLongDeref '\$\(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' syn match zshLongDeref '\$\(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' syn match zshLongDeref '\$\(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' endif if s:zsh_syntax_variables =~ 'all' syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' endif " Commands syn match zshCommands '\s[.:]\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd chdir syn keyword zshCommands clone comparguments compcall compctl compdescribe syn keyword zshCommands compfiles compgroups compquote comptags comptry syn keyword zshCommands compvalues continue declare dirs disable disown syn keyword zshCommands echo echotc echoti emulate enable eval exec exit syn keyword zshCommands export false fc fg functions getcap getln syn keyword zshCommands getopts hash history jobs kill let limit syn keyword zshCommands log logout popd print printf pushd pushln syn keyword zshCommands pwd r read readonly rehash return sched set syn keyword zshCommands setcap setopt shift source stat suspend test times syn keyword zshCommands trap true ttyctl type ulimit umask unalias syn keyword zshCommands unfunction unhash unlimit unset unsetopt vared syn keyword zshCommands wait whence where which zcompile zformat zftp zle syn keyword zshCommands zmodload zparseopts zprof zpty zregexparse zsocket syn keyword zshCommands zstyle ztcp " Types syn keyword zshTypes float integer local typeset " Switches " XXX: this may be too much syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' " Numbers syn match zshNumber '\<-\=\(\d\+#\|0x\=\)\=\d\+\>' syn match zshNumber '\<-\=\d\+.\d\+\>' " Substitution " XXX: is this right? something may be wrong here syn cluster zshSubst contains=zshSubst,zshBrackets syn region zshBrackets transparent start='(' skip='\\)' end=')' contains=TOP syn region zshBrackets transparent start='{' skip='\\}' end='}' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$(' skip='\\)' end=')' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$((' end='))' contains=TOP syn region zshSubst matchgroup=zshSubst start='\${' skip='\\}' end='}' contains=@zshSubst syn region zshOldSubst matchgroup=zshOldSubst start=+`+ skip=+\\`+ end=+`+ contains=TOP,zshOldSubst " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_zsh_syn_inits") if version < 508 let did_zsh_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink zshTodo Todo HiLink zshComment Comment HiLink zshPreProc PreProc HiLink zshQuoted SpecialChar HiLink zshString String HiLink zshPOSIXString zshString HiLink zshJobSpec Special HiLink zshPrecommand Special HiLink zshDelimiter Keyword HiLink zshConditional Conditional HiLink zshException Exception HiLink zshRepeat Repeat HiLink zshKeyword Keyword HiLink zshFunction Function HiLink zshKSHFunction zshFunction HiLink zshHereDoc String HiLink zshRedir Operator HiLink zshVariable Identifier HiLink zshShortDeref zshDeref HiLink zshLongDeref zshDeref HiLink zshDeref PreProc HiLink zshCommands Keyword HiLink zshTypes Type HiLink zshSwitches Special HiLink zshNumber Number HiLink zshSubst zshDeref HiLink zshOldSubst zshSubst delcommand HiLink endif let b:current_syntax = "zsh" " vim: set sts=2 sw=2: ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 18:23 ` Nikolai Weibull @ 2004-12-09 20:09 ` Wayne Davison 2004-12-09 21:24 ` Nikolai Weibull 0 siblings, 1 reply; 34+ messages in thread From: Wayne Davison @ 2004-12-09 20:09 UTC (permalink / raw) To: zsh-users I've been trying this out, and I have a few comments: First, a bug: The zshVariable rule (after the "How safe is this?" comment) is misfiring on any [ that follows word characters. For instance, add "echo hi[" early in a zsh script, and the entire script should become the Identifier color. I don't know enough vim-syntax to fix this, so I just added XXXXX to the beginning of the "start" spec on that line, and the problem went away for now. I noticed that | and > are colored in the Operator color, but ; and & are not. I'd prefer to see them all colored as operators. I like the sh/bash string idiom where the quotes are colored as operator characters instead of as string characters (since they delimit the string). I simply changed the 3 uses of matchgroup=zshString into matchgroup=Operator, and it now works the way I want it to. I don't like the highlighting of command-line options in the same color as a variable. I just removed all the zshSwitches stuff, making them the default text color. That's just my $.02. Thanks for working on this! ..wayne.. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 20:09 ` Wayne Davison @ 2004-12-09 21:24 ` Nikolai Weibull 2004-12-09 22:43 ` Wayne Davison 2004-12-10 8:13 ` Stephane Chazelas 0 siblings, 2 replies; 34+ messages in thread From: Nikolai Weibull @ 2004-12-09 21:24 UTC (permalink / raw) To: zsh-users [-- Attachment #1: Type: text/plain, Size: 2853 bytes --] * Wayne Davison <wayned@users.sourceforge.net> [Dec 09, 2004 21:20]: > First, a bug: The zshVariable rule (after the "How safe is this?" > comment) is misfiring on any [ that follows word characters. For > instance, add "echo hi[" early in a zsh script, and the entire script > should become the Identifier color. Well, that [ should be quoted, so I'm not persuaded yet. > I don't know enough vim-syntax to fix this, so I just added XXXXX to > the beginning of the "start" spec on that line, and the problem went > away for now. Well, just remove the whole line? > I noticed that | and > are colored in the Operator color, but ; and & > are not. I'd prefer to see them all colored as operators. I can't remember my reasoning here, but I believe it was that | and > are rather more special than ; and &. The & will also be highlighted in &&. Also, &! should be highlighted if & is. However, I fear that perhaps none of them should be highlighted, as they add too much color to things that are obvious enough as it is. Question: Who wants what here? Personally, I'm contemplating on removing them all, i.e., zshRedir will be gone. It would be a bit assymetrical if we leave zshHereDoc in, but they are rather more useful to highlight. Anyways, I added matching for them for now. Tell me what you think, and remember that syntax highlighting only helps if important things are highlighted and background noise is kept as such. > I like the sh/bash string idiom where the quotes are colored as > operator characters instead of as string characters (since they > delimit the string). I simply changed the 3 uses of > matchgroup=zshString into matchgroup=Operator, and it now works the > way I want it to. Yeah, well I hate it and I hate any syntax definition that does this to me. It annoys my eyes when two characters next to each other have similar, but different, colors, especially when one is not much more than 6 pixels altogether. However, I may stretch it and have a matchgroup=zshStringDelimiter that is linked to zshString by default and then you may change it in your ~/.vim/after/syntax/zsh.vim. > I don't like the highlighting of command-line options in the same > color as a variable. I just removed all the zshSwitches stuff, making > them the default text color. Well, it's not; it's highlighted as Special. I could, however, agree with you that it is of limited value and should probably be removed, or at least not enabled by default. > That's just my $.02. Thanks for working on this! No problem, suggestions are always welcome. nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} [-- Attachment #2: zsh.vim --] [-- Type: text/plain, Size: 7199 bytes --] " Vim syntax file " Language: Zsh shell script " Maintainer: Nikolai Weibull <source@pcppopper.org> " URL: http://www.pcppopper.org/vim/syntax/pcp/zsh/ " Latest Revision: 2004-12-09 " arch-tag: 2e2c7097-99cb-4b87-a771-3a819b69995e if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " Set iskeyword since we need `-' (and potentially others) in keywords. " For version 5.x: Set it globally " For version 6.x: Set it locally if version >= 600 command -nargs=1 SetIsk setlocal iskeyword=<args> else command -nargs=1 SetIsk set iskeyword=<args> endif SetIsk @,48-57,_,- delcommand SetIsk " Todo syn keyword zshTodo contained TODO FIXME XXX NOTE " Comments syn region zshComment matchgroup=zshComment start='\(^\|\s\)#' end='$' contains=zshTodo " PreProc syn match zshPreProc '^\%1l#\(!\|compdef\|autoload\).*$' " Strings syn match zshQuoted '\\.' syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+ contains=zshQuoted,@zshDerefs,zshSubst syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ " XXX: This should probably be more precise, but Zsh seems a bit confused about it itself syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+ end=+'+ contains=zshQuoted syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' " Precommand Modifiers syn keyword zshPrecommand noglob nocorrect exec command builtin - time " Delimiters syn keyword zshDelimiter do done " Conditionals syn keyword zshConditional if then elif else fi case in esac select " Loops syn keyword zshRepeat for while until repeat foreach " Exceptions syn keyword zshException always " Keywords syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite " Functions syn match zshKSHFunction contained '\k\+' syn match zshFunction '\k\+\s*\ze()' " Operators syn match zshOperator '||\|&&\|;\|&!\=' " Redirections syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)' syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' syn match zshRedir '|&\=' " Here Documents if version < 600 " Do nothing for now TODO: do something else syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' end='^\s*\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(["'\\]\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(["'\\]\S*\)' end='^\s*\z1$' endif " Variable Assignments syn match zshVariable '\<\h\w*\ze+\==' " XXX: how safe is this? syn region zshVariable matchgroup=zshVariable start='\$\@<!\<\h\w*\[' end='\]\ze+\==' contains=@zshSubst " Variable Dereferencing syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref if !exists("g:zsh_syntax_variables") let s:zsh_syntax_variables = 'all' else let s:zsh_syntax_variables = g:zsh_syntax_variables endif if s:zsh_syntax_variables =~ 'short\|all' syn match zshShortDeref '\$[!#$*@?_-]\w\@!' syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' endif if s:zsh_syntax_variables =~ 'long\|all' syn match zshLongDeref '\$\(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' syn match zshLongDeref '\$\(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' syn match zshLongDeref '\$\(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' endif if s:zsh_syntax_variables =~ 'all' syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' endif " Commands syn match zshCommands '\s[.:]\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd chdir syn keyword zshCommands clone comparguments compcall compctl compdescribe syn keyword zshCommands compfiles compgroups compquote comptags comptry syn keyword zshCommands compvalues continue declare dirs disable disown syn keyword zshCommands echo echotc echoti emulate enable eval exec exit syn keyword zshCommands export false fc fg functions getcap getln syn keyword zshCommands getopts hash history jobs kill let limit syn keyword zshCommands log logout popd print printf pushd pushln syn keyword zshCommands pwd r read readonly rehash return sched set syn keyword zshCommands setcap setopt shift source stat suspend test times syn keyword zshCommands trap true ttyctl type ulimit umask unalias syn keyword zshCommands unfunction unhash unlimit unset unsetopt vared syn keyword zshCommands wait whence where which zcompile zformat zftp zle syn keyword zshCommands zmodload zparseopts zprof zpty zregexparse zsocket syn keyword zshCommands zstyle ztcp " Types syn keyword zshTypes float integer local typeset " Switches " XXX: this may be too much syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' " Numbers syn match zshNumber '\<-\=\(\d\+#\|0x\=\)\=\d\+\>' syn match zshNumber '\<-\=\d\+.\d\+\>' " Substitution " XXX: is this right? something may be wrong here syn cluster zshSubst contains=zshSubst,zshBrackets syn region zshBrackets transparent start='(' skip='\\)' end=')' contains=TOP syn region zshBrackets transparent start='{' skip='\\}' end='}' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$(' skip='\\)' end=')' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$((' end='))' contains=TOP syn region zshSubst matchgroup=zshSubst start='\${' skip='\\}' end='}' contains=@zshSubst syn region zshOldSubst matchgroup=zshOldSubst start=+`+ skip=+\\`+ end=+`+ contains=TOP,zshOldSubst " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_zsh_syn_inits") if version < 508 let did_zsh_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink zshTodo Todo HiLink zshComment Comment HiLink zshPreProc PreProc HiLink zshQuoted SpecialChar HiLink zshString String HiLink zshStringDelimiter zshString HiLink zshPOSIXString zshString HiLink zshJobSpec Special HiLink zshPrecommand Special HiLink zshDelimiter Keyword HiLink zshConditional Conditional HiLink zshException Exception HiLink zshRepeat Repeat HiLink zshKeyword Keyword HiLink zshFunction Function HiLink zshKSHFunction zshFunction HiLink zshHereDoc String HiLink zshOperator Operator HiLink zshRedir Operator HiLink zshVariable Identifier HiLink zshShortDeref zshDeref HiLink zshLongDeref zshDeref HiLink zshDeref PreProc HiLink zshCommands Keyword HiLink zshTypes Type HiLink zshSwitches Special HiLink zshNumber Number HiLink zshSubst zshDeref HiLink zshOldSubst zshSubst delcommand HiLink endif let b:current_syntax = "zsh" " vim: set sts=2 sw=2: ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 21:24 ` Nikolai Weibull @ 2004-12-09 22:43 ` Wayne Davison 2004-12-09 23:26 ` Nikolai Weibull 2004-12-10 8:13 ` Stephane Chazelas 1 sibling, 1 reply; 34+ messages in thread From: Wayne Davison @ 2004-12-09 22:43 UTC (permalink / raw) To: zsh-users On Thu, Dec 09, 2004 at 10:24:23PM +0100, Nikolai Weibull wrote: > Well, that [ should be quoted, so I'm not persuaded yet. Sorry, I had not meant that as a syntactically correct line, just a minimum number of characters to trigger the bug. The problem also occurs with a normal foo[0-9]-style string. > Well, just remove the whole line? Ah yes, I apparently tried commenting it out with a # instead of a " and fell back on the kluge of tweaking the "start" string instead. Thanks for the new version, ..wayne.. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 22:43 ` Wayne Davison @ 2004-12-09 23:26 ` Nikolai Weibull 2004-12-12 4:41 ` Felix Rosencrantz 0 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-09 23:26 UTC (permalink / raw) To: zsh-users [-- Attachment #1: Type: text/plain, Size: 1042 bytes --] * Wayne Davison <wayned@users.sourceforge.net> [Dec 09, 2004 23:50]: > > Well, that [ should be quoted, so I'm not persuaded yet. > Sorry, I had not meant that as a syntactically correct line, just a > minimum number of characters to trigger the bug. The problem also > occurs with a normal foo[0-9]-style string. Ah, so simple...and such a simple solution as well, all it needed was a oneline specifier to the region and it seems to be fixed fine. Please give this new version a go. I can't see any potential issues right now, but I'm not betting on it being so. > > Well, just remove the whole line? > Ah yes, I apparently tried commenting it out with a # instead of a " > and fell back on the kluge of tweaking the "start" string instead. Hehe, OK, nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} [-- Attachment #2: zsh.vim --] [-- Type: text/plain, Size: 7207 bytes --] " Vim syntax file " Language: Zsh shell script " Maintainer: Nikolai Weibull <source@pcppopper.org> " URL: http://www.pcppopper.org/vim/syntax/pcp/zsh/ " Latest Revision: 2004-12-10 " arch-tag: 2e2c7097-99cb-4b87-a771-3a819b69995e if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " Set iskeyword since we need `-' (and potentially others) in keywords. " For version 5.x: Set it globally " For version 6.x: Set it locally if version >= 600 command -nargs=1 SetIsk setlocal iskeyword=<args> else command -nargs=1 SetIsk set iskeyword=<args> endif SetIsk @,48-57,_,- delcommand SetIsk " Todo syn keyword zshTodo contained TODO FIXME XXX NOTE " Comments syn region zshComment matchgroup=zshComment start='\(^\|\s\)#' end='$' contains=zshTodo " PreProc syn match zshPreProc '^\%1l#\(!\|compdef\|autoload\).*$' " Strings syn match zshQuoted '\\.' syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+ contains=zshQuoted,@zshDerefs,zshSubst syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ " XXX: This should probably be more precise, but Zsh seems a bit confused about it itself syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+ end=+'+ contains=zshQuoted syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' " Precommand Modifiers syn keyword zshPrecommand noglob nocorrect exec command builtin - time " Delimiters syn keyword zshDelimiter do done " Conditionals syn keyword zshConditional if then elif else fi case in esac select " Loops syn keyword zshRepeat for while until repeat foreach " Exceptions syn keyword zshException always " Keywords syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite " Functions syn match zshKSHFunction contained '\k\+' syn match zshFunction '\k\+\s*\ze()' " Operators syn match zshOperator '||\|&&\|;\|&!\=' " Redirections syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)' syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' syn match zshRedir '|&\=' " Here Documents if version < 600 " Do nothing for now TODO: do something else syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' end='^\s*\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(["'\\]\S*\)' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(["'\\]\S*\)' end='^\s*\z1$' endif " Variable Assignments syn match zshVariable '\<\h\w*\ze+\==' " XXX: how safe is this? syn region zshVariable oneline matchgroup=zshVariable start='\$\@<!\<\h\w*\[' end='\]\ze+\==' contains=@zshSubst " Variable Dereferencing syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref if !exists("g:zsh_syntax_variables") let s:zsh_syntax_variables = 'all' else let s:zsh_syntax_variables = g:zsh_syntax_variables endif if s:zsh_syntax_variables =~ 'short\|all' syn match zshShortDeref '\$[!#$*@?_-]\w\@!' syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' endif if s:zsh_syntax_variables =~ 'long\|all' syn match zshLongDeref '\$\(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' syn match zshLongDeref '\$\(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' syn match zshLongDeref '\$\(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' endif if s:zsh_syntax_variables =~ 'all' syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' endif " Commands syn match zshCommands '\s[.:]\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd chdir syn keyword zshCommands clone comparguments compcall compctl compdescribe syn keyword zshCommands compfiles compgroups compquote comptags comptry syn keyword zshCommands compvalues continue declare dirs disable disown syn keyword zshCommands echo echotc echoti emulate enable eval exec exit syn keyword zshCommands export false fc fg functions getcap getln syn keyword zshCommands getopts hash history jobs kill let limit syn keyword zshCommands log logout popd print printf pushd pushln syn keyword zshCommands pwd r read readonly rehash return sched set syn keyword zshCommands setcap setopt shift source stat suspend test times syn keyword zshCommands trap true ttyctl type ulimit umask unalias syn keyword zshCommands unfunction unhash unlimit unset unsetopt vared syn keyword zshCommands wait whence where which zcompile zformat zftp zle syn keyword zshCommands zmodload zparseopts zprof zpty zregexparse zsocket syn keyword zshCommands zstyle ztcp " Types syn keyword zshTypes float integer local typeset " Switches " XXX: this may be too much syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' " Numbers syn match zshNumber '\<-\=\(\d\+#\|0x\=\)\=\d\+\>' syn match zshNumber '\<-\=\d\+.\d\+\>' " Substitution " XXX: is this right? something may be wrong here syn cluster zshSubst contains=zshSubst,zshBrackets syn region zshBrackets transparent start='(' skip='\\)' end=')' contains=TOP syn region zshBrackets transparent start='{' skip='\\}' end='}' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$(' skip='\\)' end=')' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$((' end='))' contains=TOP syn region zshSubst matchgroup=zshSubst start='\${' skip='\\}' end='}' contains=@zshSubst syn region zshOldSubst matchgroup=zshOldSubst start=+`+ skip=+\\`+ end=+`+ contains=TOP,zshOldSubst " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_zsh_syn_inits") if version < 508 let did_zsh_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink zshTodo Todo HiLink zshComment Comment HiLink zshPreProc PreProc HiLink zshQuoted SpecialChar HiLink zshString String HiLink zshStringDelimiter zshString HiLink zshPOSIXString zshString HiLink zshJobSpec Special HiLink zshPrecommand Special HiLink zshDelimiter Keyword HiLink zshConditional Conditional HiLink zshException Exception HiLink zshRepeat Repeat HiLink zshKeyword Keyword HiLink zshFunction Function HiLink zshKSHFunction zshFunction HiLink zshHereDoc String HiLink zshOperator Operator HiLink zshRedir Operator HiLink zshVariable Identifier HiLink zshShortDeref zshDeref HiLink zshLongDeref zshDeref HiLink zshDeref PreProc HiLink zshCommands Keyword HiLink zshTypes Type HiLink zshSwitches Special HiLink zshNumber Number HiLink zshSubst zshDeref HiLink zshOldSubst zshSubst delcommand HiLink endif let b:current_syntax = "zsh" " vim: set sts=2 sw=2: ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 23:26 ` Nikolai Weibull @ 2004-12-12 4:41 ` Felix Rosencrantz 2004-12-12 13:34 ` Nikolai Weibull 0 siblings, 1 reply; 34+ messages in thread From: Felix Rosencrantz @ 2004-12-12 4:41 UTC (permalink / raw) To: zsh-users Here are the things I notice: Some of the characters like "|<>" were being highlighted as yellow in a variable reference like ( found in _files:71) eval "def=( ${${def:gs/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )" another one from _path_files:165 that confuses it: tmp3="${${(M)SUFFIX%\([^\|\~]##\)}[2,-2]}" Here's a line that seems to confuse it from _nslookup "${(@)^${(@)${(@M)setopts:#\(*}/\)/)-}/\(/(-}" \ Also the `` embedded in double quotes doesn't seem to highlight properly. Also, it might be nice if well known functions like the completion functions (e.g. _arguments) are highlighted, like it does with builtin variables. A free standing -, or one that is in the middle of a word seems to turn red... The syntax file doesn't handle here-strings "<<<" syntax. (see: http://zsh.sunsite.dk/Doc/Release/zsh_6.html#SEC28) Thanks Nikolai, this is useful. -FR. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-12 4:41 ` Felix Rosencrantz @ 2004-12-12 13:34 ` Nikolai Weibull 2004-12-12 16:40 ` Felix Rosencrantz 2004-12-13 3:41 ` Doug Kearns 0 siblings, 2 replies; 34+ messages in thread From: Nikolai Weibull @ 2004-12-12 13:34 UTC (permalink / raw) To: zsh-users [-- Attachment #1: Type: text/plain, Size: 1870 bytes --] * Felix Rosencrantz <f.rosencrantz@gmail.com> [Dec 12, 2004 14:09]: > Some of the characters like "|<>" were being highlighted as yellow in > a variable reference like ( found in _files:71) eval "def=( > ${${def:gs/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}})" > another one from _path_files:165 that confuses it: > tmp3="${${(M)SUFFIX%\([^\|\~]##\)}[2,-2]}" Here's a line that seems to > confuse it from _nslookup > "${(@)^${(@)${(@M)setopts:#\(*}/\)/)-}/\(/(-}" \ This all leads me to believe that substitutions shouldn't be highlighted at all; it's just to complicated to get right. At least we're able to match well-nested stuff, but ${(@)^${(@)${(@M)setopts:#\(*}/\)/)-}/\(/(-} is just too weird. It's a bugger that it highlights too much, though. Suggestions? I guess that if there was a good way of matching stuff like ${var/pat/sub} ^^^^^^^^ one could figure out that this could contain unescaped parentheses and so on... > Also the `` embedded in double quotes doesn't seem to highlight > properly. Fixed. > Also, it might be nice if well known functions like the completion > functions (e.g. _arguments) are highlighted, like it does with > builtin variables. That's getting a bit out of hand. > A free standing -, or one that is in the middle of a word seems to > turn red... Yeah, it's the pre-command modifier. Perhaps we should simply ignore it. > The syntax file doesn't handle here-strings "<<<" syntax. (see: > http://zsh.sunsite.dk/Doc/Release/zsh_6.html#SEC28) Well, it highlights the <<<. > Thanks Nikolai, this is useful. NP, nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} [-- Attachment #2: zsh.vim --] [-- Type: text/plain, Size: 7270 bytes --] " Vim syntax file " Language: Zsh shell script " Maintainer: Nikolai Weibull <source@pcppopper.org> " URL: http://www.pcppopper.org/vim/syntax/pcp/zsh/ " Latest Revision: 2004-12-12 " arch-tag: 2e2c7097-99cb-4b87-a771-3a819b69995e if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " Set iskeyword since we need `-' (and potentially others) in keywords. " For version 5.x: Set it globally " For version 6.x: Set it locally if version >= 600 command -nargs=1 SetIsk setlocal iskeyword=<args> else command -nargs=1 SetIsk set iskeyword=<args> endif SetIsk @,48-57,_,- delcommand SetIsk " Todo syn keyword zshTodo contained TODO FIXME XXX NOTE " Comments syn region zshComment matchgroup=zshComment start='\(^\|\s\)#' end='$' contains=zshTodo " PreProc syn match zshPreProc '^\%1l#\(!\|compdef\|autoload\).*$' " Strings syn match zshQuoted '\\.' syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+ contains=zshQuoted,@zshDerefs,@zshSubst syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ " XXX: This should probably be more precise, but Zsh seems a bit confused about it itself syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+ end=+'+ contains=zshQuoted syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' " Precommand Modifiers syn keyword zshPrecommand noglob nocorrect exec command builtin - time " Delimiters syn keyword zshDelimiter do done " Conditionals syn keyword zshConditional if then elif else fi case in esac select " Loops syn keyword zshRepeat for while until repeat foreach " Exceptions syn keyword zshException always " Keywords syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite " Functions syn match zshKSHFunction contained '\k\+' syn match zshFunction '^\s*\k\+\ze\s*()' " Operators syn match zshOperator '||\|&&\|;\|&!\=' " Redirections syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)' syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' syn match zshRedir '|&\=' " Here Documents if version < 600 " Do nothing for now TODO: do something else syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' end='^\z1$' contains=@zshSubst syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' end='^\s*\z1$' contains=@zshSubst syn region zshHereDoc matchgroup=zshRedir start='<<\s*\(["']\)\z(\S*\)\1' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\(["']\)\z(\S*\)\1' end='^\s*\z1$' endif " Variable Assignments syn match zshVariable '\<\h\w*\ze+\==' " XXX: how safe is this? syn region zshVariable oneline matchgroup=zshVariable start='\$\@<!\<\h\w*\[' end='\]\ze+\==' contains=@zshSubst " Variable Dereferencing syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref if !exists("g:zsh_syntax_variables") let s:zsh_syntax_variables = 'all' else let s:zsh_syntax_variables = g:zsh_syntax_variables endif if s:zsh_syntax_variables =~ 'short\|all' syn match zshShortDeref '\$[!#$*@?_-]\w\@!' syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' endif if s:zsh_syntax_variables =~ 'long\|all' syn match zshLongDeref '\$\(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' syn match zshLongDeref '\$\(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' syn match zshLongDeref '\$\(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' endif if s:zsh_syntax_variables =~ 'all' syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' endif " Commands syn match zshCommands '\s[.:]\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd chdir syn keyword zshCommands clone comparguments compcall compctl compdescribe syn keyword zshCommands compfiles compgroups compquote comptags comptry syn keyword zshCommands compvalues continue declare dirs disable disown syn keyword zshCommands echo echotc echoti emulate enable eval exec exit syn keyword zshCommands export false fc fg functions getcap getln syn keyword zshCommands getopts hash history jobs kill let limit syn keyword zshCommands log logout popd print printf pushd pushln syn keyword zshCommands pwd r read readonly rehash return sched set syn keyword zshCommands setcap setopt shift source stat suspend test times syn keyword zshCommands trap true ttyctl type ulimit umask unalias syn keyword zshCommands unfunction unhash unlimit unset unsetopt vared syn keyword zshCommands wait whence where which zcompile zformat zftp zle syn keyword zshCommands zmodload zparseopts zprof zpty zregexparse zsocket syn keyword zshCommands zstyle ztcp " Types syn keyword zshTypes float integer local typeset " Switches " XXX: this may be too much syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' " Numbers syn match zshNumber '\<-\=\(\d\+#\|0x\=\)\=\d\+\>' syn match zshNumber '\<-\=\d\+.\d\+\>' " Substitution " XXX: is this right? something may be wrong here syn cluster zshSubst contains=zshSubst,zshBrackets,zshOldSubst syn region zshBrackets transparent start='(' skip='\\)' end=')' contains=TOP syn region zshBrackets transparent start='{' skip='\\}' end='}' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$(' skip='\\)' end=')' contains=TOP syn region zshSubst matchgroup=zshDeref transparent start='\$((' end='))' contains=TOP syn region zshSubst matchgroup=zshSubst start='\${' skip='\\}' end='}' contains=@zshSubst syn region zshOldSubst matchgroup=zshOldSubst start=+`+ skip=+\\`+ end=+`+ contains=TOP,zshOldSubst " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_zsh_syn_inits") if version < 508 let did_zsh_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink zshTodo Todo HiLink zshComment Comment HiLink zshPreProc PreProc HiLink zshQuoted SpecialChar HiLink zshString String HiLink zshStringDelimiter zshString HiLink zshPOSIXString zshString HiLink zshJobSpec Special HiLink zshPrecommand Special HiLink zshDelimiter Keyword HiLink zshConditional Conditional HiLink zshException Exception HiLink zshRepeat Repeat HiLink zshKeyword Keyword HiLink zshFunction Function HiLink zshKSHFunction zshFunction HiLink zshHereDoc String HiLink zshOperator Operator HiLink zshRedir Operator HiLink zshVariable Identifier HiLink zshShortDeref zshDeref HiLink zshLongDeref zshDeref HiLink zshDeref PreProc HiLink zshCommands Keyword HiLink zshTypes Type HiLink zshSwitches Special HiLink zshNumber Number HiLink zshSubst zshDeref HiLink zshOldSubst zshSubst delcommand HiLink endif let b:current_syntax = "zsh" " vim: set sts=2 sw=2: ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-12 13:34 ` Nikolai Weibull @ 2004-12-12 16:40 ` Felix Rosencrantz 2004-12-12 20:10 ` Nikolai Weibull 2004-12-13 3:41 ` Doug Kearns 1 sibling, 1 reply; 34+ messages in thread From: Felix Rosencrantz @ 2004-12-12 16:40 UTC (permalink / raw) To: zsh-users > Suggestions? I guess that if there was a good way of matching stuff like ${var/pat/sub} ^^^^^^^^ Isn't this the same problem as a finding a quoted string? In this case it has to follow a variable name within braces... Though maybe I don't understand. Also the here-strings formatting ( which is different from here-docs <<) is wrong: cat <<<"This is a here string" should highlight the string somehow. not just the first word. It seems confused by the syntax, because of the closing ". It's up to you about some well-known functions. It would be useful if there was a file or set of files that demonstrate syntactic features of zsh that could be used as a test case for the syntax highlighting. -FR. ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-12 16:40 ` Felix Rosencrantz @ 2004-12-12 20:10 ` Nikolai Weibull 0 siblings, 0 replies; 34+ messages in thread From: Nikolai Weibull @ 2004-12-12 20:10 UTC (permalink / raw) To: zsh-users [-- Attachment #1: Type: text/plain, Size: 1324 bytes --] * Felix Rosencrantz <f.rosencrantz@gmail.com> [Dec 12, 2004 17:50]: > > Suggestions? I guess that if there was a good way of matching stuff like > ${var/pat/sub} > ^^^^^^^^ > Isn't this the same problem as a finding a quoted string? In this > case it has to follow a variable name within braces... Though maybe I > don't understand. This should be fixed now...I made something complex when it should have been simple. > Also the here-strings formatting ( which is different from here-docs > <<) is wrong: cat <<<"This is a here string" should highlight the > string somehow. not just the first word. It seems confused by the > syntax, because of the closing ". Ah, switching order of redirections and heredoc definitions worked fine. > It's up to you about some well-known functions. We'll leave them out for now. > It would be useful if there was a file or set of files that > demonstrate syntactic features of zsh that could be used as a test > case for the syntax highlighting. Yeah, that would help :-), nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} [-- Attachment #2: zsh.vim --] [-- Type: text/plain, Size: 7383 bytes --] " Vim syntax file " Language: Zsh shell script " Maintainer: Nikolai Weibull <source@pcppopper.org> " URL: http://www.pcppopper.org/vim/syntax/pcp/zsh/ " Latest Revision: 2004-12-12 " arch-tag: 2e2c7097-99cb-4b87-a771-3a819b69995e if version < 600 syntax clear elseif exists("b:current_syntax") finish endif " Set iskeyword since we need `-' (and potentially others) in keywords. " For version 5.x: Set it globally " For version 6.x: Set it locally if version >= 600 command -nargs=1 SetIsk setlocal iskeyword=<args> else command -nargs=1 SetIsk set iskeyword=<args> endif SetIsk @,48-57,_,- delcommand SetIsk " Todo syn keyword zshTodo contained TODO FIXME XXX NOTE " Comments syn region zshComment matchgroup=zshComment start='\%(^\|\s\)#' end='$' contains=zshTodo " PreProc syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$' " Strings syn match zshQuoted '\\.' syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+ contains=zshQuoted,@zshDerefs,@zshSubst syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ " XXX: This should probably be more precise, but Zsh seems a bit confused about it itself syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+ end=+'+ contains=zshQuoted syn match zshJobSpec '%\(\d\+\|?\=\w\+\|[%+-]\)' " Precommand Modifiers syn keyword zshPrecommand noglob nocorrect exec command builtin - time " Delimiters syn keyword zshDelimiter do done " Conditionals syn keyword zshConditional if then elif else fi case in esac select " Loops syn keyword zshRepeat for while until repeat foreach " Exceptions syn keyword zshException always " Keywords syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite " Functions syn match zshKSHFunction contained '\k\+' syn match zshFunction '^\s*\k\+\ze\s*()' " Operators syn match zshOperator '||\|&&\|;\|&!\=' " Here Documents if version < 600 " Do nothing for now TODO: do something else syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' end='^\z1$' contains=@zshSubst syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' end='^\s*\z1$' contains=@zshSubst syn region zshHereDoc matchgroup=zshRedir start='<<\s*\(["']\)\z(\S*\)\1' end='^\z1$' syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\(["']\)\z(\S*\)\1' end='^\s*\z1$' endif " Redirections syn match zshRedir '\d\=\(<\|<>\|<<<\|<&\s*[0-9p-]\=\)' syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' syn match zshRedir '|&\=' " Variable Assignments syn match zshVariable '\<\h\w*\ze+\==' " XXX: how safe is this? syn region zshVariable oneline matchgroup=zshVariable start='\$\@<!\<\h\w*\[' end='\]\ze+\==' contains=@zshSubst " Variable Dereferencing syn cluster zshDerefs contains=zshShortDeref,zshLongDeref,zshDeref if !exists("g:zsh_syntax_variables") let s:zsh_syntax_variables = 'all' else let s:zsh_syntax_variables = g:zsh_syntax_variables endif syn match zshShortDeref '\$[!#$*@?_-]\w\@!' syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' syn match zshLongDeref '\$\%(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' syn match zshLongDeref '\$\%(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' syn match zshLongDeref '\$\%(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' " Commands syn match zshCommands '\%(^\|\s\)[.:]\ze\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd chdir syn keyword zshCommands clone comparguments compcall compctl compdescribe syn keyword zshCommands compfiles compgroups compquote comptags comptry syn keyword zshCommands compvalues continue declare dirs disable disown syn keyword zshCommands echo echotc echoti emulate enable eval exec exit syn keyword zshCommands export false fc fg functions getcap getln syn keyword zshCommands getopts hash history jobs kill let limit syn keyword zshCommands log logout popd print printf pushd pushln syn keyword zshCommands pwd r read readonly rehash return sched set syn keyword zshCommands setcap setopt shift source stat suspend test times syn keyword zshCommands trap true ttyctl type ulimit umask unalias syn keyword zshCommands unfunction unhash unlimit unset unsetopt vared syn keyword zshCommands wait whence where which zcompile zformat zftp zle syn keyword zshCommands zmodload zparseopts zprof zpty zregexparse zsocket syn keyword zshCommands zstyle ztcp " Types syn keyword zshTypes float integer local typeset " Switches " XXX: this may be too much syn match zshSwitches '\s\zs--\=[a-zA-Z0-9-]\+' " Numbers syn match zshNumber '[-+]\=0x\x\+\>' syn match zshNumber '[-+]\=0\o\+\>' syn match zshNumber '[-+]\=\d\+#[-+]\=\w\+\>' syn match zshNumber '[-+]\=\d\+\.\d\+\>' " Substitution syn cluster zshSubst contains=zshSubst,zshOldSubst syn region zshSubst matchgroup=zshSubstDelim transparent start='\$(' skip='\\)' end=')' contains=TOP syn region zshSubst matchgroup=zshSubstDelim transparent start='\$((' skip='\\)' end='))' contains=TOP syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}' end='}' contains=@zshSubst syn region zshOldSubst matchgroup=zshSubstDelim start=+`+ skip=+\\`+ end=+`+ contains=TOP,zshOldSubst " Define the default highlighting. " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_zsh_syn_inits") if version < 508 let did_zsh_syn_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink zshTodo Todo HiLink zshComment Comment HiLink zshPreProc PreProc HiLink zshQuoted SpecialChar HiLink zshString String HiLink zshStringDelimiter zshString HiLink zshPOSIXString zshString HiLink zshJobSpec Special HiLink zshPrecommand Special HiLink zshDelimiter Keyword HiLink zshConditional Conditional HiLink zshException Exception HiLink zshRepeat Repeat HiLink zshKeyword Keyword HiLink zshFunction Function HiLink zshKSHFunction zshFunction HiLink zshHereDoc String HiLink zshOperator Operator HiLink zshRedir Operator HiLink zshVariable Identifier HiLink zshDereferencing PreProc if s:zsh_syntax_variables =~ 'short\|all' HiLink zshShortDeref zshDereferencing else HiLink zshShortDeref None endif if s:zsh_syntax_variables =~ 'long\|all' HiLink zshLongDeref zshDereferencing else HiLink zshLongDeref None endif if s:zsh_syntax_variables =~ 'all' HiLink zshDeref zshDereferencing else HiLink zshDerefDeref None endif HiLink zshCommands Keyword HiLink zshTypes Type HiLink zshSwitches Special HiLink zshNumber Number HiLink zshSubst PreProc HiLink zshOldSubst zshSubst HiLink zshSubstDelim zshSubst delcommand HiLink endif let b:current_syntax = "zsh" " vim: set sts=2 sw=2: ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-12 13:34 ` Nikolai Weibull 2004-12-12 16:40 ` Felix Rosencrantz @ 2004-12-13 3:41 ` Doug Kearns 1 sibling, 0 replies; 34+ messages in thread From: Doug Kearns @ 2004-12-13 3:41 UTC (permalink / raw) To: zsh-users On Sun, Dec 12, 2004 at 02:34:09PM +0100, Nikolai Weibull wrote: <snip> > > Also, it might be nice if well known functions like the completion > > functions (e.g. _arguments) are highlighted, like it does with > > builtin variables. > > That's getting a bit out of hand. I agree. <snip> Regards, Doug ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-09 21:24 ` Nikolai Weibull 2004-12-09 22:43 ` Wayne Davison @ 2004-12-10 8:13 ` Stephane Chazelas 2004-12-10 15:27 ` Nikolai Weibull 1 sibling, 1 reply; 34+ messages in thread From: Stephane Chazelas @ 2004-12-10 8:13 UTC (permalink / raw) To: zsh-users On Thu, Dec 09, 2004 at 10:24:23PM +0100, Nikolai Weibull wrote: > * Wayne Davison <wayned@users.sourceforge.net> [Dec 09, 2004 21:20]: > > First, a bug: The zshVariable rule (after the "How safe is this?" > > comment) is misfiring on any [ that follows word characters. For > > instance, add "echo hi[" early in a zsh script, and the entire script > > should become the Identifier color. > > Well, that [ should be quoted, so I'm not persuaded yet. [...] If that "[" should be quoted, then that one in: [ -n "$1" ] should be to: '[' -ne "$1" ] -- Stéphane ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-10 8:13 ` Stephane Chazelas @ 2004-12-10 15:27 ` Nikolai Weibull 2004-12-10 15:46 ` Stephane Chazelas 0 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-10 15:27 UTC (permalink / raw) To: zsh-users * Stephane Chazelas <Stephane_Chazelas@yahoo.fr> [Dec 10, 2004 14:40]: > > > First, a bug: The zshVariable rule (after the "How safe is this?" > > > comment) is misfiring on any [ that follows word characters. For > > > instance, add "echo hi[" early in a zsh script, and the entire > > > script should become the Identifier color. > > Well, that [ should be quoted, so I'm not persuaded yet. > If that "[" should be quoted, then that one in: > [ -n "$1" ] > should be to: > '[' -ne "$1" ] Why? nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-10 15:27 ` Nikolai Weibull @ 2004-12-10 15:46 ` Stephane Chazelas 2004-12-11 13:24 ` Nikolai Weibull 0 siblings, 1 reply; 34+ messages in thread From: Stephane Chazelas @ 2004-12-10 15:46 UTC (permalink / raw) To: zsh-users On Fri, Dec 10, 2004 at 04:27:49PM +0100, Nikolai Weibull wrote: > * Stephane Chazelas <Stephane_Chazelas@yahoo.fr> [Dec 10, 2004 14:40]: > > > > First, a bug: The zshVariable rule (after the "How safe is this?" > > > > comment) is misfiring on any [ that follows word characters. For > > > > instance, add "echo hi[" early in a zsh script, and the entire > > > > script should become the Identifier color. > > > > Well, that [ should be quoted, so I'm not persuaded yet. > > > If that "[" should be quoted, then that one in: > > > [ -n "$1" ] > > > should be to: > > > '[' -ne "$1" ] > > Why? [...] Because "[" and "hi[" are both arguments to a builtin command (0th of the "[" one, and 1st of the "echo" one), there's no reason (not) to quote one and not the other. -- Stéphane ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-10 15:46 ` Stephane Chazelas @ 2004-12-11 13:24 ` Nikolai Weibull 2004-12-11 16:13 ` Stephane Chazelas 0 siblings, 1 reply; 34+ messages in thread From: Nikolai Weibull @ 2004-12-11 13:24 UTC (permalink / raw) To: zsh-users * Stephane Chazelas <Stephane_Chazelas@yahoo.fr> [Dec 10, 2004 16:50]: > > > If that "[" should be quoted, then that one in: > > > [ -n "$1" ] > > > should be to: > > > '[' -ne "$1" ] > > Why? > Because "[" and "hi[" are both arguments to a builtin command (0th of > the "[" one, and 1st of the "echo" one), there's no reason (not) to > quote one and not the other. I think you misunderstand. % echo hi[ zsh: bad pattern: hi[ % [ -n "$1" ] % Quoting the first makes sense if you want to echo the string "hi[". Quoting the [ in [ -n "$1" ] makes no sense at all. Or am I misunderstanding something? nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-11 13:24 ` Nikolai Weibull @ 2004-12-11 16:13 ` Stephane Chazelas 2004-12-11 20:02 ` Nikolai Weibull 0 siblings, 1 reply; 34+ messages in thread From: Stephane Chazelas @ 2004-12-11 16:13 UTC (permalink / raw) To: zsh-users On Sat, Dec 11, 2004 at 02:24:52PM +0100, Nikolai Weibull wrote: > * Stephane Chazelas <Stephane_Chazelas@yahoo.fr> [Dec 10, 2004 16:50]: > > > > If that "[" should be quoted, then that one in: > > > > > [ -n "$1" ] > > > > > should be to: > > > > > '[' -ne "$1" ] > > > > Why? > > > Because "[" and "hi[" are both arguments to a builtin command (0th of > > the "[" one, and 1st of the "echo" one), there's no reason (not) to > > quote one and not the other. > > I think you misunderstand. > > % echo hi[ > zsh: bad pattern: hi[ > % [ -n "$1" ] > % > > Quoting the first makes sense if you want to echo the string "hi[". > Quoting the [ in [ -n "$1" ] makes no sense at all. > Or am I misunderstanding something? [...] Yes, you're right, I had not made the test myself as I expected it to work the same as in any other shell. echo foo[ works OK in every shell but zsh. If you've got a command named foo[, though, foo[ bar doesn't work with ksh or bash (because, they take it as the start of an array subscript assignment). It's OK with pdksh, though. Is there any reason why echo [ works and not echo foo[ in zsh? -- Stéphane ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-11 16:13 ` Stephane Chazelas @ 2004-12-11 20:02 ` Nikolai Weibull 0 siblings, 0 replies; 34+ messages in thread From: Nikolai Weibull @ 2004-12-11 20:02 UTC (permalink / raw) To: zsh-users * Stephane Chazelas <Stephane_Chazelas@yahoo.fr> [Dec 11, 2004 17:30]: > > % echo hi[ > > zsh: bad pattern: hi[ > > % [ -n "$1" ] > > % > > > > Quoting the first makes sense if you want to echo the string "hi[". > > Quoting the [ in [ -n "$1" ] makes no sense at all. > > Or am I misunderstanding something? > Yes, you're right, I had not made the test myself as I expected > it to work the same as in any other shell. > echo foo[ > works OK in every shell but zsh. % setopt nobadpattern % echo hi[ hi[ > If you've got a command named foo[, though, > foo[ bar > doesn't work with ksh or bash (because, they take it as the > start of an array subscript assignment). It's OK with pdksh, > though. Yeah, [ is heavily overloaded ;-), nikolai -- ::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka ::: ::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden ::: ::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 ::: main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-04 16:42 ` Vim syntax file for zsh Nikolai Weibull 2004-12-08 8:13 ` Felix Rosencrantz @ 2004-12-08 13:15 ` Doug Kearns 1 sibling, 0 replies; 34+ messages in thread From: Doug Kearns @ 2004-12-08 13:15 UTC (permalink / raw) To: zsh-users On Sat, Dec 04, 2004 at 05:42:17PM +0100, Nikolai Weibull wrote: <snip> > The question is, does this make sense to most other people? > > I'm actually thinking that none of them should be highlighted, not even > those that are "special". Any input? > > Three choices: > > 1. Highlight all variable references alike. > 2. Highlight only "special" variables, such as $$, $#, and $n. My preference would also be for 1 and 2. Ideally this would also be configurable. > 3. Highlight no variable references at all. <snip> Regards, Doug ^ permalink raw reply [flat|nested] 34+ messages in thread
* Re: Vim syntax file for zsh 2004-12-01 7:40 Vim syntax file for zsh Felix Rosencrantz 2004-12-01 8:43 ` Danek Duvall 2004-12-01 12:02 ` Nikolai Weibull @ 2004-12-01 15:32 ` Ziggy 2 siblings, 0 replies; 34+ messages in thread From: Ziggy @ 2004-12-01 15:32 UTC (permalink / raw) To: Felix Rosencrantz; +Cc: List: ZSH [-- Attachment #1: Type: text/plain, Size: 750 bytes --] You should speak directly to the maintainer about this one. Felix von Leitner <leitner@math.fu-berlin.de> This guy is the maintainer of the zsh.vim file. Email him about it and he'll answer (probably). On Tue, 2004-11-30 at 23:40 -0800, Felix Rosencrantz wrote: > Anyone have a better version of zsh.vim? The version that comes with > vim 6.3 is ok, but could be much better. It has a few bugs, like > unmatched single quotes within double quotes, confuse it. Also, it's > missing some standard keywords (e.g. repeat, until, foreach, select). > It would be nice if it recognized completion related functions, > variables, syntax (e.g. #compdef lines). The _chown completion > function exhibits some of the problems. > > -FR [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 34+ messages in thread
end of thread, other threads:[~2004-12-13 3:43 UTC | newest] Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-12-01 7:40 Vim syntax file for zsh Felix Rosencrantz 2004-12-01 8:43 ` Danek Duvall 2004-12-01 12:02 ` Nikolai Weibull 2004-12-03 8:02 ` Felix Rosencrantz 2004-12-04 15:54 ` Clint Adams 2004-12-04 16:42 ` Nikolai Weibull 2004-12-04 17:00 ` OT: vim maintainer [Re: Vim syntax file for zsh] Clint Adams 2004-12-04 22:04 ` Nikolai Weibull 2004-12-04 16:42 ` Vim syntax file for zsh Nikolai Weibull 2004-12-08 8:13 ` Felix Rosencrantz 2004-12-08 13:47 ` Nikolai Weibull 2004-12-08 18:14 ` Nikolai Weibull 2004-12-09 13:59 ` lists 2004-12-09 14:45 ` Nikolai Weibull 2004-12-09 16:36 ` Felix Rosencrantz 2004-12-09 18:18 ` Nikolai Weibull 2004-12-09 18:23 ` Nikolai Weibull 2004-12-09 20:09 ` Wayne Davison 2004-12-09 21:24 ` Nikolai Weibull 2004-12-09 22:43 ` Wayne Davison 2004-12-09 23:26 ` Nikolai Weibull 2004-12-12 4:41 ` Felix Rosencrantz 2004-12-12 13:34 ` Nikolai Weibull 2004-12-12 16:40 ` Felix Rosencrantz 2004-12-12 20:10 ` Nikolai Weibull 2004-12-13 3:41 ` Doug Kearns 2004-12-10 8:13 ` Stephane Chazelas 2004-12-10 15:27 ` Nikolai Weibull 2004-12-10 15:46 ` Stephane Chazelas 2004-12-11 13:24 ` Nikolai Weibull 2004-12-11 16:13 ` Stephane Chazelas 2004-12-11 20:02 ` Nikolai Weibull 2004-12-08 13:15 ` Doug Kearns 2004-12-01 15:32 ` Ziggy
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).