Update vim-ps1 to v2.9

This commit is contained in:
Anthony Rose 2019-06-03 15:59:15 +01:00
parent 566926ad64
commit 503c765343
11 changed files with 107 additions and 307 deletions

View file

@ -1 +0,0 @@
/doc/tags

View file

@ -9,9 +9,8 @@ files, and also includes a filetype plugin so Vim can autodetect your PS1 script
Includes contributions by:
* Tomas Restrepo
* Jared Parsons
* Heath Stewart
* Jared Parsons <jaredp@beanseed.org>
* Heath Stewart <heaths@microsoft.com>
* Michael B. Smith
* Alexander Kostikov
@ -20,34 +19,17 @@ Installation
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
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
------------------------
Please follow, fork or submit issues on [GitHub][2] and if you
find it useful, please vote for it on [vim.org][3].
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](http://www.vim.org/scripts/script.php?script_id=1327).
License
-------
@ -69,7 +51,6 @@ License
Version History
---------------
* v2.10 (2013-06-24) Added Heath Stewart's here strings fix
* v2.9 (2012-03-08) Included tomasr's changes
* v2.81 (2012-03-05) Fixed a dumb typo
* 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.2 (2005-08-13) Fix foreach and while problem
* 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

View file

@ -1,38 +1,16 @@
*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
Version: 2.10
Version: 2.9
INTRODUCTION *ps1-syntax*
This plugin provides Vim syntax, indent and filetype detection for Windows
PowerShell scripts, modules, and XML configuration files.
PowerShell.
ABOUT *ps1-about*
Grab the latest version or report a bug on GitHub:
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:

View file

@ -1,11 +1,9 @@
" Vim ftdetect plugin file
" Language: Windows PowerShell
" Maintainer: Peter Provost <peter@provost.org>
" Version: 2.10
" Version: 2.9
" Project Repository: https://github.com/PProvost/vim-ps1
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
"
au BufNewFile,BufRead *.ps1 set ft=ps1
au BufNewFile,BufRead *.psd1 set ft=ps1
au BufNewFile,BufRead *.psm1 set ft=ps1
au BufNewFile,BufRead *.pssc set ft=ps1

View file

@ -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

View file

@ -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

View file

@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Windows PowerShell
" Maintainer: Peter Provost <peter@provost.org>
" Version: 2.10
" Version: 2.9
" Project Repository: https://github.com/PProvost/vim-ps1
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327
@ -14,23 +14,13 @@ let b:did_ftplugin = 1
setlocal tw=0
setlocal commentstring=#%s
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
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" .
let b:browsefilter = "PowerShell Files (*.ps1)\t*.ps1\n" .
\ "All Files (*.*)\t*.*\n"
endif
" Undo the stuff we changed
let b:undo_ftplugin = "setlocal tw< cms< fo<" .
\ " | unlet! b:browsefilter"

View file

@ -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"

View file

@ -1,7 +1,7 @@
" Vim indent file
" Language: Windows PowerShell
" Maintainer: Peter Provost <peter@provost.org>
" Version: 2.10
" Version: 2.9
" Project Repository: https://github.com/PProvost/vim-ps1
" Vim Script Page: http://www.vim.org/scripts/script.php?script_id=1327"
@ -11,10 +11,7 @@ if exists("b:did_indent")
endif
let b:did_indent = 1
" smartindent is good enough for powershell
setlocal smartindent
" disable the indent removal for # marks
inoremap # X#
let b:undo_indent = "setl si<"
" PS indenting is like indenting C
setlocal cindent cinoptions& cinoptions+=+0
let b:undo_indent = "setl cin<"

View file

@ -1,14 +1,9 @@
" Vim syntax file
" Language: Windows PowerShell
" Maintainer: Peter Provost <peter@provost.org>
" Version: 2.10
" Version: 2.9
" Project Repository: https://github.com/PProvost/vim-ps1
" 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
if version < 600
@ -17,9 +12,6 @@ elseif exists("b:current_syntax")
finish
endif
" Operators contain dashes
setlocal iskeyword+=-
" PowerShell doesn't care about case
syn case ignore
@ -27,15 +19,15 @@ syn case ignore
syn sync minlines=100
" 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
syn keyword ps1CommentTodo TODO FIXME XXX TBD HACK NOTE 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 ps1Comment /#.*/ contains=ps1CommentTodo,ps1CommentDoc,@Spell
syn region ps1Comment start="<#" end="#>" contains=ps1CommentTodo,ps1CommentDoc,@Spell
syn match ps1Comment /#.*/ contains=ps1CommentTodo,ps1CommentDoc
syn region ps1Comment start="<#" end="#>" contains=ps1CommentTodo,ps1CommentDoc
" Language keywords and elements
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 /\<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 return filter in trap param data dynamicparam
syn match ps1Keyword /&/
syn keyword ps1Constant $true $false $null
syn match ps1Constant +\$?+
syn match ps1Constant +\$_+
@ -56,70 +49,51 @@ syn match ps1Constant +\$^+
" Keywords reserved for future use
syn keyword ps1Keyword class define from using var
" Function declarations
syn keyword ps1Keyword function nextgroup=ps1FunctionDeclaration skipwhite
syn keyword ps1Keyword filter nextgroup=ps1FunctionDeclaration skipwhite
syn keyword ps1Keyword workflow nextgroup=ps1FunctionDeclaration skipwhite
syn keyword ps1Keyword configuration nextgroup=ps1FunctionDeclaration skipwhite
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\+\)\+/
" Functions and Cmdlets
syn match ps1Cmdlet /\w\+-\w\+/
syn keyword ps1Keyword function nextgroup=ps1Function skipwhite
syn keyword ps1Keyword filter nextgroup=ps1Function skipwhite
syn match ps1Function /\w\+-*\w*/ contained
" 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
syn match ps1ScopeModifier /\(global:\|local:\|private:\|script:\)/ contained
syn match ps1Variable /\$\w\+\(:\w\+\)\?/ contains=ps1ScopeModifier
syn match ps1Variable /\${\w\+\(:\w\+\)\?}/ contains=ps1ScopeModifier
" Variables and other user defined items
syn match ps1Variable /\$\w\+/
syn match ps1Variable /\${\w\+:\\\w\+}/
syn match ps1ScopedVariable /\$\w\+:\w\+/ contains=ps1Scope
syn match ps1VariableName /\w\+/ contained
" Operators
syn keyword ps1Operator -eq -ne -ge -gt -lt -le -like -notlike -match -notmatch -replace -split -contains -notcontains
syn keyword ps1Operator -ieq -ine -ige -igt -ile -ilt -ilike -inotlike -imatch -inotmatch -ireplace -isplit -icontains -inotcontains
syn keyword ps1Operator -ceq -cne -cge -cgt -clt -cle -clike -cnotlike -cmatch -cnotmatch -creplace -csplit -ccontains -cnotcontains
syn keyword ps1Operator -in -notin
syn keyword ps1Operator -is -isnot -as -join
syn keyword ps1Operator -and -or -not -xor -band -bor -bnot -bxor
syn keyword ps1Operator -f
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\)\@<=\. \@=/
" Operators all start w/ dash
syn match ps1OperatorStart /-c\?/ nextgroup=ps1Operator
syn keyword ps1Operator eq ne ge gt lt le like notlike match notmatch replace split /contains/ notcontains contained
syn keyword ps1Operator ieq ine ige igt ile ilt ilike inotlike imatch inotmatch ireplace isplit icontains inotcontains contained
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 contained
syn keyword ps1Operator and or not xor band bor bnot bxor contained
syn keyword ps1Operator f contained
" Regular Strings
" 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=/'/
" Here-Strings
syn region ps1String start=/@"$/ end=/^"@/ contains=@ps1StringSpecial,@Spell
syn region ps1String start=/@'$/ end=/^'@/
syn region ps1String start=/@"$/ end=/^"@$/ contains=@ps1StringSpecial
syn region ps1String start=/@'$/ end=/^'@$/
" Interpolation
syn match ps1Escape /`./
syn match ps1Escape /`./ contained
syn region ps1Interpolation matchgroup=ps1InterpolationDelimiter start="$(" end=")" contained contains=ALLBUT,@ps1NotTop
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
syn match ps1Number "\(\<\|-\)\@<=\(0[xX]\x\+\|\d\+\)\([KMGTP][B]\)\=\(\>\|-\)\@="
syn match ps1Number "\(\(\<\|-\)\@<=\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[dD]\="
" syn match ps1Number /\<[0-9]\+/
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]\>"
@ -132,17 +106,7 @@ syn match ps1BuiltIn "$\%(match\(es\)\?\|myinvocation\|host\|lastexitcode\)\>"
syn match ps1BuiltIn "$\%(ofs\|shellid\|stacktrace\)\>"
" Folding blocks
if !exists('g:ps1_nofold_blocks')
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
syn region ps1Block start=/{/ end=/}/ transparent fold
" Setup default color highlighting
if version >= 508 || !exists("did_ps1_syn_inits")
@ -155,21 +119,23 @@ if version >= 508 || !exists("did_ps1_syn_inits")
HiLink ps1Number Number
HiLink ps1Block Block
HiLink ps1Region Region
HiLink ps1Exception Exception
HiLink ps1Constant Constant
HiLink ps1String String
HiLink ps1Escape SpecialChar
HiLink ps1InterpolationDelimiter Delimiter
HiLink ps1Conditional Conditional
HiLink ps1FunctionDeclaration Function
HiLink ps1FunctionInvocation Function
HiLink ps1Function Function
HiLink ps1Variable Identifier
HiLink ps1ScopedVariable Identifier
HiLink ps1VariableName Identifier
HiLink ps1Boolean Boolean
HiLink ps1Constant Constant
HiLink ps1BuiltIn StorageClass
HiLink ps1Type Type
HiLink ps1ScopeModifier StorageClass
HiLink ps1Scope Type
HiLink ps1StandaloneType Type
HiLink ps1Number Number
HiLink ps1Comment Comment
HiLink ps1CommentTodo Todo
HiLink ps1CommentDoc Tag
@ -179,7 +145,8 @@ if version >= 508 || !exists("did_ps1_syn_inits")
HiLink ps1RepeatAndCmdlet Repeat
HiLink ps1Keyword Keyword
HiLink ps1KeywordAndCmdlet Keyword
HiLink ps1Cmdlet Statement
delcommand HiLink
endif
let b:current_syntax = "ps1"
let b:current_syntax = "powershell"

View file

@ -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