PageRenderTime 41ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/vim/syntax/ps1.vim

https://github.com/ltoth/config_files
Vim Script | 105 lines | 65 code | 15 blank | 25 comment | 8 complexity | b87ba04201f21d9198a033d27e1eb167 MD5 | raw file
  1. " Vim syntax file
  2. " Language: Windows PowerShell
  3. " Maintainer: Peter Provost <peter@provost.org>
  4. " Version: 2.7
  5. " Url: http://www.vim.org/scripts/script.php?script_id=1327
  6. "
  7. " $LastChangedDate: 2007-03-05 21:18:39 -0800 (Mon, 05 Mar 2007) $
  8. " $Rev: 58 $
  9. "
  10. " Contributions by:
  11. " Jared Parsons <jaredp@beanseed.org>
  12. " Heath Stewart <heaths@microsoft.com>
  13. " Compatible VIM syntax file start
  14. if version < 600
  15. syntax clear
  16. elseif exists("b:current_syntax")
  17. finish
  18. endif
  19. " PowerShell doesn't care about case
  20. syn case ignore
  21. " Sync-ing method
  22. syn sync minlines=100
  23. " Comments and special comment words
  24. syn keyword ps1CommentTodo TODO FIXME XXX TBD HACK contained
  25. syn region ps1Comment start=/^<#/ end=/#>$/ contains=ps1CommentTodo
  26. syn match ps1Comment /#.*/ contains=ps1CommentTodo
  27. " Language keywords and elements
  28. syn keyword ps1Conditional if else elseif switch
  29. syn keyword ps1Repeat while default for do until break continue
  30. syn match ps1Repeat /\<foreach\>/ nextgroup=ps1Cmdlet
  31. syn keyword ps1Keyword return filter in trap throw param begin process end
  32. syn match ps1Keyword /\<while\>/ nextgroup=ps1Cmdlet
  33. " Functions and Cmdlets
  34. syn match ps1Cmdlet /\w\+-\w\+/
  35. syn keyword ps1Keyword function nextgroup=ps1Function skipwhite
  36. syn match ps1Function /\w\+-*\w*/ contained
  37. " Type declarations
  38. syn match ps1Type /\[[a-z0-9_:.]\+\(\[\]\)\?\]/
  39. syn match ps1StandaloneType /[a-z0-9_.]\+/ contained
  40. syn keyword ps1Scope global local private script contained
  41. " Variables and other user defined items
  42. syn match ps1Variable /\$\w\+/
  43. syn match ps1Variable /\${\w\+:\\\w\+}/
  44. syn match ps1ScopedVariable /\$\w\+:\w\+/ contains=ps1Scope
  45. syn match ps1VariableName /\w\+/ contained
  46. " Operators all start w/ dash
  47. syn match ps1OperatorStart /-c\?/ nextgroup=ps1Operator
  48. syn keyword ps1Operator eq ne ge gt lt le like notlike match notmatch replace /contains/ notcontains contained
  49. syn keyword ps1Operator ieq ine ige igt ile ilt ilike inotlike imatch inotmatch ireplace icontains inotcontains contained
  50. syn keyword ps1Operator ceq cne cge cgt clt cle clike cnotlike cmatch cnotmatch creplace ccontains cnotcontains contained
  51. syn keyword ps1Operator is isnot as
  52. syn keyword ps1Operator and or band bor not
  53. syn keyword ps1Operator f
  54. " Regular Strings
  55. syn region ps1String start=/"/ skip=/`"/ end=/"/
  56. syn region ps1String start=/'/ end=/'/
  57. " Here-Strings
  58. syn region ps1String start=/@"$/ end=/^"@$/
  59. syn region ps1String start=/@'$/ end=/^'@$/
  60. " Numbers
  61. syn match ps1Number /\<[0-9]\+/
  62. " Setup default color highlighting
  63. if version >= 508 || !exists("did_ps1_syn_inits")
  64. if version < 508
  65. let did_ps1_syn_inits = 1
  66. command -nargs=+ HiLink hi link <args>
  67. else
  68. command -nargs=+ HiLink hi def link <args>
  69. endif
  70. HiLink ps1String String
  71. HiLink ps1Conditional Conditional
  72. HiLink ps1Function Function
  73. HiLink ps1Variable Identifier
  74. HiLink ps1ScopedVariable Identifier
  75. HiLink ps1VariableName Identifier
  76. HiLink ps1Type Type
  77. HiLink ps1Scope Type
  78. HiLink ps1StandaloneType Type
  79. HiLink ps1Number Number
  80. HiLink ps1Comment Comment
  81. HiLink ps1CommentTodo Todo
  82. HiLink ps1Operator Operator
  83. HiLink ps1Repeat Repeat
  84. HiLink ps1RepeatAndCmdlet Repeat
  85. HiLink ps1Keyword Keyword
  86. HiLink ps1KeywordAndCmdlet Keyword
  87. HiLink ps1Cmdlet Statement
  88. delcommand HiLink
  89. endif
  90. let b:current_syntax = "powershell"