Start anew
[msysgit.git] / share / vim / vim58 / syntax / zsh.vim
blob37c9e035ee7d10ffc72467ba315282616f1fe144
1 " Vim syntax file
2 " Language:     Z shell (zsh)
3 " Maintainer:   Felix von Leitner <leitner@math.fu-berlin.de>
4 " Heavily based on sh.vim by Lennart Schultz
5 " Last Change:  2001 May 09
7 " For version 5.x: Clear all syntax items
8 " For version 6.x: Quit when a syntax file was already loaded
9 if version < 600
10   syntax clear
11 elseif exists("b:current_syntax")
12   finish
13 endif
15 syn region      zshSinglequote  start=+'+ skip=+\\'+ end=+'+
16 " A bunch of useful zsh keywords
17 " syn keyword   zshFunction     function
18 syn keyword     zshStatement    bg break cd chdir continue echo eval exec
19 syn keyword     zshStatement    exit export fg getopts hash jobs kill
20 syn keyword     zshStatement    pwd read readonly return set zshift function
21 syn keyword     zshStatement    stop suspend test times trap type ulimit
22 syn keyword     zshStatement    umask unset wait setopt compctl source
23 syn keyword     zshStatement    whence disown shift which unhash unalias
24 syn keyword     zshStatement    alias functions unfunction getln disable
25 syn keyword     zshStatement    vared getopt enable unsetopt autoload
26 syn keyword     zshStatement    bindkey pushln command limit unlimit fc
27 syn keyword     zshStatement    print builtin noglob sched r time
28 syn keyword     zshStatement    typeset declare local integer
30 syn keyword     zshConditional  if else esac case then elif fi in
31 syn keyword     zshRepeat       while for do done
33 " Following is worth to notice: command substitution, file redirection and functions (so these features turns red)
34 syn match       zshFunctionName "\h\w*\s*()"
35 syn region      zshCommandSub   start=+`+ skip=+\\`+ end=+`+
36 " contains=ALLBUT,zshFunction
37 syn match       zshRedir        "\d\=\(<\|<<\|>\|>>\)\(|\|&\d\)\="
39 syn keyword     zshTodo contained TODO
41 syn keyword     zshShellVariables       USER LOGNAME HOME PATH CDPATH SHELL
42 syn keyword     zshShellVariables       LC_TYPE LC_MESSAGE MAIL MAILCHECK
43 syn keyword     zshShellVariables       PS1 PS2 IFS EGID EUID ERRNO GID UID
44 syn keyword     zshShellVariables       HOST LINENO MACHTYPE OLDPWD OPTARG
45 syn keyword     zshShellVariables       OPTIND OSTYPE PPID PWD RANDOM SECONDS
46 syn keyword     zshShellVariables       SHLVL TTY signals TTYIDLE USERNAME
47 syn keyword     zshShellVariables       VENDOR ZSH_NAME ZSH_VERSION ARGV0
48 syn keyword     zshShellVariables       BAUD COLUMNS cdpath DIRSTACKSIZE
49 syn keyword     zshShellVariables       FCEDIT fignore fpath histchars HISTCHARS
50 syn keyword     zshShellVariables       HISTFILE HISTSIZE KEYTIMEOUT LANG
51 syn keyword     zshShellVariables       LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES
52 syn keyword     zshShellVariables       LC_TIME LINES LISTMAX LOGCHECK mailpath
53 syn keyword     zshShellVariables       MAILPATH MANPATH manpath module_path
54 syn keyword     zshShellVariables       MODULE_PATH NULLCMD path POSTEDIT
55 syn keyword     zshShellVariables       PS3 PS4 PROMPT PROMPT2 PROMPT3 PROMPT4
56 syn keyword     zshShellVariables       psvar PSVAR prompt READNULLCMD
57 syn keyword     zshShellVariables       REPORTTIME RPROMPT RPS1 SAVEHIST
58 syn keyword     zshShellVariables       SPROMPT STTY TIMEFMT TMOUT TMPPREFIX
59 syn keyword     zshShellVariables       watch WATCH WATCHFMT WORDCHARS ZDOTDIR
60 syn match       zshSpecialShellVar      "\$[-#@*$?!0-9]"
61 syn keyword     zshSetVariables         ignoreeof noclobber
62 syn region      zshDerefOpr     start="\${" end="}" contains=zshShellVariables
63 syn match       zshDerefIdentifier      "\$[a-zA-Z_][a-zA-Z0-9_]*\>"
64 syn match       zshOperator             "[][}{&;|)(]"
66 " String and Character contstants
67 " Highlight special characters (those which have a backslash) differently
68 syn match   zshSpecial  contained "\\\d\d\d\|\\[abcfnrtv\\]"
71 syn match  zshNumber            "-\=\<\d\+\>"
72 syn match  zshComment   "#.*$" contains=zshNumber,zshTodo
75 syn match zshTestOpr    "-\<[oeaznlg][tfqet]\=\>\|!\==\|-\<[b-gkLprsStuwjxOG]\>"
76 "syn region zshTest           start="\[" skip="\\$" end="\]" contains=zshString,zshTestOpr,zshDerefIdentifier,zshDerefOpr
77 syn region  zshString   start=+"+  skip=+\\"+  end=+"+  contains=zshSpecial,zshOperator,zshDerefIdentifier,zshDerefOpr,zshSpecialShellVar,zshSinglequote,zshCommandSub
79 " Define the default highlighting.
80 " For version 5.7 and earlier: only when not done already
81 " For version 5.8 and later: only when an item doesn't have highlighting yet
82 if version >= 508 || !exists("did_zsh_syntax_inits")
83   if version < 508
84     let did_zsh_syntax_inits = 1
85     command -nargs=+ HiLink hi link <args>
86   else
87     command -nargs=+ HiLink hi def link <args>
88   endif
90   HiLink zshSinglequote         zshString
91   HiLink zshConditional         zshStatement
92   HiLink zshRepeat              zshStatement
93   HiLink zshFunctionName        zshFunction
94   HiLink zshCommandSub          zshOperator
95   HiLink zshRedir               zshOperator
96   HiLink zshSetVariables        zshShellVariables
97   HiLink zshSpecialShellVar     zshShellVariables
98   HiLink zshTestOpr             zshOperator
99   HiLink zshDerefOpr            zshSpecial
100   HiLink zshDerefIdentifier     zshShellVariables
101   HiLink zshOperator            Operator
102   HiLink zshStatement           Statement
103   HiLink zshNumber              Number
104   HiLink zshString              String
105   HiLink zshComment             Comment
106   HiLink zshSpecial             Special
107   HiLink zshTodo                Todo
108   HiLink zshShellVariables      Special
109 "  hi zshOperator               term=underline ctermfg=6 guifg=Purple gui=bold
110 "  hi zshShellVariables term=underline ctermfg=2 guifg=SeaGreen gui=bold
111 "  hi zshFunction               term=bold ctermbg=1 guifg=Red
113   delcommand HiLink
114 endif
116 let b:current_syntax = "zsh"
118 " vim: ts=8