zsh-users
 help / color / mirror / code / Atom feed
From: Nikolai Weibull <mailing-lists.zsh-users@rawuncut.elitemail.org>
To: zsh-users@sunsite.dk
Subject: Re: Vim syntax file for zsh
Date: Thu, 9 Dec 2004 19:23:48 +0100	[thread overview]
Message-ID: <20041209182347.GG9424@puritan.pcp.ath.cx> (raw)
In-Reply-To: <20041209181813.GF9424@puritan.pcp.ath.cx>

[-- 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:

  reply	other threads:[~2004-12-09 18:24 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-01  7:40 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041209182347.GG9424@puritan.pcp.ath.cx \
    --to=mailing-lists.zsh-users@rawuncut.elitemail.org \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).