Update vim-ps1 to v2.9
This commit is contained in:
parent
566926ad64
commit
503c765343
11 changed files with 107 additions and 307 deletions
1
pack/acp/start/vim-ps1/.gitignore
vendored
1
pack/acp/start/vim-ps1/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
/doc/tags
|
|
|
@ -9,9 +9,8 @@ files, and also includes a filetype plugin so Vim can autodetect your PS1 script
|
||||||
|
|
||||||
Includes contributions by:
|
Includes contributions by:
|
||||||
|
|
||||||
* Tomas Restrepo
|
* Jared Parsons <jaredp@beanseed.org>
|
||||||
* Jared Parsons
|
* Heath Stewart <heaths@microsoft.com>
|
||||||
* Heath Stewart
|
|
||||||
* Michael B. Smith
|
* Michael B. Smith
|
||||||
* Alexander Kostikov
|
* Alexander Kostikov
|
||||||
|
|
||||||
|
@ -20,34 +19,17 @@ Installation
|
||||||
|
|
||||||
Copy the included directories into your .vim or vimfiles directory.
|
Copy the included directories into your .vim or vimfiles directory.
|
||||||
|
|
||||||
Or even better, use [pathogen.vim][1] and simply pull it in like this:
|
Or even better, use pathogen and simply pull it in like this:
|
||||||
|
|
||||||
cd ~/.vim/bundle
|
cd ~/.vim/bundle
|
||||||
git clone https://github.com/PProvost/vim-ps1.git
|
git clone https://github.com/PProvost/vim-ps1.git
|
||||||
|
|
||||||
Folding
|
|
||||||
-------
|
|
||||||
|
|
||||||
The ps1 syntax file provides syntax folding for script blocks and digital
|
|
||||||
signatures in scripts.
|
|
||||||
|
|
||||||
When 'foldmethod' is set to "syntax" then function script blocks will be
|
|
||||||
folded unless you use the following in your .vimrc or before opening a script:
|
|
||||||
|
|
||||||
:let g:ps1_nofold_blocks = 1
|
|
||||||
|
|
||||||
Digital signatures in scripts will also be folded unless you use:
|
|
||||||
|
|
||||||
:let g:ps1_nofold_sig = 1
|
|
||||||
|
|
||||||
Note: syntax folding might slow down syntax highlighting significantly,
|
|
||||||
especially for large files.
|
|
||||||
|
|
||||||
Comments and Suggestions
|
Comments and Suggestions
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
Please follow, fork or submit issues on [GitHub][2] and if you
|
Please follow, fork or submit issues on [GitHub](https://github.com/PProvost/vim-ps1) and if you
|
||||||
find it useful, please vote for it on [vim.org][3].
|
find it useful, please vote for it on [vim.org](http://www.vim.org/scripts/script.php?script_id=1327).
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
@ -69,7 +51,6 @@ License
|
||||||
Version History
|
Version History
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
* v2.10 (2013-06-24) Added Heath Stewart's here strings fix
|
|
||||||
* v2.9 (2012-03-08) Included tomasr's changes
|
* v2.9 (2012-03-08) Included tomasr's changes
|
||||||
* v2.81 (2012-03-05) Fixed a dumb typo
|
* v2.81 (2012-03-05) Fixed a dumb typo
|
||||||
* v2.8 (2012-03-05) Better number scanning, multiline comments, missing keywords and constants
|
* v2.8 (2012-03-05) Better number scanning, multiline comments, missing keywords and constants
|
||||||
|
@ -84,7 +65,3 @@ Version History
|
||||||
* v1.3 (2005-12-20) Updates to syntax elements
|
* v1.3 (2005-12-20) Updates to syntax elements
|
||||||
* v1.2 (2005-08-13) Fix foreach and while problem
|
* v1.2 (2005-08-13) Fix foreach and while problem
|
||||||
* v1.1 (2005-08-12) Initial release
|
* v1.1 (2005-08-12) Initial release
|
||||||
|
|
||||||
[1]: https://github.com/tpope/vim-pathogen
|
|
||||||
[2]: https://github.com/PProvost/vim-ps1
|
|
||||||
[3]: http://www.vim.org/scripts/script.php?script_id=1327
|
|
||||||
|
|
|
@ -1,38 +1,16 @@
|
||||||
*ps1.txt* A Windows PowerShell syntax plugin for Vim
|
*ps1.txt* A Windows PowerShell syntax plugin for Vim
|
||||||
|
|
||||||
Maintainer: Peter Provost <http://www.github.com/PProvost>
|
Author: Peter Provost <http://www.github.com/PProvost>
|
||||||
License: Apache 2.0
|
License: Apache 2.0
|
||||||
Version: 2.10
|
Version: 2.9
|
||||||
|
|
||||||
INTRODUCTION *ps1-syntax*
|
INTRODUCTION *ps1-syntax*
|
||||||
|
|
||||||
This plugin provides Vim syntax, indent and filetype detection for Windows
|
This plugin provides Vim syntax, indent and filetype detection for Windows
|
||||||
PowerShell scripts, modules, and XML configuration files.
|
PowerShell.
|
||||||
|
|
||||||
|
ABOUT *ps1-about*
|
||||||
ABOUT *ps1-about*
|
|
||||||
|
|
||||||
Grab the latest version or report a bug on GitHub:
|
Grab the latest version or report a bug on GitHub:
|
||||||
|
|
||||||
http://github.com/PProvost/vim-ps1
|
http://github.com/PProvost/vim-ps1
|
||||||
|
|
||||||
|
|
||||||
FOLDING *ps1-folding*
|
|
||||||
|
|
||||||
The ps1 syntax file provides syntax folding (see |:syn-fold|) for script blocks
|
|
||||||
and digital signatures in scripts.
|
|
||||||
|
|
||||||
When 'foldmethod' is set to "syntax" then function script blocks will be
|
|
||||||
folded unless you use the following in your .vimrc or before opening a script: >
|
|
||||||
|
|
||||||
:let g:ps1_nofold_blocks = 1
|
|
||||||
<
|
|
||||||
Digital signatures in scripts will also be folded unless you use: >
|
|
||||||
|
|
||||||
:let g:ps1_nofold_sig = 1
|
|
||||||
<
|
|
||||||
Note: syntax folding might slow down syntax highlighting significantly,
|
|
||||||
especially for large files.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
vim:ft=help:
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
" Vim ftdetect plugin file
|
" Vim ftdetect plugin file
|
||||||
" Language: Windows PowerShell
|
" Language: Windows PowerShell
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
" Version: 2.10
|
" Version: 2.9
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
" Project Repository: https://github.com/PProvost/vim-ps1
|
||||||
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
|
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
|
||||||
"
|
|
||||||
au BufNewFile,BufRead *.ps1 set ft=ps1
|
au BufNewFile,BufRead *.ps1 set ft=ps1
|
||||||
au BufNewFile,BufRead *.psd1 set ft=ps1
|
au BufNewFile,BufRead *.psm1 set ft=ps1
|
||||||
au BufNewFile,BufRead *.psm1 set ft=ps1
|
|
||||||
au BufNewFile,BufRead *.pssc set ft=ps1
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
" Vim ftdetect plugin file
|
|
||||||
" Language: Windows PowerShell
|
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
|
||||||
" Version: 2.10
|
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
|
||||||
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
|
|
||||||
|
|
||||||
au BufNewFile,BufRead *.ps1xml set ft=ps1xml
|
|
|
@ -1,9 +0,0 @@
|
||||||
" Vim ftdetect plugin file
|
|
||||||
" Language: Windows PowerShell
|
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
|
||||||
" Version: 2.10
|
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
|
||||||
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
|
|
||||||
|
|
||||||
au BufNewFile,BufRead *.cdxml set ft=xml
|
|
||||||
au BufNewFile,BufRead *.psc1 set ft=xml
|
|
|
@ -1,9 +1,9 @@
|
||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: Windows PowerShell
|
" Language: Windows PowerShell
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
" Version: 2.10
|
" Version: 2.9
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
" Project Repository: https://github.com/PProvost/vim-ps1
|
||||||
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
|
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
|
||||||
|
|
||||||
" Only do this when not done yet for this buffer
|
" Only do this when not done yet for this buffer
|
||||||
if exists("b:did_ftplugin") | finish | endif
|
if exists("b:did_ftplugin") | finish | endif
|
||||||
|
@ -14,23 +14,13 @@ let b:did_ftplugin = 1
|
||||||
setlocal tw=0
|
setlocal tw=0
|
||||||
setlocal commentstring=#%s
|
setlocal commentstring=#%s
|
||||||
setlocal formatoptions=tcqro
|
setlocal formatoptions=tcqro
|
||||||
" Enable autocompletion of hyphenated PowerShell commands,
|
|
||||||
" e.g. Get-Content or Get-ADUser
|
|
||||||
setlocal iskeyword+=-
|
|
||||||
" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8.
|
|
||||||
setlocal bomb
|
|
||||||
|
|
||||||
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
||||||
if has("gui_win32")
|
if has("gui_win32")
|
||||||
let b:browsefilter =
|
let b:browsefilter = "PowerShell Files (*.ps1)\t*.ps1\n" .
|
||||||
\ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" .
|
\ "All Files (*.*)\t*.*\n"
|
||||||
\ "PowerShell Script Files (*.ps1)\t*.ps1\n" .
|
|
||||||
\ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" .
|
|
||||||
\ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n" .
|
|
||||||
\ "All Files (*.*)\t*.*\n"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Undo the stuff we changed
|
" Undo the stuff we changed
|
||||||
let b:undo_ftplugin = "setlocal tw< cms< fo<" .
|
let b:undo_ftplugin = "setlocal tw< cms< fo<" .
|
||||||
\ " | unlet! b:browsefilter"
|
\ " | unlet! b:browsefilter"
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
" Vim filetype plugin file
|
|
||||||
" Language: Windows PowerShell
|
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
|
||||||
" Version: 2.10
|
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
|
||||||
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
|
|
||||||
|
|
||||||
" Only do this when not done yet for this buffer
|
|
||||||
if exists("b:did_ftplugin") | finish | endif
|
|
||||||
|
|
||||||
" Don't load another plug-in for this buffer
|
|
||||||
let b:did_ftplugin = 1
|
|
||||||
|
|
||||||
setlocal tw=0
|
|
||||||
setlocal commentstring=#%s
|
|
||||||
setlocal formatoptions=tcqro
|
|
||||||
" MS applications (including PowerShell) require a Byte Order Mark (BOM) for UTF-8.
|
|
||||||
setlocal bomb
|
|
||||||
|
|
||||||
" Change the browse dialog on Win32 to show mainly PowerShell-related files
|
|
||||||
if has("gui_win32")
|
|
||||||
let b:browsefilter =
|
|
||||||
\ "All PowerShell Files (*.ps1, *.psd1, *.psm1, *.ps1xml)\t*.ps1;*.psd1;*.psm1;*.ps1xml\n" .
|
|
||||||
\ "PowerShell Script Files (*.ps1)\t*.ps1\n" .
|
|
||||||
\ "PowerShell Module Files (*.psd1, *.psm1)\t*.psd1;*.psm1\n" .
|
|
||||||
\ "PowerShell XML Files (*.ps1xml)\t*.ps1xml\n" .
|
|
||||||
\ "All Files (*.*)\t*.*\n"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Undo the stuff we changed
|
|
||||||
let b:undo_ftplugin = "setlocal tw< cms< fo<" .
|
|
||||||
\ " | unlet! b:browsefilter"
|
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
" Vim indent file
|
" Vim indent file
|
||||||
" Language: Windows PowerShell
|
" Language: Windows PowerShell
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
" Version: 2.10
|
" Version: 2.9
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
" Project Repository: https://github.com/PProvost/vim-ps1
|
||||||
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327"
|
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327"
|
||||||
|
|
||||||
" Only load this indent file when no other was loaded.
|
" Only load this indent file when no other was loaded.
|
||||||
if exists("b:did_indent")
|
if exists("b:did_indent")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_indent = 1
|
let b:did_indent = 1
|
||||||
|
|
||||||
" smartindent is good enough for powershell
|
" PS indenting is like indenting C
|
||||||
setlocal smartindent
|
setlocal cindent cinoptions& cinoptions+=+0
|
||||||
" disable the indent removal for # marks
|
|
||||||
inoremap # X#
|
|
||||||
|
|
||||||
let b:undo_indent = "setl si<"
|
|
||||||
|
|
||||||
|
let b:undo_indent = "setl cin<"
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
" Vim syntax file
|
" Vim syntax file
|
||||||
" Language: Windows PowerShell
|
" Language: Windows PowerShell
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
" Maintainer: Peter Provost <peter@provost.org>
|
||||||
" Version: 2.10
|
" Version: 2.9
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
" Project Repository: https://github.com/PProvost/vim-ps1
|
||||||
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327"
|
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327"
|
||||||
"
|
|
||||||
" The following settings are available for tuning syntax highlighting:
|
|
||||||
" let ps1_nofold_blocks = 1
|
|
||||||
" let ps1_nofold_sig = 1
|
|
||||||
" let ps1_nofold_region = 1
|
|
||||||
|
|
||||||
" Compatible VIM syntax file start
|
" Compatible VIM syntax file start
|
||||||
if version < 600
|
if version < 600
|
||||||
syntax clear
|
syntax clear
|
||||||
elseif exists("b:current_syntax")
|
elseif exists("b:current_syntax")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Operators contain dashes
|
|
||||||
setlocal iskeyword+=-
|
|
||||||
|
|
||||||
" PowerShell doesn't care about case
|
" PowerShell doesn't care about case
|
||||||
syn case ignore
|
syn case ignore
|
||||||
|
|
||||||
|
@ -27,15 +19,15 @@ syn case ignore
|
||||||
syn sync minlines=100
|
syn sync minlines=100
|
||||||
|
|
||||||
" Certain tokens can't appear at the top level of the document
|
" Certain tokens can't appear at the top level of the document
|
||||||
syn cluster ps1NotTop contains=@ps1Comment,ps1CDocParam,ps1FunctionDeclaration
|
syn cluster ps1NotTop contains=@ps1Comment,ps1CDocParam,ps1Function
|
||||||
|
|
||||||
" Comments and special comment words
|
" Comments and special comment words
|
||||||
syn keyword ps1CommentTodo TODO FIXME XXX TBD HACK NOTE contained
|
syn keyword ps1CommentTodo TODO FIXME XXX TBD HACK NOTE contained
|
||||||
syn match ps1CDocParam /.*/ contained
|
syn match ps1CDocParam /.*/ contained
|
||||||
syn match ps1CommentDoc /^\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained
|
syn match ps1CommentDoc /^\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained
|
||||||
syn match ps1CommentDoc /#\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained
|
syn match ps1CommentDoc /#\s*\zs\.\w\+\>/ nextgroup=ps1CDocParam contained
|
||||||
syn match ps1Comment /#.*/ contains=ps1CommentTodo,ps1CommentDoc,@Spell
|
syn match ps1Comment /#.*/ contains=ps1CommentTodo,ps1CommentDoc
|
||||||
syn region ps1Comment start="<#" end="#>" contains=ps1CommentTodo,ps1CommentDoc,@Spell
|
syn region ps1Comment start="<#" end="#>" contains=ps1CommentTodo,ps1CommentDoc
|
||||||
|
|
||||||
" Language keywords and elements
|
" Language keywords and elements
|
||||||
syn keyword ps1Conditional if else elseif switch default
|
syn keyword ps1Conditional if else elseif switch default
|
||||||
|
@ -44,9 +36,10 @@ syn match ps1Repeat /\<foreach\>/ nextgroup=ps1Block skipwhite
|
||||||
syn match ps1Keyword /\<while\>/ nextgroup=ps1Block skipwhite
|
syn match ps1Keyword /\<while\>/ nextgroup=ps1Block skipwhite
|
||||||
syn match ps1Keyword /\<where\>/ nextgroup=ps1Block skipwhite
|
syn match ps1Keyword /\<where\>/ nextgroup=ps1Block skipwhite
|
||||||
|
|
||||||
syn keyword ps1Exception begin process end exit inlinescript parallel sequence
|
syn keyword ps1Exception begin process end exit
|
||||||
syn keyword ps1Keyword try catch finally throw
|
syn keyword ps1Keyword try catch finally throw
|
||||||
syn keyword ps1Keyword return filter in trap param data dynamicparam
|
syn keyword ps1Keyword return filter in trap param data dynamicparam
|
||||||
|
syn match ps1Keyword /&/
|
||||||
syn keyword ps1Constant $true $false $null
|
syn keyword ps1Constant $true $false $null
|
||||||
syn match ps1Constant +\$?+
|
syn match ps1Constant +\$?+
|
||||||
syn match ps1Constant +\$_+
|
syn match ps1Constant +\$_+
|
||||||
|
@ -56,70 +49,51 @@ syn match ps1Constant +\$^+
|
||||||
" Keywords reserved for future use
|
" Keywords reserved for future use
|
||||||
syn keyword ps1Keyword class define from using var
|
syn keyword ps1Keyword class define from using var
|
||||||
|
|
||||||
" Function declarations
|
" Functions and Cmdlets
|
||||||
syn keyword ps1Keyword function nextgroup=ps1FunctionDeclaration skipwhite
|
syn match ps1Cmdlet /\w\+-\w\+/
|
||||||
syn keyword ps1Keyword filter nextgroup=ps1FunctionDeclaration skipwhite
|
syn keyword ps1Keyword function nextgroup=ps1Function skipwhite
|
||||||
syn keyword ps1Keyword workflow nextgroup=ps1FunctionDeclaration skipwhite
|
syn keyword ps1Keyword filter nextgroup=ps1Function skipwhite
|
||||||
syn keyword ps1Keyword configuration nextgroup=ps1FunctionDeclaration skipwhite
|
syn match ps1Function /\w\+-*\w*/ contained
|
||||||
syn keyword ps1Keyword class nextgroup=ps1FunctionDeclaration skipwhite
|
|
||||||
syn keyword ps1Keyword enum nextgroup=ps1FunctionDeclaration skipwhite
|
|
||||||
syn match ps1FunctionDeclaration /\w\+\(-\w\+\)*/ contained
|
|
||||||
|
|
||||||
" Function invocations
|
|
||||||
syn match ps1FunctionInvocation /\w\+\(-\w\+\)\+/
|
|
||||||
|
|
||||||
" Type declarations
|
" Type declarations
|
||||||
syn match ps1Type /\[[a-z_][a-z0-9_.,\[\]]\+\]/
|
syn match ps1Type /\[[a-z0-9_:.]\+\(\[\]\)\?\]/
|
||||||
|
syn match ps1StandaloneType /[a-z0-9_.]\+/ contained
|
||||||
|
syn keyword ps1Scope global local private script contained
|
||||||
|
|
||||||
" Variable references
|
" Variables and other user defined items
|
||||||
syn match ps1ScopeModifier /\(global:\|local:\|private:\|script:\)/ contained
|
syn match ps1Variable /\$\w\+/
|
||||||
syn match ps1Variable /\$\w\+\(:\w\+\)\?/ contains=ps1ScopeModifier
|
syn match ps1Variable /\${\w\+:\\\w\+}/
|
||||||
syn match ps1Variable /\${\w\+\(:\w\+\)\?}/ contains=ps1ScopeModifier
|
syn match ps1ScopedVariable /\$\w\+:\w\+/ contains=ps1Scope
|
||||||
|
syn match ps1VariableName /\w\+/ contained
|
||||||
|
|
||||||
" Operators
|
" Operators all start w/ dash
|
||||||
syn keyword ps1Operator -eq -ne -ge -gt -lt -le -like -notlike -match -notmatch -replace -split -contains -notcontains
|
syn match ps1OperatorStart /-c\?/ nextgroup=ps1Operator
|
||||||
syn keyword ps1Operator -ieq -ine -ige -igt -ile -ilt -ilike -inotlike -imatch -inotmatch -ireplace -isplit -icontains -inotcontains
|
syn keyword ps1Operator eq ne ge gt lt le like notlike match notmatch replace split /contains/ notcontains contained
|
||||||
syn keyword ps1Operator -ceq -cne -cge -cgt -clt -cle -clike -cnotlike -cmatch -cnotmatch -creplace -csplit -ccontains -cnotcontains
|
syn keyword ps1Operator ieq ine ige igt ile ilt ilike inotlike imatch inotmatch ireplace isplit icontains inotcontains contained
|
||||||
syn keyword ps1Operator -in -notin
|
syn keyword ps1Operator ceq cne cge cgt clt cle clike cnotlike cmatch cnotmatch creplace csplit ccontains cnotcontains contained
|
||||||
syn keyword ps1Operator -is -isnot -as -join
|
syn keyword ps1Operator is isnot as join contained
|
||||||
syn keyword ps1Operator -and -or -not -xor -band -bor -bnot -bxor
|
syn keyword ps1Operator and or not xor band bor bnot bxor contained
|
||||||
syn keyword ps1Operator -f
|
syn keyword ps1Operator f contained
|
||||||
syn match ps1Operator /!/
|
|
||||||
syn match ps1Operator /=/
|
|
||||||
syn match ps1Operator /+=/
|
|
||||||
syn match ps1Operator /-=/
|
|
||||||
syn match ps1Operator /\*=/
|
|
||||||
syn match ps1Operator /\/=/
|
|
||||||
syn match ps1Operator /%=/
|
|
||||||
syn match ps1Operator /+/
|
|
||||||
syn match ps1Operator /-\(\s\|\d\|\.\|\$\|(\)\@=/
|
|
||||||
syn match ps1Operator /\*/
|
|
||||||
syn match ps1Operator /\//
|
|
||||||
syn match ps1Operator /|/
|
|
||||||
syn match ps1Operator /%/
|
|
||||||
syn match ps1Operator /&/
|
|
||||||
syn match ps1Operator /::/
|
|
||||||
syn match ps1Operator /,/
|
|
||||||
syn match ps1Operator /\(^\|\s\)\@<=\. \@=/
|
|
||||||
|
|
||||||
" Regular Strings
|
" Regular Strings
|
||||||
" These aren't precisely correct and could use some work
|
" These aren't precisely correct and could use some work
|
||||||
syn region ps1String start=/"/ skip=/`"/ end=/"/ contains=@ps1StringSpecial,@Spell
|
syn region ps1String start=/"/ skip=/`"/ end=/"/ contains=@ps1StringSpecial
|
||||||
syn region ps1String start=/'/ skip=/''/ end=/'/
|
syn region ps1String start=/'/ skip=/''/ end=/'/
|
||||||
|
|
||||||
" Here-Strings
|
" Here-Strings
|
||||||
syn region ps1String start=/@"$/ end=/^"@/ contains=@ps1StringSpecial,@Spell
|
syn region ps1String start=/@"$/ end=/^"@$/ contains=@ps1StringSpecial
|
||||||
syn region ps1String start=/@'$/ end=/^'@/
|
syn region ps1String start=/@'$/ end=/^'@$/
|
||||||
|
|
||||||
" Interpolation
|
" Interpolation
|
||||||
syn match ps1Escape /`./
|
syn match ps1Escape /`./ contained
|
||||||
syn region ps1Interpolation matchgroup=ps1InterpolationDelimiter start="$(" end=")" contained contains=ALLBUT,@ps1NotTop
|
syn region ps1Interpolation matchgroup=ps1InterpolationDelimiter start="$(" end=")" contained contains=ALLBUT,@ps1NotTop
|
||||||
syn region ps1NestedParentheses start="(" skip="\\\\\|\\)" matchgroup=ps1Interpolation end=")" transparent contained
|
syn region ps1NestedParentheses start="(" skip="\\\\\|\\)" matchgroup=ps1Interpolation end=")" transparent contained
|
||||||
syn cluster ps1StringSpecial contains=ps1Escape,ps1Interpolation,ps1Variable,ps1Boolean,ps1Constant,ps1BuiltIn,@Spell
|
syn cluster ps1StringSpecial contains=ps1Escape,ps1Interpolation,ps1Variable,ps1Boolean,ps1Constant,ps1BuiltIn
|
||||||
|
|
||||||
" Numbers
|
" Numbers
|
||||||
syn match ps1Number "\(\<\|-\)\@<=\(0[xX]\x\+\|\d\+\)\([KMGTP][B]\)\=\(\>\|-\)\@="
|
" syn match ps1Number /\<[0-9]\+/
|
||||||
syn match ps1Number "\(\(\<\|-\)\@<=\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[dD]\="
|
syn match ps1Number "\<\(0[xX]\x\+\|\d\+\)\([MGTP][B]\)\=\>"
|
||||||
|
syn match ps1Number "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[dD]\="
|
||||||
syn match ps1Number "\<\d\+[eE][-+]\=\d\+[dD]\=\>"
|
syn match ps1Number "\<\d\+[eE][-+]\=\d\+[dD]\=\>"
|
||||||
syn match ps1Number "\<\d\+\([eE][-+]\=\d\+\)\=[dD]\>"
|
syn match ps1Number "\<\d\+\([eE][-+]\=\d\+\)\=[dD]\>"
|
||||||
|
|
||||||
|
@ -132,54 +106,47 @@ syn match ps1BuiltIn "$\%(match\(es\)\?\|myinvocation\|host\|lastexitcode\)\>"
|
||||||
syn match ps1BuiltIn "$\%(ofs\|shellid\|stacktrace\)\>"
|
syn match ps1BuiltIn "$\%(ofs\|shellid\|stacktrace\)\>"
|
||||||
|
|
||||||
" Folding blocks
|
" Folding blocks
|
||||||
if !exists('g:ps1_nofold_blocks')
|
syn region ps1Block start=/{/ end=/}/ transparent fold
|
||||||
syn region ps1Block start=/{/ end=/}/ transparent fold
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists('g:ps1_nofold_region')
|
|
||||||
syn region ps1Region start=/#region/ end=/#endregion/ transparent fold keepend extend
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists('g:ps1_nofold_sig')
|
|
||||||
syn region ps1Signature start=/# SIG # Begin signature block/ end=/# SIG # End signature block/ transparent fold
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Setup default color highlighting
|
" Setup default color highlighting
|
||||||
if version >= 508 || !exists("did_ps1_syn_inits")
|
if version >= 508 || !exists("did_ps1_syn_inits")
|
||||||
if version < 508
|
if version < 508
|
||||||
let did_ps1_syn_inits = 1
|
let did_ps1_syn_inits = 1
|
||||||
command -nargs=+ HiLink hi link <args>
|
command -nargs=+ HiLink hi link <args>
|
||||||
else
|
else
|
||||||
command -nargs=+ HiLink hi def link <args>
|
command -nargs=+ HiLink hi def link <args>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
HiLink ps1Number Number
|
HiLink ps1Number Number
|
||||||
HiLink ps1Block Block
|
HiLink ps1Block Block
|
||||||
HiLink ps1Region Region
|
|
||||||
HiLink ps1Exception Exception
|
HiLink ps1Exception Exception
|
||||||
HiLink ps1Constant Constant
|
HiLink ps1Constant Constant
|
||||||
HiLink ps1String String
|
HiLink ps1String String
|
||||||
HiLink ps1Escape SpecialChar
|
HiLink ps1Escape SpecialChar
|
||||||
HiLink ps1InterpolationDelimiter Delimiter
|
HiLink ps1InterpolationDelimiter Delimiter
|
||||||
HiLink ps1Conditional Conditional
|
HiLink ps1Conditional Conditional
|
||||||
HiLink ps1FunctionDeclaration Function
|
HiLink ps1Function Function
|
||||||
HiLink ps1FunctionInvocation Function
|
HiLink ps1Variable Identifier
|
||||||
HiLink ps1Variable Identifier
|
HiLink ps1ScopedVariable Identifier
|
||||||
HiLink ps1Boolean Boolean
|
HiLink ps1VariableName Identifier
|
||||||
HiLink ps1Constant Constant
|
HiLink ps1Boolean Boolean
|
||||||
HiLink ps1BuiltIn StorageClass
|
HiLink ps1Constant Constant
|
||||||
HiLink ps1Type Type
|
HiLink ps1BuiltIn StorageClass
|
||||||
HiLink ps1ScopeModifier StorageClass
|
HiLink ps1Type Type
|
||||||
HiLink ps1Comment Comment
|
HiLink ps1Scope Type
|
||||||
HiLink ps1CommentTodo Todo
|
HiLink ps1StandaloneType Type
|
||||||
HiLink ps1CommentDoc Tag
|
HiLink ps1Number Number
|
||||||
HiLink ps1CDocParam Todo
|
HiLink ps1Comment Comment
|
||||||
HiLink ps1Operator Operator
|
HiLink ps1CommentTodo Todo
|
||||||
HiLink ps1Repeat Repeat
|
HiLink ps1CommentDoc Tag
|
||||||
HiLink ps1RepeatAndCmdlet Repeat
|
HiLink ps1CDocParam Todo
|
||||||
HiLink ps1Keyword Keyword
|
HiLink ps1Operator Operator
|
||||||
HiLink ps1KeywordAndCmdlet Keyword
|
HiLink ps1Repeat Repeat
|
||||||
delcommand HiLink
|
HiLink ps1RepeatAndCmdlet Repeat
|
||||||
|
HiLink ps1Keyword Keyword
|
||||||
|
HiLink ps1KeywordAndCmdlet Keyword
|
||||||
|
HiLink ps1Cmdlet Statement
|
||||||
|
delcommand HiLink
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let b:current_syntax = "ps1"
|
let b:current_syntax = "powershell"
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
" Vim syntax file
|
|
||||||
" Language: Windows PowerShell XML
|
|
||||||
" Maintainer: Peter Provost <peter@provost.org>
|
|
||||||
" Version: 2.10
|
|
||||||
" Project Repository: https://github.com/PProvost/vim-ps1
|
|
||||||
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327"
|
|
||||||
|
|
||||||
" Compatible VIM syntax file start
|
|
||||||
if version < 600
|
|
||||||
syntax clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:ps1xml_cpo_save = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
doau syntax xml
|
|
||||||
unlet b:current_syntax
|
|
||||||
|
|
||||||
syn case ignore
|
|
||||||
syn include @ps1xmlScriptBlock <sfile>:p:h/ps1.vim
|
|
||||||
unlet b:current_syntax
|
|
||||||
|
|
||||||
syn region ps1xmlScriptBlock
|
|
||||||
\ matchgroup=xmlTag start="<Script>"
|
|
||||||
\ matchgroup=xmlEndTag end="</Script>"
|
|
||||||
\ fold
|
|
||||||
\ contains=@ps1xmlScriptBlock
|
|
||||||
\ keepend
|
|
||||||
syn region ps1xmlScriptBlock
|
|
||||||
\ matchgroup=xmlTag start="<ScriptBlock>"
|
|
||||||
\ matchgroup=xmlEndTag end="</ScriptBlock>"
|
|
||||||
\ fold
|
|
||||||
\ contains=@ps1xmlScriptBlock
|
|
||||||
\ keepend
|
|
||||||
syn region ps1xmlScriptBlock
|
|
||||||
\ matchgroup=xmlTag start="<GetScriptBlock>"
|
|
||||||
\ matchgroup=xmlEndTag end="</GetScriptBlock>"
|
|
||||||
\ fold
|
|
||||||
\ contains=@ps1xmlScriptBlock
|
|
||||||
\ keepend
|
|
||||||
syn region ps1xmlScriptBlock
|
|
||||||
\ matchgroup=xmlTag start="<SetScriptBlock>"
|
|
||||||
\ matchgroup=xmlEndTag end="</SetScriptBlock>"
|
|
||||||
\ fold
|
|
||||||
\ contains=@ps1xmlScriptBlock
|
|
||||||
\ keepend
|
|
||||||
|
|
||||||
syn cluster xmlRegionHook add=ps1xmlScriptBlock
|
|
||||||
|
|
||||||
let b:current_syntax = "ps1xml"
|
|
||||||
|
|
||||||
let &cpo = s:ps1xml_cpo_save
|
|
||||||
unlet s:ps1xml_cpo_save
|
|
||||||
|
|
Loading…
Reference in a new issue