vim-patch:37c64c78fd87

Note: Ignored changes to matchit.vim in favor of faca814116.

---

Update runtime files.

37c64c78fd
This commit is contained in:
Justin M. Keyes
2017-11-07 19:34:37 +01:00
parent ae569ea57b
commit 8c6168565c
30 changed files with 3240 additions and 2210 deletions

View File

@@ -1,6 +1,6 @@
" Vim support file to help with paste mappings and menus " Vim support file to help with paste mappings and menus
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Jun 23 " Last Change: 2017 Aug 30
" Define the string to use for items that are present both in Edit, Popup and " Define the string to use for items that are present both in Edit, Popup and
" Toolbar menu. Also used in mswin.vim and macmap.vim. " Toolbar menu. Also used in mswin.vim and macmap.vim.
@@ -12,7 +12,7 @@
if has("virtualedit") if has("virtualedit")
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"} let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n'] let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
let paste#paste_cmd['i'] = 'x<BS><Esc>' . paste#paste_cmd['n'] . 'gi' let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP"
func! paste#Paste() func! paste#Paste()
let ove = &ve let ove = &ve

View File

@@ -781,6 +781,7 @@ Also see |`=|.
*:<cword>* *:<cWORD>* *:<cfile>* *<cfile>* *:<cword>* *:<cWORD>* *:<cfile>* *<cfile>*
*:<sfile>* *<sfile>* *:<afile>* *<afile>* *:<sfile>* *<sfile>* *:<afile>* *<afile>*
*:<abuf>* *<abuf>* *:<amatch>* *<amatch>* *:<abuf>* *<abuf>* *:<amatch>* *<amatch>*
*:<cexpr>* *<cexpr>*
*<slnum>* *E495* *E496* *E497* *E499* *E500* *<slnum>* *E495* *E496* *E497* *E499* *E500*
Note: these are typed literally, they are not special keys! Note: these are typed literally, they are not special keys!
<cword> is replaced with the word under the cursor (like |star|) <cword> is replaced with the word under the cursor (like |star|)

View File

@@ -214,8 +214,8 @@ The diffs are highlighted with these groups:
(searching from the end of the line). The (searching from the end of the line). The
text in between is highlighted. This means text in between is highlighted. This means
that parts in the middle that are still the that parts in the middle that are still the
same are highlighted anyway. Only "iwhite" of same are highlighted anyway. The 'diffopt'
'diffopt' is used here. flags "iwhite" and "icase" are used here.
|hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines, |hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines,
because they don't really exist in this because they don't really exist in this
buffer. buffer.

View File

@@ -4407,7 +4407,9 @@ getwininfo([{winid}]) *getwininfo()*
Each List item is a Dictionary with the following entries: Each List item is a Dictionary with the following entries:
bufnr number of buffer in the window bufnr number of buffer in the window
height window height height window height (excluding winbar)
winbar 1 if the window has a toolbar, 0
otherwise
loclist 1 if showing a location list loclist 1 if showing a location list
quickfix 1 if quickfix or location list window quickfix 1 if quickfix or location list window
tabnr tab page number tabnr tab page number
@@ -5277,6 +5279,7 @@ maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()*
"s" Select "s" Select
"x" Visual "x" Visual
"l" langmap |language-mapping| "l" langmap |language-mapping|
"t" Terminal
"" Normal, Visual and Operator-pending "" Normal, Visual and Operator-pending
When {mode} is omitted, the modes for "" are used. When {mode} is omitted, the modes for "" are used.
@@ -8048,6 +8051,7 @@ winheight({nr}) *winheight()*
When {nr} is zero, the height of the current window is When {nr} is zero, the height of the current window is
returned. When window {nr} doesn't exist, -1 is returned. returned. When window {nr} doesn't exist, -1 is returned.
An existing window always has a height of zero or more. An existing window always has a height of zero or more.
This excludes any window toolbar line.
Examples: > Examples: >
:echo "The current window has " . winheight(0) . " lines." :echo "The current window has " . winheight(0) . " lines."
< <

View File

@@ -649,6 +649,8 @@ nr Name Normal action ~
In the Win32 GUI, starting a menu name with ']' excludes that menu from the In the Win32 GUI, starting a menu name with ']' excludes that menu from the
main menu bar. You must then use the |:popup| command to display it. main menu bar. You must then use the |:popup| command to display it.
When splitting the window the window toolbar is not copied to the new window.
*popup-menu* *popup-menu*
You can define the special menu "PopUp". This is the menu that is displayed You can define the special menu "PopUp". This is the menu that is displayed
when the right mouse button is pressed, if 'mousemodel' is set to popup or when the right mouse button is pressed, if 'mousemodel' is set to popup or

View File

@@ -1542,13 +1542,17 @@ tag command action ~
|:tjump| :tj[ump] like ":tselect", but jump directly when there |:tjump| :tj[ump] like ":tselect", but jump directly when there
is only one match is only one match
|:tlast| :tl[ast] jump to last matching tag |:tlast| :tl[ast] jump to last matching tag
|:tmapclear| :tmapc[lear] remove all mappings for Terminal-Job mode
|:tmap| :tma[p] like ":map" but for Terminal-Job mode
|:tmenu| :tm[enu] define menu tooltip |:tmenu| :tm[enu] define menu tooltip
|:tnext| :tn[ext] jump to next matching tag |:tnext| :tn[ext] jump to next matching tag
|:tnoremap| :tno[remap] like ":noremap" but for Terminal-Job mode
|:topleft| :to[pleft] make split window appear at top or far left |:topleft| :to[pleft] make split window appear at top or far left
|:tprevious| :tp[revious] jump to previous matching tag |:tprevious| :tp[revious] jump to previous matching tag
|:trewind| :tr[ewind] jump to first matching tag |:trewind| :tr[ewind] jump to first matching tag
|:try| :try execute commands, abort on error or exception |:try| :try execute commands, abort on error or exception
|:tselect| :ts[elect] list matching tags and select one |:tselect| :ts[elect] list matching tags and select one
|:tunmap| :tunma[p] like ":unmap" but for Terminal-Job mode
|:tunmenu| :tu[nmenu] remove menu tooltip |:tunmenu| :tu[nmenu] remove menu tooltip
|:undo| :u[ndo] undo last change(s) |:undo| :u[ndo] undo last change(s)
|:undojoin| :undoj[oin] join next change with previous undo block |:undojoin| :undoj[oin] join next change with previous undo block

View File

@@ -241,6 +241,10 @@ Vim would never have become what it is now, without the help of these people!
Juergen Weigert Lattice version, AUX improvements, Unix and Juergen Weigert Lattice version, AUX improvements, Unix and
MS-DOS ports, autoconf MS-DOS ports, autoconf
Stefan 'Sec' Zehl Maintainer of vim.org Stefan 'Sec' Zehl Maintainer of vim.org
Yasuhiro Matsumoto many MS-Windows improvements
Ken Takata fixes and features
Kazunobu Kuriyama GTK 3
Christian Brabandt many fixes, features, user support, etc.
I wish to thank all the people that sent me bug reports and suggestions. The I wish to thank all the people that sent me bug reports and suggestions. The
list is too long to mention them all here. Vim would not be the same without list is too long to mention them all here. Vim would not be the same without

View File

@@ -41,7 +41,7 @@ modes.
:im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap* :im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap*
:lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap* :lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap*
:cm[ap] {lhs} {rhs} |mapmode-c| *:cm* *:cmap* :cm[ap] {lhs} {rhs} |mapmode-c| *:cm* *:cmap*
:tm[ap] {lhs} {rhs} |mapmode-t| *:tm* *:tmap* :tma[p] {lhs} {rhs} |mapmode-t| *:tma* *:tmap*
Map the key sequence {lhs} to {rhs} for the modes Map the key sequence {lhs} to {rhs} for the modes
where the map command applies. The result, including where the map command applies. The result, including
{rhs}, is then further scanned for mappings. This {rhs}, is then further scanned for mappings. This
@@ -75,7 +75,7 @@ modes.
:iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap* :iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap*
:lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap* :lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap*
:cu[nmap] {lhs} |mapmode-c| *:cu* *:cunmap* :cu[nmap] {lhs} |mapmode-c| *:cu* *:cunmap*
:tu[nmap] {lhs} |mapmode-t| *:tu* *:tunmap* :tunma[p] {lhs} |mapmode-t| *:tunma* *:tunmap*
Remove the mapping of {lhs} for the modes where the Remove the mapping of {lhs} for the modes where the
map command applies. The mapping may remain defined map command applies. The mapping may remain defined
for other modes where it applies. for other modes where it applies.
@@ -111,7 +111,7 @@ modes.
:im[ap] |mapmode-i| :im[ap] |mapmode-i|
:lm[ap] |mapmode-l| :lm[ap] |mapmode-l|
:cm[ap] |mapmode-c| :cm[ap] |mapmode-c|
:tm[ap] |mapmode-t| :tma[p] |mapmode-t|
List all key mappings for the modes where the map List all key mappings for the modes where the map
command applies. Note that ":map" and ":map!" are command applies. Note that ":map" and ":map!" are
used most often, because they include the other modes. used most often, because they include the other modes.
@@ -126,7 +126,7 @@ modes.
:im[ap] {lhs} |mapmode-i| *:imap_l* :im[ap] {lhs} |mapmode-i| *:imap_l*
:lm[ap] {lhs} |mapmode-l| *:lmap_l* :lm[ap] {lhs} |mapmode-l| *:lmap_l*
:cm[ap] {lhs} |mapmode-c| *:cmap_l* :cm[ap] {lhs} |mapmode-c| *:cmap_l*
:tm[ap] {lhs} |mapmode-t| *:tmap_l* :tma[p] {lhs} |mapmode-t| *:tmap_l*
List the key mappings for the key sequences starting List the key mappings for the key sequences starting
with {lhs} in the modes where the map command applies. with {lhs} in the modes where the map command applies.
@@ -653,7 +653,7 @@ option). After that it assumes that the 'q' is to be interpreted as such. If
you type slowly, or your system is slow, reset the 'timeout' option. Then you you type slowly, or your system is slow, reset the 'timeout' option. Then you
might want to set the 'ttimeout' option. might want to set the 'ttimeout' option.
*map-precedence* *map-precedence*
Buffer-local mappings (defined using |:map-<buffer>|) take precedence over Buffer-local mappings (defined using |:map-<buffer>|) take precedence over
global mappings. When a buffer-local mapping is the same as a global mapping, global mappings. When a buffer-local mapping is the same as a global mapping,
Vim will use the buffer-local mapping. In addition, Vim will use a complete Vim will use the buffer-local mapping. In addition, Vim will use a complete

View File

@@ -360,6 +360,16 @@ command, not when assigning a value to an option with ":let".
*$HOME-windows* *$HOME-windows*
On MS-Windows, if $HOME is not defined as an environment variable, then On MS-Windows, if $HOME is not defined as an environment variable, then
at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH. at runtime Vim will set it to the expansion of $HOMEDRIVE$HOMEPATH.
If $HOMEDRIVE is not set then $USERPROFILE is used.
This expanded value is not exported to the environment, this matters when
running an external command: >
:echo system('set | findstr ^HOME=')
and >
:echo luaeval('os.getenv("HOME")')
should echo nothing (an empty string) despite exists('$HOME') being true.
When setting $HOME to a non-empty string it will be exported to the
subprocesses.
Note the maximum length of an expanded option is limited. How much depends on Note the maximum length of an expanded option is limited. How much depends on
@@ -718,11 +728,12 @@ A jump table for the options with a short description can be found at |Q_op|.
< Vim will guess the value. In the GUI this should work correctly, < Vim will guess the value. In the GUI this should work correctly,
in other cases Vim might not be able to guess the right value. in other cases Vim might not be able to guess the right value.
When the t_BG option is set, Vim will use it to request the background When the |t_RB| option is set, Vim will use it to request the background
color from the terminal. If the returned RGB value is dark/light and color from the terminal. If the returned RGB value is dark/light and
'background' is not dark/light, 'background' will be set and the 'background' is not dark/light, 'background' will be set and the
screen is redrawn. This may have side effects, make t_BG empty in screen is redrawn. This may have side effects, make t_BG empty in
your .vimrc if you suspect this problem. your .vimrc if you suspect this problem. The response to |t_RB| can
be found in |v:termrgbresp|.
When starting the GUI, the default value for 'background' will be When starting the GUI, the default value for 'background' will be
"light". When the value is not set in the gvimrc, and Vim detects "light". When the value is not set in the gvimrc, and Vim detects

View File

@@ -31,6 +31,13 @@ From inside Vim an easy way to run a command and handle the output is with the
The 'errorformat' option should be set to match the error messages from your The 'errorformat' option should be set to match the error messages from your
compiler (see |errorformat| below). compiler (see |errorformat| below).
*quickfix-ID*
Each quickfix list has a unique identifier called the quickfix ID and this
number will not change within a Vim session. The getqflist() function can be
used to get the identifier assigned to a list. There is also a quickfix list
number which may change whenever more than ten lists are added to a quickfix
stack.
*location-list* *E776* *location-list* *E776*
A location list is a window-local quickfix list. You get one after commands A location list is a window-local quickfix list. You get one after commands
like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a like `:lvimgrep`, `:lgrep`, `:lhelpgrep`, `:lmake`, etc., which create a

View File

@@ -221,7 +221,7 @@ and write the file with ":w". You edit several other files, and then use
":edit one.txt" to come back to "one.txt". If you now use `" Vim jumps to the ":edit one.txt" to come back to "one.txt". If you now use `" Vim jumps to the
last line of the file. Using `. takes you to the position where you deleted last line of the file. Using `. takes you to the position where you deleted
the character. Even when you move around in the file `" and `. will take you the character. Even when you move around in the file `" and `. will take you
to the remembered position, at least until you make another change or leave to the remembered position. At least until you make another change or leave
the file. the file.
@@ -233,8 +233,8 @@ another file and place marks there, these are specific for that file. Thus
each file has its own set of marks, they are local to the file. each file has its own set of marks, they are local to the file.
So far we were using marks with a lowercase letter. There are also marks So far we were using marks with a lowercase letter. There are also marks
with an uppercase letter. These are global, they can be used from any file. with an uppercase letter. These are global, they can be used from any file.
For example suppose that we are editing the file "foo.txt". Go to halfway of For example suppose that we are editing the file "foo.txt". Go to halfway
the file ("50%") and place the F mark there (F for foo): > down the file ("50%") and place the F mark there (F for foo): >
50%mF 50%mF

View File

@@ -324,7 +324,7 @@ N *+cindent* |'cindent'|, C indenting
N *+clientserver* Unix and Win32: Remote invocation |clientserver| N *+clientserver* Unix and Win32: Remote invocation |clientserver|
*+clipboard* |clipboard| support *+clipboard* |clipboard| support
N *+cmdline_compl* command line completion |cmdline-completion| N *+cmdline_compl* command line completion |cmdline-completion|
N *+cmdline_hist* command line history |cmdline-history| S *+cmdline_hist* command line history |cmdline-history|
N *+cmdline_info* |'showcmd'| and |'ruler'| N *+cmdline_info* |'showcmd'| and |'ruler'|
N *+comments* |'comments'| support N *+comments* |'comments'| support
B *+conceal* "conceal" support, see |conceal| |:syn-conceal| etc. B *+conceal* "conceal" support, see |conceal| |:syn-conceal| etc.
@@ -347,7 +347,7 @@ N *+gettext* message translations |multi-lang|
*+iconv* Compiled with the |iconv()| function *+iconv* Compiled with the |iconv()| function
*+iconv/dyn* Likewise |iconv-dynamic| |/dyn| *+iconv/dyn* Likewise |iconv-dynamic| |/dyn|
N *+insert_expand* |insert_expand| Insert mode completion N *+insert_expand* |insert_expand| Insert mode completion
N *+jumplist* |jumplist| S *+jumplist* |jumplist|
B *+keymap* |'keymap'| B *+keymap* |'keymap'|
N *+lambda* |lambda| and |closure| N *+lambda* |lambda| and |closure|
B *+langmap* |'langmap'| B *+langmap* |'langmap'|
@@ -396,14 +396,14 @@ N *+timers* the |timer_start()| function
N *+title* Setting the window 'title' and 'icon' N *+title* Setting the window 'title' and 'icon'
N *+toolbar* |gui-toolbar| N *+toolbar* |gui-toolbar|
N *+user_commands* User-defined commands. |user-commands| N *+user_commands* User-defined commands. |user-commands|
N *+vertsplit* Vertically split windows |:vsplit| *+vertsplit* Vertically split windows |:vsplit|
N *+virtualedit* |'virtualedit'| N *+virtualedit* |'virtualedit'|
S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200. S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
N *+visualextra* extra Visual mode commands |blockwise-operators| N *+visualextra* extra Visual mode commands |blockwise-operators|
N *+vreplace* |gR| and |gr| N *+vreplace* |gR| and |gr|
N *+wildignore* |'wildignore'| N *+wildignore* |'wildignore'|
N *+wildmenu* |'wildmenu'| N *+wildmenu* |'wildmenu'|
S *+windows* more than one window *+windows* more than one window
m *+writebackup* |'writebackup'| is default on m *+writebackup* |'writebackup'| is default on
m *+xim* X input method |xim| m *+xim* X input method |xim|
*+xfontset* X fontset support |xfontset| *+xfontset* X fontset support |xfontset|

View File

@@ -997,6 +997,7 @@ list of buffers. |unlisted-buffer|
= a readonly buffer = a readonly buffer
R a terminal buffer with a running job R a terminal buffer with a running job
F a terminal buffer with a finished job F a terminal buffer with a finished job
? a terminal buffer without a job: `:terminal NONE`
+ a modified buffer + a modified buffer
x a buffer with read errors x a buffer with read errors

View File

@@ -3,7 +3,7 @@
" Maintainer: vim-perl <vim-perl@googlegroups.com> " Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: http://github.com/vim-perl/vim-perl " Homepage: http://github.com/vim-perl/vim-perl
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues " Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: 2013-07-21 " Last Change: 2015-02-09
if exists("b:did_ftplugin") | finish | endif if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1 let b:did_ftplugin = 1
@@ -33,14 +33,14 @@ endif
setlocal include=\\<\\(use\\\|require\\)\\> setlocal include=\\<\\(use\\\|require\\)\\>
setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','') setlocal includeexpr=substitute(substitute(substitute(v:fname,'::','/','g'),'->\*','',''),'$','.pm','')
setlocal define=[^A-Za-z_] setlocal define=[^A-Za-z_]
setlocal iskeyword+=:
" The following line changes a global variable but is necessary to make " The following line changes a global variable but is necessary to make
" gf and similar commands work. The change to iskeyword was incorrect. " gf and similar commands work. Thanks to Andrew Pimlott for pointing
" Thanks to Andrew Pimlott for pointing out the problem. If this causes a " out the problem. If this causes a problem for you, add an
" problem for you, add an after/ftplugin/perl.vim file that contains " after/ftplugin/perl.vim file that contains
" set isfname-=: " set isfname-=:
set isfname+=: set isfname+=:
set iskeyword+=:
" Set this once, globally. " Set this once, globally.
if !exists("perlpath") if !exists("perlpath")
@@ -77,11 +77,12 @@ endif
"--------------------------------------------- "---------------------------------------------
" Undo the stuff we changed. " Undo the stuff we changed.
let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< kp< path<" . let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isk< isf< kp< path<" .
\ " | unlet! b:browsefilter" \ " | unlet! b:browsefilter"
" proper matching for matchit plugin " proper matching for matchit plugin
let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField' let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField'
let b:match_words = '\<if\>:\<elsif\>:\<else\>'
" Restore the saved compatibility options. " Restore the saved compatibility options.
let &cpo = s:save_cpo let &cpo = s:save_cpo

View File

@@ -1,14 +1,12 @@
" Vim indent file " Vim indent file
" Program: CMake - Cross-Platform Makefile Generator
" Module: $RCSfile: cmake-indent.vim,v $
" Language: CMake (ft=cmake) " Language: CMake (ft=cmake)
" Author: Andy Cedilnik <andy.cedilnik@kitware.com> " Author: Andy Cedilnik <andy.cedilnik@kitware.com>
" Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com> " Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
" Last Change: $Date: 2008-01-16 16:53:53 $ " Former Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
" Version: $Revision: 1.9 $ " Last Change: 2017 Aug 30
" "
" Licence: The CMake license applies to this file. See " Licence: The CMake license applies to this file. See
" http://www.cmake.org/HTML/Copyright.html " https://cmake.org/licensing
" This implies that distribution with Vim is allowed " This implies that distribution with Vim is allowed
if exists("b:did_indent") if exists("b:did_indent")
@@ -16,6 +14,7 @@ if exists("b:did_indent")
endif endif
let b:did_indent = 1 let b:did_indent = 1
setlocal et
setlocal indentexpr=CMakeGetIndent(v:lnum) setlocal indentexpr=CMakeGetIndent(v:lnum)
setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE( setlocal indentkeys+==ENDIF(,ENDFOREACH(,ENDMACRO(,ELSE(,ELSEIF(,ENDWHILE(
@@ -68,19 +67,19 @@ fun! CMakeGetIndent(lnum)
let ind = ind let ind = ind
else else
if previous_line =~? cmake_indent_begin_regex if previous_line =~? cmake_indent_begin_regex
let ind = ind + shiftwidth() let ind = ind + &sw
endif endif
if previous_line =~? cmake_indent_open_regex if previous_line =~? cmake_indent_open_regex
let ind = ind + shiftwidth() let ind = ind + &sw
endif endif
endif endif
" Subtract " Subtract
if this_line =~? cmake_indent_end_regex if this_line =~? cmake_indent_end_regex
let ind = ind - shiftwidth() let ind = ind - &sw
endif endif
if previous_line =~? cmake_indent_close_regex if previous_line =~? cmake_indent_close_regex
let ind = ind - shiftwidth() let ind = ind - &sw
endif endif
return ind return ind

View File

@@ -2,7 +2,7 @@
" Language: Javascript " Language: Javascript
" Maintainer: Chris Paul ( https://github.com/bounceme ) " Maintainer: Chris Paul ( https://github.com/bounceme )
" URL: https://github.com/pangloss/vim-javascript " URL: https://github.com/pangloss/vim-javascript
" Last Change: March 21, 2017 " Last Change: September 18, 2017
" 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')
@@ -10,6 +10,10 @@ if exists('b:did_indent')
endif endif
let b:did_indent = 1 let b:did_indent = 1
" indent correctly if inside <script>
" vim/vim@690afe1 for the switch from cindent
let b:html_indent_script1 = 'inc'
" Now, set up our indentation expression and keys that trigger it. " Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetJavascriptIndent() setlocal indentexpr=GetJavascriptIndent()
setlocal autoindent nolisp nosmartindent setlocal autoindent nolisp nosmartindent
@@ -21,6 +25,13 @@ setlocal indentkeys+=0],0)
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<' let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
" Regex of syntax group names that are or delimit string or are comments.
let b:syng_strcom = get(b:,'syng_strcom','string\|comment\|regex\|special\|doc\|template\%(braces\)\@!')
let b:syng_str = get(b:,'syng_str','string\|template\|special')
" template strings may want to be excluded when editing graphql:
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
" Only define the function once. " Only define the function once.
if exists('*GetJavascriptIndent') if exists('*GetJavascriptIndent')
finish finish
@@ -36,7 +47,7 @@ if exists('*shiftwidth')
endfunction endfunction
else else
function s:sw() function s:sw()
return &l:shiftwidth == 0 ? &l:tabstop : &l:shiftwidth return &l:shiftwidth ? &l:shiftwidth : &l:tabstop
endfunction endfunction
endif endif
@@ -44,272 +55,301 @@ endif
" matches before pos. " matches before pos.
let s:z = has('patch-7.4.984') ? 'z' : '' let s:z = has('patch-7.4.984') ? 'z' : ''
" Expression used to check whether we should skip a match with searchpair().
let s:skip_expr = "s:SynAt(line('.'),col('.')) =~? b:syng_strcom"
let s:in_comm = s:skip_expr[:-14] . "'comment\\|doc'"
let s:rel = has('reltime')
" searchpair() wrapper " searchpair() wrapper
if has('reltime') if s:rel
function s:GetPair(start,end,flags,skip,time,...) function s:GetPair(start,end,flags,skip)
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 2000,0] + a:000),a:time) return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,s:l1,a:skip ==# 's:SkipFunc()' ? 2000 : 200)
endfunction endfunction
else else
function s:GetPair(start,end,flags,skip,...) function s:GetPair(start,end,flags,skip)
return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,max([prevnonblank(v:lnum) - 1000,get(a:000,1)])) return searchpair('\m'.a:start,'','\m'.a:end,a:flags,a:skip,s:l1)
endfunction endfunction
endif endif
" Regex of syntax group names that are or delimit string or are comments. function s:SynAt(l,c)
let s:syng_strcom = 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!' let byte = line2byte(a:l) + a:c - 1
let s:syng_str = 'string\|template\|special' let pos = index(s:synid_cache[0], byte)
let s:syng_com = 'comment\|doc' if pos == -1
" Expression used to check whether we should skip a match with searchpair(). let s:synid_cache[:] += [[byte], [synIDattr(synID(a:l, a:c, 0), 'name')]]
let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'"
function s:parse_cino(f) abort
return float2nr(eval(substitute(substitute(join(split(
\ matchstr(&cino,'.*'.a:f.'\zs[^,]*'), 's',1), '*'.s:W)
\ , '^-\=\zs\*','',''), '^-\=\zs\.','0.','')))
endfunction
function s:skip_func()
if getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$'
return eval(s:skip_expr)
elseif s:checkIn || search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn)
let s:checkIn = eval(s:skip_expr)
endif endif
let s:looksyn = line('.') return s:synid_cache[1][pos]
return s:checkIn
endfunction endfunction
function s:alternatePair(stop) function s:ParseCino(f)
let pos = getpos('.')[1:2] let [divider, n, cstr] = [0] + matchlist(&cino,
let pat = '[][(){};]' \ '\%(.*,\)\=\%(\%d'.char2nr(a:f).'\(-\)\=\([.s0-9]*\)\)\=')[1:2]
while search('\m'.pat,'bW',a:stop) for c in split(cstr,'\zs')
if s:skip_func() | continue | endif if c == '.' && !divider
let idx = stridx('])};',s:looking_at()) let divider = 1
if idx is 3 | let pat = '[{}()]' | continue | endif elseif c ==# 's'
if idx + 1 if n !~ '\d'
if s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,a:stop) <= 0 return n . s:sw() + 0
endif
let n = str2nr(n) * s:sw()
break
else
let [n, divider] .= [c, 0]
endif
endfor
return str2nr(n) / max([str2nr(divider),1])
endfunction
" Optimized {skip} expr, only callable from the search loop which
" GetJavascriptIndent does to find the containing [[{(] (side-effects)
function s:SkipFunc()
if s:top_col == 1
throw 'out of bounds'
endif
let s:top_col = 0
if s:check_in
if eval(s:skip_expr)
return 1
endif
let s:check_in = 0
elseif getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$'
if eval(s:skip_expr)
let s:looksyn = a:firstline
return 1
endif
elseif search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn) && eval(s:skip_expr)
let s:check_in = 1
return 1
endif
let [s:looksyn, s:top_col] = getpos('.')[1:2]
endfunction
function s:AlternatePair()
let [pat, l:for] = ['[][(){};]', 2]
while s:SearchLoop(pat,'bW','s:SkipFunc()')
if s:LookingAt() == ';'
if !l:for
if s:GetPair('{','}','bW','s:SkipFunc()')
return
endif
break break
else
let [pat, l:for] = ['[{}();]', l:for - 1]
endif endif
else else
return let idx = stridx('])}',s:LookingAt())
if idx == -1
return
elseif !s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:SkipFunc()')
break
endif
endif endif
endwhile endwhile
call call('cursor',pos) throw 'out of bounds'
endfunction endfunction
function s:save_pos(f,...) function s:Nat(int)
let l:pos = getpos('.')[1:2] return a:int * (a:int > 0)
let ret = call(a:f,a:000)
call call('cursor',l:pos)
return ret
endfunction endfunction
function s:syn_at(l,c) function s:LookingAt()
return synIDattr(synID(a:l,a:c,0),'name')
endfunction
function s:looking_at()
return getline('.')[col('.')-1] return getline('.')[col('.')-1]
endfunction endfunction
function s:token() function s:Token()
return s:looking_at() =~ '\k' ? expand('<cword>') : s:looking_at() return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt()
endfunction endfunction
function s:previous_token() function s:PreviousToken()
let l:pos = getpos('.')[1:2] let l:col = col('.')
if search('\m\k\{1,}\zs\k\|\S','bW') if search('\m\k\{1,}\|\S','ebW')
if (getline('.')[col('.')-2:col('.')-1] == '*/' || line('.') != l:pos[0] && if search('\m\*\%#\/\|\/\/\%<'.a:firstline.'l','nbW',line('.')) && eval(s:in_comm)
\ getline('.') =~ '\%<'.col('.').'c\/\/') && s:syn_at(line('.'),col('.')) =~? s:syng_com if s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm)
while search('\m\S\ze\_s*\/[/*]','bW') return s:Token()
if s:syn_at(line('.'),col('.')) !~? s:syng_com endif
return s:token() call cursor(a:firstline, l:col)
endif
endwhile
else else
return s:token() return s:Token()
endif endif
endif endif
call call('cursor',l:pos)
return '' return ''
endfunction endfunction
function s:expr_col() function s:Pure(f,...)
if getline('.')[col('.')-2] == ':' return eval("[call(a:f,a:000),cursor(a:firstline,".col('.').")][0]")
return 1 endfunction
endif
function s:SearchLoop(pat,flags,expr)
return s:GetPair(a:pat,'\_$.',a:flags,a:expr)
endfunction
function s:ExprCol()
let bal = 0 let bal = 0
while search('\m[{}?:;]','bW') while s:SearchLoop('[{}?]\|\_[^:]\zs::\@!','bW',s:skip_expr)
if eval(s:skip_expr) | continue | endif if s:LookingAt() == ':'
" switch (looking_at()) let bal -= 1
exe { '}': "if s:GetPair('{','}','bW',s:skip_expr,200) <= 0 | return | endif", elseif s:LookingAt() == '?'
\ ';': "return", let bal += 1
\ '{': "return getpos('.')[1:2] != b:js_cache[1:] && !s:IsBlock()", if bal == 1
\ ':': "let bal -= getline('.')[max([col('.')-2,0]):col('.')] !~ '::'", break
\ '?': "let bal += 1 | if bal > 0 | return 1 | endif" }[s:looking_at()] endif
elseif s:LookingAt() == '{'
let bal = !s:IsBlock()
break
elseif !s:GetPair('{','}','bW',s:skip_expr)
break
endif
endwhile endwhile
return s:Nat(bal)
endfunction endfunction
" configurable regexes that define continuation lines, not including (, {, or [. " configurable regexes that define continuation lines, not including (, {, or [.
let s:opfirst = '^' . get(g:,'javascript_opfirst', let s:opfirst = '^' . get(g:,'javascript_opfirst',
\ '\C\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)') \ '\C\%([<>=,.?^%|/&]\|\([-:+]\)\1\@!\|\*\+\|!=\|in\%(stanceof\)\=\>\)')
let s:continuation = get(g:,'javascript_continuation', let s:continuation = get(g:,'javascript_continuation',
\ '\C\%([-+<>=,.~!?/*^%|&:]\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$' \ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
function s:continues(ln,con) function s:Continues(ln,con)
if !cursor(a:ln, match(' '.a:con,s:continuation)) let tok = matchstr(a:con[-15:],s:continuation)
let teol = s:looking_at() if tok =~ '[a-z:]'
if teol == '/' call cursor(a:ln, len(a:con))
return s:syn_at(line('.'),col('.')) !~? 'regex' return tok == ':' ? s:ExprCol() : s:PreviousToken() != '.'
elseif teol =~ '[-+>]' elseif tok !~ '[/>]'
return getline('.')[col('.')-2] != tr(teol,'>','=') return tok isnot ''
elseif teol =~ '\l'
return s:previous_token() != '.'
elseif teol == ':'
return s:expr_col()
endif
return 1
endif endif
endfunction return s:SynAt(a:ln, len(a:con)) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
" get the line of code stripped of comments and move cursor to the last
" non-comment char.
function s:Trim(ln)
let pline = substitute(getline(a:ln),'\s*$','','')
let l:max = max([strridx(pline,'//'), strridx(pline,'/*')])
while l:max != -1 && s:syn_at(a:ln, strlen(pline)) =~? s:syng_com
let pline = pline[: l:max]
let l:max = max([strridx(pline,'//'), strridx(pline,'/*')])
let pline = substitute(pline[:-2],'\s*$','','')
endwhile
return pline is '' || cursor(a:ln,strlen(pline)) ? pline : pline
endfunction
" Find line above 'lnum' that isn't empty or in a comment
function s:PrevCodeLine(lnum)
let [l:pos, l:n] = [getpos('.')[1:2], prevnonblank(a:lnum)]
while l:n
if getline(l:n) =~ '^\s*\/[/*]'
let l:n = prevnonblank(l:n-1)
elseif stridx(getline(l:n), '*/') + 1 && s:syn_at(l:n,1) =~? s:syng_com
call cursor(l:n,1)
keepjumps norm! [*
let l:n = search('\m\S','nbW')
else
break
endif
endwhile
call call('cursor',l:pos)
return l:n
endfunction endfunction
" Check if line 'lnum' has a balanced amount of parentheses. " Check if line 'lnum' has a balanced amount of parentheses.
function s:Balanced(lnum) function s:Balanced(lnum)
let l:open = 0 let [l:open, l:line] = [0, getline(a:lnum)]
let l:line = getline(a:lnum) let pos = match(l:line, '[][(){}]')
let pos = match(l:line, '[][(){}]', 0)
while pos != -1 while pos != -1
if s:syn_at(a:lnum,pos + 1) !~? s:syng_strcom if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom
let l:open += match(' ' . l:line[pos],'[[({]') let l:open += match(' ' . l:line[pos],'[[({]')
if l:open < 0 if l:open < 0
return return
endif endif
endif endif
let pos = match(l:line, (l:open ? let pos = match(l:line, !l:open ? '[][(){}]' : '()' =~ l:line[pos] ?
\ '['.escape(tr(l:line[pos],'({[]})',')}][{(').l:line[pos],']').']' : \ '[()]' : '{}' =~ l:line[pos] ? '[{}]' : '[][]', pos + 1)
\ '[][(){}]'), pos + 1)
endwhile endwhile
return !l:open return !l:open
endfunction endfunction
function s:OneScope(lnum) function s:OneScope()
let pline = s:Trim(a:lnum) if s:LookingAt() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr)
let kw = 'else do' let tok = s:PreviousToken()
if pline[-1:] == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0 return (count(split('for if let while with'),tok) ||
if s:previous_token() =~# '^\%(await\|each\)$' \ tok =~# '^await$\|^each$' && s:PreviousToken() ==# 'for') &&
call s:previous_token() \ s:Pure('s:PreviousToken') != '.' && !(tok == 'while' && s:DoWhile())
let kw = 'for' elseif s:Token() =~# '^else$\|^do$'
else return s:Pure('s:PreviousToken') != '.'
let kw = 'for if let while with'
endif
endif endif
return pline[-2:] == '=>' || index(split(kw),s:token()) + 1 && return strpart(getline('.'),col('.')-2,2) == '=>'
\ s:save_pos('s:previous_token') != '.'
endfunction endfunction
" returns braceless levels started by 'i' and above lines * shiftwidth(). function s:DoWhile()
" 'num' is the lineNr which encloses the entire context, 'cont' if whether let cpos = searchpos('\m\<','cbW')
" line 'i' + 1 is a continued expression, which could have started in a if s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr)
" braceless context if s:{s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) ?
function s:iscontOne(i,num,cont) \ 'Previous' : ''}Token() ==# 'do' && s:IsBlock()
let [l:i, l:num, bL] = [a:i, a:num + !a:num, 0] return 1
let pind = a:num ? indent(l:num) + s:W : 0 endif
let ind = indent(l:i) + (a:cont ? 0 : s:W) call call('cursor',cpos)
while l:i >= l:num && (ind > pind || l:i == l:num) endif
if indent(l:i) < ind && s:OneScope(l:i) endfunction
let bL += s:W
let l:i = line('.') " returns total offset from braceless contexts. 'num' is the lineNr which
elseif !a:cont || bL || ind < indent(a:i) " encloses the entire context, 'cont' if whether a:firstline is a continued
" expression, which could have started in a braceless context
function s:IsContOne(num,cont)
let [l:num, b_l] = [a:num + !a:num, 0]
let pind = a:num ? indent(a:num) + s:sw() : 0
let ind = indent('.') + !a:cont
while line('.') > l:num && ind > pind || line('.') == l:num
if indent('.') < ind && s:OneScope()
let b_l += 1
elseif !a:cont || b_l || ind < indent(a:firstline)
break
else
call cursor(0,1)
endif
let ind = min([ind, indent('.')])
if s:PreviousToken() is ''
break break
endif endif
let ind = min([ind, indent(l:i)])
let l:i = s:PrevCodeLine(l:i - 1)
endwhile endwhile
return bL return b_l
endfunction
function s:Class()
return (s:Token() ==# 'class' || s:PreviousToken() =~# '^class$\|^extends$') &&
\ s:PreviousToken() != '.'
endfunction
function s:IsSwitch()
return s:PreviousToken() !~ '[.*]' &&
\ (!s:GetPair('{','}','cbW',s:skip_expr) || s:IsBlock() && !s:Class())
endfunction endfunction
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader " https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
function s:IsBlock() function s:IsBlock()
if s:looking_at() == '{' let tok = s:PreviousToken()
let l:n = line('.') if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx'
let char = s:previous_token() return tok != '{'
if match(s:stack,'\cxml\|jsx') + 1 && s:syn_at(line('.'),col('.')-1) =~? 'xml\|jsx' elseif tok =~ '\k'
return char != '{' if tok ==# 'type'
elseif char =~ '\k' return s:Pure('eval',"s:PreviousToken() !~# '^\\%(im\\|ex\\)port$' || s:PreviousToken() == '.'")
if char ==# 'type' elseif tok ==# 'of'
return s:previous_token() !~# '^\%(im\|ex\)port$' return s:Pure('eval',"!s:GetPair('[[({]','[])}]','bW',s:skip_expr) || s:LookingAt() != '(' ||"
endif \ ."s:{s:PreviousToken() ==# 'await' ? 'Previous' : ''}Token() !=# 'for' || s:PreviousToken() == '.'")
return index(split('return const let import export extends yield default delete var await void typeof throw case new of in instanceof')
\ ,char) < (line('.') != l:n) || s:save_pos('s:previous_token') == '.'
elseif char == '>'
return getline('.')[col('.')-2] == '=' || s:syn_at(line('.'),col('.')) =~? '^jsflow'
elseif char == ':'
return !s:save_pos('s:expr_col')
elseif char == '/'
return s:syn_at(line('.'),col('.')) =~? 'regex'
endif endif
return char !~ '[=~!<*,?^%|&([]' && return index(split('return const let import export extends yield default delete var await void typeof throw case new in instanceof')
\ (char !~ '[-+]' || l:n != line('.') && getline('.')[col('.')-2] == char) \ ,tok) < (line('.') != a:firstline) || s:Pure('s:PreviousToken') == '.'
elseif tok == '>'
return getline('.')[col('.')-2] == '=' || s:SynAt(line('.'),col('.')) =~? 'jsflow\|^html'
elseif tok == '*'
return s:Pure('s:PreviousToken') == ':'
elseif tok == ':'
return s:Pure('eval',"s:PreviousToken() =~ '^\\K\\k*$' && !s:ExprCol()")
elseif tok == '/'
return s:SynAt(line('.'),col('.')) =~? 'regex'
elseif tok !~ '[=~!<,.?^%|&([]'
return tok !~ '[-+]' || line('.') != a:firstline && getline('.')[col('.')-2] == tok
endif endif
endfunction endfunction
function GetJavascriptIndent() function GetJavascriptIndent()
let b:js_cache = get(b:,'js_cache',[0,0,0]) let b:js_cache = get(b:,'js_cache',[0,0,0])
" Get the current line. let s:synid_cache = [[],[]]
call cursor(v:lnum,1) let l:line = getline(v:lnum)
let l:line = getline('.')
" use synstack as it validates syn state and works in an empty line " use synstack as it validates syn state and works in an empty line
let s:stack = map(synstack(v:lnum,1),"synIDattr(v:val,'name')") let s:stack = [''] + map(synstack(v:lnum,1),"synIDattr(v:val,'name')")
let syns = get(s:stack,-1,'')
" start with strings,comments,etc. " start with strings,comments,etc.
if syns =~? s:syng_com if s:stack[-1] =~? 'comment\|doc'
if l:line =~ '^\s*\*' if l:line =~ '^\s*\*'
return cindent(v:lnum) return cindent(v:lnum)
elseif l:line !~ '^\s*\/[/*]' elseif l:line !~ '^\s*\/[/*]'
return -1 return -1
endif endif
elseif syns =~? s:syng_str elseif s:stack[-1] =~? b:syng_str
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1) if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1)
let b:js_cache[0] = v:lnum let b:js_cache[0] = v:lnum
endif endif
return -1 return -1
endif endif
let l:lnum = s:PrevCodeLine(v:lnum - 1)
if !l:lnum let s:l1 = max([0,prevnonblank(v:lnum) - (s:rel ? 2000 : 1000),
\ get(get(b:,'hi_indent',{}),'blocklnr')])
call cursor(v:lnum,1)
if s:PreviousToken() is ''
return return
endif endif
let [l:lnum, pline] = [line('.'), getline('.')[:col('.')-1]]
let l:line = substitute(l:line,'^\s*','','') let l:line = substitute(l:line,'^\s*','','')
let l:line_raw = l:line
if l:line[:1] == '/*' if l:line[:1] == '/*'
let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','') let l:line = substitute(l:line,'^\%(\/\*.\{-}\*\/\s*\)*','','')
endif endif
@@ -318,60 +358,91 @@ function GetJavascriptIndent()
endif endif
" the containing paren, bracket, or curly. Many hacks for performance " the containing paren, bracket, or curly. Many hacks for performance
call cursor(v:lnum,1)
let idx = index([']',')','}'],l:line[0]) let idx = index([']',')','}'],l:line[0])
if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum && if b:js_cache[0] > l:lnum && b:js_cache[0] < v:lnum ||
\ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum)) \ b:js_cache[0] == l:lnum && s:Balanced(l:lnum)
call call('cursor',b:js_cache[1:]) call call('cursor',b:js_cache[1:])
else else
let [s:looksyn, s:checkIn, top] = [v:lnum - 1, 0, (!indent(l:lnum) && let [s:looksyn, s:top_col, s:check_in, s:l1] = [v:lnum - 1,0,0,
\ s:syn_at(l:lnum,1) !~? s:syng_str) * l:lnum] \ max([s:l1, &smc ? search('\m^.\{'.&smc.',}','nbW',s:l1 + 1) + 1 : 0])]
if idx + 1 try
call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:skip_func()',2000,top) if idx != -1
elseif getline(v:lnum) !~ '^\S' && syns =~? 'block' call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:SkipFunc()')
call s:GetPair('{','}','bW','s:skip_func()',2000,top) elseif getline(v:lnum) !~ '^\S' && s:stack[-1] =~? 'block\|^jsobject$'
else call s:GetPair('{','}','bW','s:SkipFunc()')
call s:alternatePair(top) else
endif call s:AlternatePair()
endif
catch /^\Cout of bounds$/
call cursor(v:lnum,1)
endtry
let b:js_cache[1:] = line('.') == v:lnum ? [0,0] : getpos('.')[1:2]
endif endif
let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [0,0] : getpos('.')[1:2]) let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]]
let num = b:js_cache[1]
let [s:W, isOp, bL, switch_offset] = [s:sw(),0,0,0] let [num_ind, is_op, b_l, l:switch_offset] = [s:Nat(indent(num)),0,0,0]
if !num || s:IsBlock() if !num || s:LookingAt() == '{' && s:IsBlock()
let ilnum = line('.') let ilnum = line('.')
let pline = s:save_pos('s:Trim',l:lnum) if num && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
if num && s:looking_at() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0 if ilnum == num
let num = ilnum == num ? line('.') : num let [num, num_ind] = [line('.'), indent('.')]
if idx < 0 && s:previous_token() ==# 'switch' && s:previous_token() != '.' endif
if &cino !~ ':' if idx == -1 && s:PreviousToken() ==# 'switch' && s:IsSwitch()
let switch_offset = s:W let l:switch_offset = &cino !~ ':' ? s:sw() : s:ParseCino(':')
else
let switch_offset = max([-indent(num),s:parse_cino(':')])
endif
if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>' if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>'
return indent(num) + switch_offset return s:Nat(num_ind + l:switch_offset)
elseif &cino =~ '='
let l:case_offset = s:ParseCino('=')
endif endif
endif endif
endif endif
if idx < 0 && pline[-1:] !~ '[{;]' if idx == -1 && pline[-1:] !~ '[{;]'
let isOp = (l:line =~# s:opfirst || s:continues(l:lnum,pline)) * s:W let sol = matchstr(l:line,s:opfirst)
let bL = s:iscontOne(l:lnum,b:js_cache[1],isOp) if sol is '' || sol == '/' && s:SynAt(v:lnum,
let bL -= (bL && l:line[0] == '{') * s:W \ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex'
if s:Continues(l:lnum,pline)
let is_op = s:sw()
endif
elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$'
call call('cursor',b:js_cache[1:])
if s:PreviousToken() =~ '\k' && s:Class()
return num_ind + s:sw()
endif
let is_op = s:sw()
else
let is_op = s:sw()
endif
call cursor(l:lnum, len(pline))
let b_l = s:Nat(s:IsContOne(b:js_cache[1],is_op) - (!is_op && l:line =~ '^{')) * s:sw()
endif endif
elseif idx < 0 && getline(b:js_cache[1])[b:js_cache[2]-1] == '(' && &cino =~ '(' elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U'))
let pval = s:parse_cino('(') let pval = s:ParseCino('(')
return !pval ? (s:parse_cino('w') ? 0 : -(!!search('\m\S','W'.s:z,num))) + virtcol('.') : if !pval
\ max([indent('.') + pval + (s:GetPair('(',')','nbrmW',s:skip_expr,100,num) * s:W),0]) let [Wval, vcol] = [s:ParseCino('W'), virtcol('.')]
if search('\m\S','W',num)
return s:ParseCino('w') ? vcol : virtcol('.')-1
endif
return Wval ? s:Nat(num_ind + Wval) : vcol
endif
return s:Nat(num_ind + pval + searchpair('\m(','','\m)','nbrmW',s:skip_expr,num) * s:sw())
endif endif
" main return " main return
if l:line =~ '^\%([])}]\||}\)' if l:line =~ '^[])}]\|^|}'
return max([indent(num),0]) if l:line_raw[0] == ')' && getline(num)[b:js_cache[2]-1] == '('
if s:ParseCino('M')
return indent(l:lnum)
elseif &cino =~# 'm' && !s:ParseCino('m')
return virtcol('.') - 1
endif
endif
return num_ind
elseif num elseif num
return indent(num) + s:W + switch_offset + bL + isOp return s:Nat(num_ind + get(l:,'case_offset',s:sw()) + l:switch_offset + b_l + is_op)
endif endif
return bL + isOp return b_l + is_op
endfunction endfunction
let &cpo = s:cpo_save let &cpo = s:cpo_save

View File

@@ -3,7 +3,7 @@
" Maintainer: vim-perl <vim-perl@googlegroups.com> " Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: http://github.com/vim-perl/vim-perl " Homepage: http://github.com/vim-perl/vim-perl
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues " Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: 2017 Jun 13 " Last Change: 2017-01-04
" Suggestions and improvements by : " Suggestions and improvements by :
" Aaron J. Sherman (use syntax for hints) " Aaron J. Sherman (use syntax for hints)
@@ -48,11 +48,6 @@ function! GetPerlIndent()
return 0 return 0
endif endif
" Don't reindent comments on first column
if cline =~ '^#.'
return 0
endif
" Get current syntax item at the line's first char " Get current syntax item at the line's first char
let csynid = '' let csynid = ''
if b:indent_use_syntax if b:indent_use_syntax
@@ -134,6 +129,7 @@ function! GetPerlIndent()
\ || synid == "perlMatchStartEnd" \ || synid == "perlMatchStartEnd"
\ || synid == "perlHereDoc" \ || synid == "perlHereDoc"
\ || synid == "perlBraces" \ || synid == "perlBraces"
\ || synid == "perlStatementIndirObj"
\ || synid =~ "^perlFiledescStatement" \ || synid =~ "^perlFiledescStatement"
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold' \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
let brace = strpart(line, bracepos, 1) let brace = strpart(line, bracepos, 1)
@@ -151,6 +147,7 @@ function! GetPerlIndent()
if synid == "" if synid == ""
\ || synid == "perlMatchStartEnd" \ || synid == "perlMatchStartEnd"
\ || synid == "perlBraces" \ || synid == "perlBraces"
\ || synid == "perlStatementIndirObj"
\ || synid =~ '^perl\(Sub\|Block\|Package\)Fold' \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
let ind = ind - shiftwidth() let ind = ind - shiftwidth()
endif endif

View File

@@ -1,7 +1,7 @@
" These commands create the option window. " These commands create the option window.
" "
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2017 Aug 01 " Last Change: 2017 Sep 10
" If there already is an option window, jump to that one. " If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0 if bufwinnr("option-window") > 0
@@ -1164,6 +1164,8 @@ endif
call append("$", "iminsert\tin Insert mode: 1: use :lmap; 2: use IM; 0: neither") call append("$", "iminsert\tin Insert mode: 1: use :lmap; 2: use IM; 0: neither")
call append("$", "\t(local to window)") call append("$", "\t(local to window)")
call <SID>OptionL("imi") call <SID>OptionL("imi")
call append("$", "imstyle\tinput method style, 0: on-the-spot, 1: over-the-spot")
call <SID>OptionG("imst", &imst)
call append("$", "imsearch\tentering a search pattern: 1: use :lmap; 2: use IM; 0: neither") call append("$", "imsearch\tentering a search pattern: 1: use :lmap; 2: use IM; 0: neither")
call append("$", "\t(local to window)") call append("$", "\t(local to window)")
call <SID>OptionL("ims") call <SID>OptionL("ims")

View File

@@ -10,6 +10,11 @@
" Author: Bram Moolenaar " Author: Bram Moolenaar
" Copyright: Vim license applies " Copyright: Vim license applies
" In case this gets loaded twice.
if exists(':Termdebug')
finish
endif
command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>) command -nargs=* -complete=file Termdebug call s:StartDebug(<q-args>)
if !exists('debugger') if !exists('debugger')

View File

@@ -1,5 +1,5 @@
" matchit.vim: (global plugin) Extended "%" matching " matchit.vim: (global plugin) Extended "%" matching
" Last Change: 2017 March 26 " Last Change: 2017 Sep 15
" Maintainer: Benji Fisher PhD <benji@member.AMS.org> " Maintainer: Benji Fisher PhD <benji@member.AMS.org>
" Version: 1.13.3, for Vim 6.3+ " Version: 1.13.3, for Vim 6.3+
" Fix from Tommy Allen included. " Fix from Tommy Allen included.

View File

@@ -136,7 +136,7 @@ syntax match clojureRegexpBoundary "[$^]" contained display
syntax match clojureRegexpQuantifier "[?*+][?+]\=" contained display syntax match clojureRegexpQuantifier "[?*+][?+]\=" contained display
syntax match clojureRegexpQuantifier "\v\{\d+%(,|,\d+)?}\??" contained display syntax match clojureRegexpQuantifier "\v\{\d+%(,|,\d+)?}\??" contained display
syntax match clojureRegexpOr "|" contained display syntax match clojureRegexpOr "|" contained display
syntax match clojureRegexpBackRef "\v\\%([1-9]\d*|k\<[a-zA-z]+\>)" contained display syntax match clojureRegexpBackRef "\v\\%([1-9]\d*|k\<[a-zA-Z]+\>)" contained display
" Mode modifiers, mode-modified spans, lookaround, regular and atomic " Mode modifiers, mode-modified spans, lookaround, regular and atomic
" grouping, and named-capturing. " grouping, and named-capturing.

File diff suppressed because one or more lines are too long

View File

@@ -85,7 +85,7 @@ syn match formComment "\;\ *\*.*$" contains=formTodo
syn region formString start=+"+ end=+"+ contains=formSpecial syn region formString start=+"+ end=+"+ contains=formSpecial
syn region formString start=+'+ end=+'+ syn region formString start=+'+ end=+'+
syn region formNestedString start=+`+ end=+'+ contains=formNestedString syn region formNestedString start=+`+ end=+'+ contains=formNestedString
syn match formPreProc "^\=\#[a-zA-z][a-zA-Z0-9]*\>" syn match formPreProc "^\=\#[a-zA-Z][a-zA-Z0-9]*\>"
syn match formNumber "\<\d\+\>" syn match formNumber "\<\d\+\>"
syn match formNumber "\<\d\+\.\d*\>" syn match formNumber "\<\d\+\.\d*\>"
syn match formNumber "\.\d\+\>" syn match formNumber "\.\d\+\>"
@@ -94,13 +94,13 @@ syn match formNumber "-\.\d" contains=Number
syn match formNumber "i_\+\>" syn match formNumber "i_\+\>"
syn match formNumber "fac_\+\>" syn match formNumber "fac_\+\>"
" pattern matching wildcards " pattern matching wildcards
syn match formNumber "?[A-z0-9]*" syn match formNumber "?[a-zA-Z0-9]*"
" dollar-variables (new in 3.x) " dollar-variables (new in 3.x)
syn match formNumber "\\$[A-z0-9]*" syn match formNumber "\\$[a-zA-Z0-9]*"
" scalar products " scalar products
syn match formNumber "^\=[a-zA-z][a-zA-Z0-9]*\.[a-zA-z][a-zA-Z0-9]*\>" syn match formNumber "^\=[a-zA-Z][a-zA-Z0-9]*\.[a-zA-Z][a-zA-Z0-9]*\>"
syn match formDirective "^\=\.[a-zA-z][a-zA-Z0-9]*\>" syn match formDirective "^\=\.[a-zA-Z][a-zA-Z0-9]*\>"
" hi User Labels " hi User Labels
syn sync ccomment formComment minlines=10 syn sync ccomment formComment minlines=10

View File

@@ -1,15 +1,13 @@
" Vim syntax file " Vim syntax file
" Language: Mason (Perl embedded in HTML) " Language: Mason (Perl embedded in HTML)
" Maintainer: Andrew Smith <andrewdsmith@yahoo.com> " Maintainer: vim-perl <vim-perl@googlegroups.com>
" Last change: 2003 May 11 " Homepage: http://github.com/vim-perl/vim-perl/tree/master
" URL: http://www.masonhq.com/editors/mason.vim " Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: 2017-09-12
" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
" Andrew Smith <andrewdsmith@yahoo.com>
" "
" This seems to work satisfactorily with html.vim and perl.vim for version 5.5. " TODO:
" Please mail any fixes or improvements to the above address. Things that need
" doing include:
"
" - Add match for component names in <& &> blocks.
" - Add match for component names in <%def> and <%method> block delimiters.
" - Fix <%text> blocks to show HTML tags but ignore Mason tags. " - Fix <%text> blocks to show HTML tags but ignore Mason tags.
" "
@@ -34,30 +32,38 @@ syn cluster htmlPreproc add=@masonTop
" Now pull in the Perl syntax. " Now pull in the Perl syntax.
" "
syn include @perlTop syntax/perl.vim syn include @perlTop syntax/perl.vim
unlet b:current_syntax
syn include @podTop syntax/pod.vim
" It's hard to reduce down to the correct sub-set of Perl to highlight in some " It's hard to reduce down to the correct sub-set of Perl to highlight in some
" of these cases so I've taken the safe option of just using perlTop in all of " of these cases so I've taken the safe option of just using perlTop in all of
" them. If you have any suggestions, please let me know. " them. If you have any suggestions, please let me know.
" "
syn region masonLine matchgroup=Delimiter start="^%" end="$" contains=@perlTop syn region masonPod start="^=[a-z]" end="^=cut" keepend contained contains=@podTop
syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop syn cluster perlTop remove=perlBraces
syn region masonPerl matchgroup=Delimiter start="<%perl>" end="</%perl>" contains=@perlTop syn region masonLine matchgroup=Delimiter start="^%" end="$" keepend contains=@perlTop
syn region masonComp keepend matchgroup=Delimiter start="<&" end="&>" contains=@perlTop syn region masonPerlComment start="#" end="\%(%>\)\@=\|$" contained contains=perlTodo,@Spell
syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop,masonPerlComment
syn region masonPerl matchgroup=Delimiter start="<%perl>" end="</%perl>" contains=masonPod,@perlTop
syn region masonComp keepend matchgroup=Delimiter start="<&\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop
syn region masonComp keepend matchgroup=Delimiter skipnl start="<&|\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop nextgroup=masonCompContent
syn region masonCompContent matchgroup=Delimiter start="" end="</&>" contained contains=@masonTop
syn region masonArgs matchgroup=Delimiter start="<%args>" end="</%args>" contains=@perlTop syn region masonArgs matchgroup=Delimiter start="<%args>" end="</%args>" contains=masonPod,@perlTop
syn region masonInit matchgroup=Delimiter start="<%init>" end="</%init>" contains=@perlTop syn region masonInit matchgroup=Delimiter start="<%init>" end="</%init>" contains=masonPod,@perlTop
syn region masonCleanup matchgroup=Delimiter start="<%cleanup>" end="</%cleanup>" contains=@perlTop syn region masonCleanup matchgroup=Delimiter start="<%cleanup>" end="</%cleanup>" contains=masonPod,@perlTop
syn region masonOnce matchgroup=Delimiter start="<%once>" end="</%once>" contains=@perlTop syn region masonOnce matchgroup=Delimiter start="<%once>" end="</%once>" contains=masonPod,@perlTop
syn region masonShared matchgroup=Delimiter start="<%shared>" end="</%shared>" contains=@perlTop syn region masonClass matchgroup=Delimiter start="<%class>" end="</%class>" contains=masonPod,@perlTop
syn region masonShared matchgroup=Delimiter start="<%shared>" end="</%shared>" contains=masonPod,@perlTop
syn region masonDef matchgroup=Delimiter start="<%def[^>]*>" end="</%def>" contains=@htmlTop syn region masonDef matchgroup=Delimiter start="<%def\s*[-._/[:alnum:]]\+\s*>" end="</%def>" contains=@htmlTop
syn region masonMethod matchgroup=Delimiter start="<%method[^>]*>" end="</%method>" contains=@htmlTop syn region masonMethod matchgroup=Delimiter start="<%method\s*[-._/[:alnum:]]\+\s*>" end="</%method>" contains=@htmlTop
syn region masonFlags matchgroup=Delimiter start="<%flags>" end="</%flags>" contains=@perlTop syn region masonFlags matchgroup=Delimiter start="<%flags>" end="</%flags>" contains=masonPod,@perlTop
syn region masonAttr matchgroup=Delimiter start="<%attr>" end="</%attr>" contains=@perlTop syn region masonAttr matchgroup=Delimiter start="<%attr>" end="</%attr>" contains=masonPod,@perlTop
syn region masonFilter matchgroup=Delimiter start="<%filter>" end="</%filter>" contains=@perlTop syn region masonFilter matchgroup=Delimiter start="<%filter>" end="</%filter>" contains=masonPod,@perlTop
syn region masonDoc matchgroup=Delimiter start="<%doc>" end="</%doc>" syn region masonDoc matchgroup=Delimiter start="<%doc>" end="</%doc>"
syn region masonText matchgroup=Delimiter start="<%text>" end="</%text>" syn region masonText matchgroup=Delimiter start="<%text>" end="</%text>"
@@ -67,6 +73,8 @@ syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs,
" Set up default highlighting. Almost all of this is done in the included " Set up default highlighting. Almost all of this is done in the included
" syntax files. " syntax files.
hi def link masonDoc Comment hi def link masonDoc Comment
hi def link masonPod Comment
hi def link masonPerlComment perlComment
let b:current_syntax = "mason" let b:current_syntax = "mason"

View File

@@ -3,7 +3,7 @@
" Maintainer: vim-perl <vim-perl@googlegroups.com> " Maintainer: vim-perl <vim-perl@googlegroups.com>
" Homepage: http://github.com/vim-perl/vim-perl/tree/master " Homepage: http://github.com/vim-perl/vim-perl/tree/master
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues " Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: 2013-07-23 " Last Change: 2017-09-12
" Contributors: Andy Lester <andy@petdance.com> " Contributors: Andy Lester <andy@petdance.com>
" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> " Hinrik Örn Sigurðsson <hinrik.sig@gmail.com>
" Lukas Mai <l.mai.web.de> " Lukas Mai <l.mai.web.de>
@@ -28,8 +28,9 @@
" unlet perl_fold " unlet perl_fold
" unlet perl_fold_blocks " unlet perl_fold_blocks
" unlet perl_nofold_packages " unlet perl_nofold_packages
" let perl_nofold_subs = 1 " unlet perl_nofold_subs
" unlet perl_fold_anonymous_subs " unlet perl_fold_anonymous_subs
" unlet perl_no_subprototype_error
if exists("b:current_syntax") if exists("b:current_syntax")
finish finish
@@ -38,11 +39,6 @@ endif
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo&vim set cpo&vim
if exists('&regexpengine')
let s:regexpengine=&regexpengine
set regexpengine=1
endif
" POD starts with ^=<word> and ends with ^=cut " POD starts with ^=<word> and ends with ^=cut
if !exists("perl_include_pod") || perl_include_pod == 1 if !exists("perl_include_pod") || perl_include_pod == 1
@@ -83,7 +79,7 @@ syn match perlControl "\<\%(BEGIN\|CHECK\|INIT\|END\|UNITCHECK\)\>\_s*" nextgr
syn match perlStatementStorage "\<\%(my\|our\|local\|state\)\>" syn match perlStatementStorage "\<\%(my\|our\|local\|state\)\>"
syn match perlStatementControl "\<\%(return\|last\|next\|redo\|goto\|break\)\>" syn match perlStatementControl "\<\%(return\|last\|next\|redo\|goto\|break\)\>"
syn match perlStatementScalar "\<\%(chom\=p\|chr\|crypt\|r\=index\|lc\%(first\)\=\|length\|ord\|pack\|sprintf\|substr\|uc\%(first\)\=\)\>" syn match perlStatementScalar "\<\%(chom\=p\|chr\|crypt\|r\=index\|lc\%(first\)\=\|length\|ord\|pack\|sprintf\|substr\|fc\|uc\%(first\)\=\)\>"
syn match perlStatementRegexp "\<\%(pos\|quotemeta\|split\|study\)\>" syn match perlStatementRegexp "\<\%(pos\|quotemeta\|split\|study\)\>"
syn match perlStatementNumeric "\<\%(abs\|atan2\|cos\|exp\|hex\|int\|log\|oct\|rand\|sin\|sqrt\|srand\)\>" syn match perlStatementNumeric "\<\%(abs\|atan2\|cos\|exp\|hex\|int\|log\|oct\|rand\|sin\|sqrt\|srand\)\>"
syn match perlStatementList "\<\%(splice\|unshift\|shift\|push\|pop\|join\|reverse\|grep\|map\|sort\|unpack\)\>" syn match perlStatementList "\<\%(splice\|unshift\|shift\|push\|pop\|join\|reverse\|grep\|map\|sort\|unpack\)\>"
@@ -94,9 +90,9 @@ syn match perlStatementFiledesc "\<\%(fcntl\|flock\|ioctl\|open\%(dir\)\=\|read
syn match perlStatementVector "\<vec\>" syn match perlStatementVector "\<vec\>"
syn match perlStatementFiles "\<\%(ch\%(dir\|mod\|own\|root\)\|glob\|link\|mkdir\|readlink\|rename\|rmdir\|symlink\|umask\|unlink\|utime\)\>" syn match perlStatementFiles "\<\%(ch\%(dir\|mod\|own\|root\)\|glob\|link\|mkdir\|readlink\|rename\|rmdir\|symlink\|umask\|unlink\|utime\)\>"
syn match perlStatementFiles "-[rwxoRWXOezsfdlpSbctugkTBMAC]\>" syn match perlStatementFiles "-[rwxoRWXOezsfdlpSbctugkTBMAC]\>"
syn match perlStatementFlow "\<\%(caller\|die\|dump\|eval\|exit\|wantarray\)\>" syn match perlStatementFlow "\<\%(caller\|die\|dump\|eval\|exit\|wantarray\|evalbytes\)\>"
syn match perlStatementInclude "\<\%(require\|import\)\>" syn match perlStatementInclude "\<\%(require\|import\|unimport\)\>"
syn match perlStatementInclude "\<\%(use\|no\)\s\+\%(\%(attributes\|attrs\|autouse\|parent\|base\|big\%(int\|num\|rat\)\|blib\|bytes\|charnames\|constant\|diagnostics\|encoding\%(::warnings\)\=\|feature\|fields\|filetest\|if\|integer\|less\|lib\|locale\|mro\|open\|ops\|overload\|re\|sigtrap\|sort\|strict\|subs\|threads\%(::shared\)\=\|utf8\|vars\|version\|vmsish\|warnings\%(::register\)\=\)\>\)\=" syn match perlStatementInclude "\<\%(use\|no\)\s\+\%(\%(attributes\|attrs\|autodie\|autouse\|parent\|base\|big\%(int\|num\|rat\)\|blib\|bytes\|charnames\|constant\|diagnostics\|encoding\%(::warnings\)\=\|feature\|fields\|filetest\|if\|integer\|less\|lib\|locale\|mro\|open\|ops\|overload\|overloading\|re\|sigtrap\|sort\|strict\|subs\|threads\%(::shared\)\=\|utf8\|vars\|version\|vmsish\|warnings\%(::register\)\=\)\>\)\="
syn match perlStatementProc "\<\%(alarm\|exec\|fork\|get\%(pgrp\|ppid\|priority\)\|kill\|pipe\|set\%(pgrp\|priority\)\|sleep\|system\|times\|wait\%(pid\)\=\)\>" syn match perlStatementProc "\<\%(alarm\|exec\|fork\|get\%(pgrp\|ppid\|priority\)\|kill\|pipe\|set\%(pgrp\|priority\)\|sleep\|system\|times\|wait\%(pid\)\=\)\>"
syn match perlStatementSocket "\<\%(accept\|bind\|connect\|get\%(peername\|sock\%(name\|opt\)\)\|listen\|recv\|send\|setsockopt\|shutdown\|socket\%(pair\)\=\)\>" syn match perlStatementSocket "\<\%(accept\|bind\|connect\|get\%(peername\|sock\%(name\|opt\)\)\|listen\|recv\|send\|setsockopt\|shutdown\|socket\%(pair\)\=\)\>"
syn match perlStatementIPC "\<\%(msg\%(ctl\|get\|rcv\|snd\)\|sem\%(ctl\|get\|op\)\|shm\%(ctl\|get\|read\|write\)\)\>" syn match perlStatementIPC "\<\%(msg\%(ctl\|get\|rcv\|snd\)\|sem\%(ctl\|get\|op\)\|shm\%(ctl\|get\|read\|write\)\)\>"
@@ -108,7 +104,7 @@ syn match perlStatementMisc "\<\%(warn\|format\|formline\|reset\|scalar\|protot
syn keyword perlTodo TODO TODO: TBD TBD: FIXME FIXME: XXX XXX: NOTE NOTE: contained syn keyword perlTodo TODO TODO: TBD TBD: FIXME FIXME: XXX XXX: NOTE NOTE: contained
syn region perlStatementIndirObjWrap matchgroup=perlStatementIndirObj start="\<\%(map\|grep\|sort\|printf\=\|say\|system\|exec\)\>\s*{" end="}" contains=@perlTop,perlBraces extend syn region perlStatementIndirObjWrap matchgroup=perlStatementIndirObj start="\%(\<\%(map\|grep\|sort\|printf\=\|say\|system\|exec\)\>\s*\)\@<={" end="}" transparent extend
syn match perlLabel "^\s*\h\w*\s*::\@!\%(\<v\d\+\s*:\)\@<!" syn match perlLabel "^\s*\h\w*\s*::\@!\%(\<v\d\+\s*:\)\@<!"
@@ -125,7 +121,7 @@ syn match perlLabel "^\s*\h\w*\s*::\@!\%(\<v\d\+\s*:\)\@<!"
" Special variables first ($^A, ...) and ($|, $', ...) " Special variables first ($^A, ...) and ($|, $', ...)
syn match perlVarPlain "$^[ACDEFHILMNOPRSTVWX]\=" syn match perlVarPlain "$^[ACDEFHILMNOPRSTVWX]\="
syn match perlVarPlain "$[\\\"\[\]'&`+*.,;=%~!?@#$<>(-]" syn match perlVarPlain "$[\\\"\[\]'&`+*.,;=%~!?@#$<>(-]"
syn match perlVarPlain "%+" syn match perlVarPlain "@[-+]"
syn match perlVarPlain "$\%(0\|[1-9]\d*\)" syn match perlVarPlain "$\%(0\|[1-9]\d*\)"
" Same as above, but avoids confusion in $::foo (equivalent to $main::foo) " Same as above, but avoids confusion in $::foo (equivalent to $main::foo)
syn match perlVarPlain "$::\@!" syn match perlVarPlain "$::\@!"
@@ -143,41 +139,46 @@ syn match perlPackageRef "[$@#%*&]\%(\%(::\|'\)\=\I\i*\%(\%(::\|'\)\I\i*\)*\)\
" just set the variable "perl_no_extended_vars"... " just set the variable "perl_no_extended_vars"...
if !exists("perl_no_scope_in_variables") if !exists("perl_no_scope_in_variables")
syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
else else
syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref
endif endif
syn match perlVarPlain2 "%[-+]"
if !exists("perl_no_extended_vars") if !exists("perl_no_extended_vars")
syn cluster perlExpr contains=perlStatementIndirObjWrap,perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlVarBlock2,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQQ,perlArrow,perlBraces syn cluster perlExpr contains=perlStatementIndirObjWrap,perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlVarBlock2,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQQ,perlArrow,perlBraces
syn region perlArrow matchgroup=perlArrow start="->\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained syn region perlArrow matchgroup=perlArrow start="->\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
syn region perlArrow matchgroup=perlArrow start="->\s*\[" end="\]" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained syn region perlArrow matchgroup=perlArrow start="->\s*\[" end="\]" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
syn region perlArrow matchgroup=perlArrow start="->\s*{" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained syn region perlArrow matchgroup=perlArrow start="->\s*{" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
syn match perlArrow "->\s*{\s*\I\i*\s*}" contains=perlVarSimpleMemberName nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained syn match perlArrow "->\s*{\s*\I\i*\s*}" contains=perlVarSimpleMemberName nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
syn region perlArrow matchgroup=perlArrow start="->\s*\$*\I\i*\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained syn region perlArrow matchgroup=perlArrow start="->\s*\$*\I\i*\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contained
syn region perlVarBlock matchgroup=perlVarPlain start="\%($#\|[$@]\)\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend syn region perlVarBlock matchgroup=perlVarPlain start="\%($#\|[$@]\)\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
syn region perlVarBlock2 matchgroup=perlVarPlain start="[%&*]\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend syn region perlVarBlock2 matchgroup=perlVarPlain start="[%&*]\$*{" skip="\\}" end=+}\|\%(\%(<<\%('\|"\)\?\)\@=\)+ contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
syn match perlVarPlain2 "[%&*]\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend syn match perlVarPlain2 "[%&*]\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
syn match perlVarPlain "\%(\$#\|[@$]\)\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend syn match perlVarPlain "\%(\$#\|[@$]\)\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\={" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\={" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
syn match perlVarSimpleMember "\%(->\)\={\s*\I\i*\s*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contains=perlVarSimpleMemberName contained extend syn match perlVarSimpleMember "\%(->\)\={\s*\I\i*\s*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref contains=perlVarSimpleMemberName contained extend
syn match perlVarSimpleMemberName "\I\i*" contained syn match perlVarSimpleMemberName "\I\i*" contained
syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\=\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod extend syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\=\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend
syn match perlPackageConst "__PACKAGE__" nextgroup=perlMethod syn match perlPackageConst "__PACKAGE__" nextgroup=perlMethod,perlPostDeref
syn match perlMethod "->\$*\I\i*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod syn match perlMethod "->\$*\I\i*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref
syn match perlPostDeref "->\%($#\|[$@%&*]\)\*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref
syn region perlPostDeref start="->\%($#\|[$@%&*]\)\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref
syn region perlPostDeref matchgroup=perlPostDeref start="->\%($#\|[$@%&*]\){" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref
endif endif
" File Descriptors " File Descriptors
syn match perlFiledescRead "<\h\w*>" syn match perlFiledescRead "<\h\w*>"
syn match perlFiledescStatementComma "(\=\s*\u\w*\s*,"me=e-1 transparent contained contains=perlFiledescStatement syn match perlFiledescStatementComma "(\=\s*\<\u\w*\>\s*,"me=e-1 transparent contained contains=perlFiledescStatement
syn match perlFiledescStatementNocomma "(\=\s*\u\w*\s*[^, \t]"me=e-1 transparent contained contains=perlFiledescStatement syn match perlFiledescStatementNocomma "(\=\s*\<\u\w*\>\s*[^, \t]"me=e-1 transparent contained contains=perlFiledescStatement
syn match perlFiledescStatement "\u\w*" contained syn match perlFiledescStatement "\<\u\w*\>" contained
" Special characters in strings and matches " Special characters in strings and matches
syn match perlSpecialString "\\\%(\o\{1,3}\|x\%({\x\+}\|\x\{1,2}\)\|c.\|[^cx]\)" contained extend syn match perlSpecialString "\\\%(\o\{1,3}\|x\%({\x\+}\|\x\{1,2}\)\|c.\|[^cx]\)" contained extend
@@ -241,20 +242,18 @@ syn region perlAnglesDQ start=+<+ end=+>+ extend contained contains=perlAnglesD
" Simple version of searches and matches " Simple version of searches and matches
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1[msixpodualgc]*+ contains=@perlInterpMatch keepend extend syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1[msixpodualgcn]*+ contains=@perlInterpMatch keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+ end=+#[msixpodualgc]*+ contains=@perlInterpMatch keepend extend syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+ end=+#[msixpodualgcn]*+ contains=@perlInterpMatch keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'[msixpodualgc]*+ contains=@perlInterpSQ keepend extend syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'[msixpodualgcn]*+ contains=@perlInterpSQ keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/[msixpodualgc]*+ contains=@perlInterpSlash keepend extend syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/[msixpodualgcn]*+ contains=@perlInterpSlash keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)[msixpodualgc]*+ contains=@perlInterpMatch,perlParensDQ keepend extend syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)[msixpodualgcn]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgcn]*+ contains=@perlInterpMatch,perlBracesDQ extend
" A special case for m{}, m<> and m[] which allows for comments and extra whitespace in the pattern syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>[msixpodualgcn]*+ contains=@perlInterpMatch,perlAnglesDQ keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgc]*+ contains=@perlInterpMatch,perlComment,perlBracesDQ extend syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgcn]*+ contains=@perlInterpMatch,perlBracketsDQ keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>[msixpodualgc]*+ contains=@perlInterpMatch,perlAnglesDQ keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgc]*+ contains=@perlInterpMatch,perlComment,perlBracketsDQ keepend extend
" Below some hacks to recognise the // variant. This is virtually impossible to catch in all " Below some hacks to recognise the // variant. This is virtually impossible to catch in all
" cases as the / is used in so many other ways, but these should be the most obvious ones. " cases as the / is used in so many other ways, but these should be the most obvious ones.
syn region perlMatch matchgroup=perlMatchStartEnd start="\%([$@%&*]\@<!\%(\<split\|\<while\|\<if\|\<unless\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=/\%(/=\)\@!" start=+^/\%(/=\)\@!+ start=+\s\@<=/\%(/=\)\@![^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!+ skip=+\\/+ end=+/[msixpodualgc]*+ contains=@perlInterpSlash extend syn region perlMatch matchgroup=perlMatchStartEnd start="\%([$@%&*]\@<!\%(\<split\|\<while\|\<if\|\<unless\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=/\%(/=\)\@!" start=+^/\%(/=\)\@!+ start=+\s\@<=/\%(/=\)\@![^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!+ skip=+\\/+ end=+/[msixpodualgcn]*+ contains=@perlInterpSlash extend
" Substitutions " Substitutions
@@ -267,12 +266,12 @@ syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*<+ end=+>+ contains=@perlInterpMatch,perlAnglesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*<+ end=+>+ contains=@perlInterpMatch,perlAnglesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*\[+ end=+\]+ contains=@perlInterpMatch,perlBracketsDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*\[+ end=+\]+ contains=@perlInterpMatch,perlBracketsDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*{+ end=+}+ contains=@perlInterpMatch,perlBracesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*{+ end=+}+ contains=@perlInterpMatch,perlBracesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend extend
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]'([{<]\)+ end=+\z1[msixpodualgcer]*+ keepend contained contains=@perlInterpDQ extend syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]'([{<]\)+ end=+\z1[msixpodualgcern]*+ keepend contained contains=@perlInterpDQ extend
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+(+ end=+)[msixpodualgcer]*+ contained contains=@perlInterpDQ,perlParensDQ keepend extend syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+(+ end=+)[msixpodualgcern]*+ contained contains=@perlInterpDQ,perlParensDQ keepend extend
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][msixpodualgcer]*+ contained contains=@perlInterpDQ,perlBracketsDQ keepend extend syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][msixpodualgcern]*+ contained contains=@perlInterpDQ,perlBracketsDQ keepend extend
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+{+ end=+}[msixpodualgcer]*+ contained contains=@perlInterpDQ,perlBracesDQ keepend extend extend syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+{+ end=+}[msixpodualgcern]*+ contained contains=@perlInterpDQ,perlBracesDQ keepend extend extend
syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+<+ end=+>[msixpodualgcer]*+ contained contains=@perlInterpDQ,perlAnglesDQ keepend extend syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+<+ end=+>[msixpodualgcern]*+ contained contains=@perlInterpDQ,perlAnglesDQ keepend extend
syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[msixpodualgcer]*+ contained contains=@perlInterpSQ keepend extend syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[msixpodualgcern]*+ contained contains=@perlInterpSQ keepend extend
" Translations " Translations
" perlMatch is the first part, perlTranslation* is the second, translator part. " perlMatch is the first part, perlTranslation* is the second, translator part.
@@ -314,35 +313,40 @@ syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\>\s*\z([^[:space:]#([{<'/]\)+ end=+\z1[imosx]*+ contains=@perlInterpMatch keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\>\s*\z([^[:space:]#([{<'/]\)+ end=+\z1[imosxdual]*+ contains=@perlInterpMatch keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*/+ end=+/[imosx]*+ contains=@perlInterpSlash keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*/+ end=+/[imosxdual]*+ contains=@perlInterpSlash keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr#+ end=+#[imosx]*+ contains=@perlInterpMatch keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr#+ end=+#[imosxdual]*+ contains=@perlInterpMatch keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*'+ end=+'[imosx]*+ contains=@perlInterpSQ keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*'+ end=+'[imosxdual]*+ contains=@perlInterpSQ keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*(+ end=+)[imosx]*+ contains=@perlInterpMatch,perlParensDQ keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*(+ end=+)[imosxdual]*+ contains=@perlInterpMatch,perlParensDQ keepend extend
" A special case for qr{}, qr<> and qr[] which allows for comments and extra whitespace in the pattern " A special case for qr{}, qr<> and qr[] which allows for comments and extra whitespace in the pattern
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*{+ end=+}[imosx]*+ contains=@perlInterpMatch,perlBracesDQ,perlComment keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*{+ end=+}[imosxdual]*+ contains=@perlInterpMatch,perlBracesDQ,perlComment keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*<+ end=+>[imosx]*+ contains=@perlInterpMatch,perlAnglesDQ,perlComment keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*<+ end=+>[imosxdual]*+ contains=@perlInterpMatch,perlAnglesDQ,perlComment keepend extend
syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*\[+ end=+\][imosx]*+ contains=@perlInterpMatch,perlBracketsDQ,perlComment keepend extend syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*\[+ end=+\][imosxdual]*+ contains=@perlInterpMatch,perlBracketsDQ,perlComment keepend extend
" Constructs such as print <<EOF [...] EOF, 'here' documents " Constructs such as print <<EOF [...] EOF, 'here' documents
" "
" XXX Any statements after the identifier are in perlString colour (i.e. " XXX Any statements after the identifier are in perlString colour (i.e.
" 'if $a' in 'print <<EOF if $a'). This is almost impossible to get right it " 'if $a' in 'print <<EOF if $a'). This is almost impossible to get right it
" seems due to the 'auto-extending nature' of regions. " seems due to the 'auto-extending nature' of regions.
syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\z(\I\i*\)+ end=+$+ contains=@perlTop oneline
syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ end=+$+ contains=@perlTop oneline
syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ end=+$+ contains=@perlTop oneline
syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\s*""+ end=+$+ contains=@perlTop oneline
syn region perlHereDocStart matchgroup=perlStringStartEnd start=+<<\s*''+ end=+$+ contains=@perlTop oneline
if exists("perl_fold") if exists("perl_fold")
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\z(\I\i*\).*+ end=+^\z1$+ contains=@perlInterpDQ fold extend syn region perlHereDoc start=+<<\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ fold extend
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ end=+^\z1$+ contains=@perlInterpDQ fold extend syn region perlHereDoc start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ fold extend
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ end=+^\z1$+ contains=@perlInterpSQ fold extend syn region perlHereDoc start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpSQ fold extend
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*""+ end=+^$+ contains=@perlInterpDQ,perlNotEmptyLine fold extend syn region perlHereDoc start=+<<\s*""+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine fold extend
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*''+ end=+^$+ contains=@perlInterpSQ,perlNotEmptyLine fold extend syn region perlHereDoc start=+<<\s*''+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpSQ,perlNotEmptyLine fold extend
syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL fold extend syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL fold extend
else else
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\z(\I\i*\).*+ end=+^\z1$+ contains=@perlInterpDQ syn region perlHereDoc start=+<<\z(\I\i*\)+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ end=+^\z1$+ contains=@perlInterpDQ syn region perlHereDoc start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpDQ
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ end=+^\z1$+ contains=@perlInterpSQ syn region perlHereDoc start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ matchgroup=perlStringStartEnd end=+^\z1$+ contains=perlHereDocStart,@perlInterpSQ
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*""+ end=+^$+ contains=@perlInterpDQ,perlNotEmptyLine syn region perlHereDoc start=+<<\s*""+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpDQ,perlNotEmptyLine
syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*''+ end=+^$+ contains=@perlInterpSQ,perlNotEmptyLine syn region perlHereDoc start=+<<\s*''+ matchgroup=perlStringStartEnd end=+^$+ contains=perlHereDocStart,@perlInterpSQ,perlNotEmptyLine
syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL
endif endif
@@ -356,28 +360,22 @@ syn keyword perlStatementPackage package contained
" sub [name] [(prototype)] { " sub [name] [(prototype)] {
" "
syn match perlSubError "[^[:space:];{#]" contained syn match perlSubError "[^[:space:];{#]" contained
if v:version == 701 && !has('patch221') " XXX I hope that's the right one syn match perlSubAttributesCont "\h\w*\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained
syn match perlSubAttributes ":" contained syn region perlSubAttributesCont matchgroup=perlSubAttributesCont start="\h\w*(" end=")\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained contains=@perlInterpSQ,perlParensSQ
syn cluster perlSubAttrMaybe contains=perlSubAttributesCont,perlSubError,perlFakeGroup
syn match perlSubAttributes "" contained nextgroup=perlSubError
syn match perlSubAttributes ":\_s*" contained nextgroup=@perlSubAttrMaybe
if get(g:, "perl_sub_signatures", 0)
syn match perlSignature +(\_[^)]*)\_s*+ nextgroup=perlSubAttributes,perlComment contained
else else
syn match perlSubAttributesCont "\h\w*\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained syn match perlSubPrototypeError "(\%(\_s*\%(\%(\\\%([$@%&*]\|\[[$@%&*]\+\]\)\|[$&*]\|[@%]\%(\_s*)\)\@=\|;\%(\_s*[)$@%&*\\]\)\@=\|_\%(\_s*[);]\)\@=\)\_s*\)*\)\@>\zs\_[^)]\+" contained
syn region perlSubAttributesCont matchgroup=perlSubAttributesCont start="\h\w*(" end=")\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained contains=@perlInterpSQ,perlParensSQ syn match perlSubPrototype +(\_[^)]*)\_s*+ nextgroup=perlSubAttributes,perlComment contained contains=perlSubPrototypeError
syn cluster perlSubAttrMaybe contains=perlSubAttributesCont,perlSubError,perlFakeGroup
syn match perlSubAttributes "" contained nextgroup=perlSubError
syn match perlSubAttributes ":\_s*" contained nextgroup=@perlSubAttrMaybe
endif endif
syn match perlSubPrototypeError "(\%(\_s*\%(\%(\\\%([$@%&*]\|\[[$@%&*]\+\]\)\|[$&*]\|[@%]\%(\_s*)\)\@=\|;\%(\_s*[)$@%&*\\]\)\@=\|_\%(\_s*[);]\)\@=\)\_s*\)*\)\@>\zs\_[^)]\+" contained
syn match perlSubPrototype +(\_[^)]*)\_s*\|+ nextgroup=perlSubAttributes,perlComment contained contains=perlSubPrototypeError syn match perlSubName +\%(\h\|::\|'\w\)\%(\w\|::\|'\w\)*\_s*\|+ contained nextgroup=perlSubPrototype,perlSignature,perlSubAttributes,perlComment
syn match perlSubName +\%(\h\|::\|'\w\)\%(\w\|::\|'\w\)*\_s*\|+ contained nextgroup=perlSubPrototype,perlComment
syn match perlFunction +\<sub\>\_s*+ nextgroup=perlSubName syn match perlFunction +\<sub\>\_s*+ nextgroup=perlSubName
if !exists("perl_no_scope_in_variables")
syn match perlFunctionPRef "\h\w*::" contained
syn match perlFunctionName "\h\w*[^:]" contained
else
syn match perlFunctionName "\h[[:alnum:]_:]*" contained
endif
" The => operator forces a bareword to the left of it to be interpreted as " The => operator forces a bareword to the left of it to be interpreted as
" a string " a string
syn match perlString "\I\@<!-\?\I\i*\%(\s*=>\)\@=" syn match perlString "\I\@<!-\?\I\i*\%(\s*=>\)\@="
@@ -397,10 +395,10 @@ syn match perlFormatField "@$" contained
" __END__ and __DATA__ clauses " __END__ and __DATA__ clauses
if exists("perl_fold") if exists("perl_fold")
syntax region perlDATA start="^__DATA__$" skip="." end="." fold syntax region perlDATA start="^__DATA__$" skip="." end="." contains=@perlDATA fold
syntax region perlDATA start="^__END__$" skip="." end="." contains=perlPOD,@perlDATA fold syntax region perlDATA start="^__END__$" skip="." end="." contains=perlPOD,@perlDATA fold
else else
syntax region perlDATA start="^__DATA__$" skip="." end="." syntax region perlDATA start="^__DATA__$" skip="." end="." contains=@perlDATA
syntax region perlDATA start="^__END__$" skip="." end="." contains=perlPOD,@perlDATA syntax region perlDATA start="^__END__$" skip="." end="." contains=perlPOD,@perlDATA
endif endif
@@ -414,9 +412,9 @@ if exists("perl_fold")
syn region perlPackageFold start="^package \S\+;\s*\%(#.*\)\=$" end="^1;\=\s*\%(#.*\)\=$" end="\n\+package"me=s-1 transparent fold keepend syn region perlPackageFold start="^package \S\+;\s*\%(#.*\)\=$" end="^1;\=\s*\%(#.*\)\=$" end="\n\+package"me=s-1 transparent fold keepend
endif endif
if !exists("perl_nofold_subs") if !exists("perl_nofold_subs")
if exists("perl_fold_anonymous_subs") && perl_fold_anonymous_subs if get(g:, "perl_fold_anonymous_subs", 0)
syn region perlSubFold start="\<sub\>[^\n;]*{" end="}" transparent fold keepend extend syn region perlSubFold start="\<sub\>[^{]*{" end="}" transparent fold keepend extend
syn region perlSubFold start="\<\%(BEGIN\|END\|CHECK\|INIT\)\>\s*{" end="}" transparent fold keepend syn region perlSubFold start="\<\%(BEGIN\|END\|CHECK\|INIT\)\>\s*{" end="}" transparent fold keepend
else else
syn region perlSubFold start="^\z(\s*\)\<sub\>.*[^};]$" end="^\z1}\s*\%(#.*\)\=$" transparent fold keepend syn region perlSubFold start="^\z(\s*\)\<sub\>.*[^};]$" end="^\z1}\s*\%(#.*\)\=$" transparent fold keepend
syn region perlSubFold start="^\z(\s*\)\<\%(BEGIN\|END\|CHECK\|INIT\|UNITCHECK\)\>.*[^};]$" end="^\z1}\s*$" transparent fold keepend syn region perlSubFold start="^\z(\s*\)\<\%(BEGIN\|END\|CHECK\|INIT\|UNITCHECK\)\>.*[^};]$" end="^\z1}\s*$" transparent fold keepend
@@ -424,7 +422,7 @@ if exists("perl_fold")
endif endif
if exists("perl_fold_blocks") if exists("perl_fold_blocks")
syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)foreach\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)for\%(each\)\=\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend
endif endif
@@ -435,7 +433,6 @@ else
syn sync minlines=0 syn sync minlines=0
endif endif
" NOTE: If you're linking new highlight groups to perlString, please also put " NOTE: If you're linking new highlight groups to perlString, please also put
" them into b:match_skip in ftplugin/perl.vim. " them into b:match_skip in ftplugin/perl.vim.
@@ -458,6 +455,7 @@ hi def link perlOperator Operator
hi def link perlFunction Keyword hi def link perlFunction Keyword
hi def link perlSubName Function hi def link perlSubName Function
hi def link perlSubPrototype Type hi def link perlSubPrototype Type
hi def link perlSignature Type
hi def link perlSubAttributes PreProc hi def link perlSubAttributes PreProc
hi def link perlSubAttributesCont perlSubAttributes hi def link perlSubAttributesCont perlSubAttributes
hi def link perlComment Comment hi def link perlComment Comment
@@ -516,8 +514,11 @@ hi def link perlStatementMisc perlStatement
hi def link perlStatementIndirObj perlStatement hi def link perlStatementIndirObj perlStatement
hi def link perlFunctionName perlIdentifier hi def link perlFunctionName perlIdentifier
hi def link perlMethod perlIdentifier hi def link perlMethod perlIdentifier
hi def link perlPostDeref perlIdentifier
hi def link perlFunctionPRef perlType hi def link perlFunctionPRef perlType
hi def link perlPOD perlComment if !get(g:, 'perl_include_pod', 1)
hi def link perlPOD perlComment
endif
hi def link perlShellCommand perlString hi def link perlShellCommand perlString
hi def link perlSpecialAscii perlSpecial hi def link perlSpecialAscii perlSpecial
hi def link perlSpecialDollar perlSpecial hi def link perlSpecialDollar perlSpecial
@@ -548,7 +549,6 @@ hi def link perlElseIfError Error
hi def link perlSubPrototypeError Error hi def link perlSubPrototypeError Error
hi def link perlSubError Error hi def link perlSubError Error
" Syncing to speed up processing " Syncing to speed up processing
" "
if !exists("perl_no_sync_on_sub") if !exists("perl_no_sync_on_sub")
@@ -575,11 +575,6 @@ syn sync match perlSyncPOD grouphere NONE "^=cut"
let b:current_syntax = "perl" let b:current_syntax = "perl"
if exists('&regexpengine')
let &regexpengine=s:regexpengine
unlet s:regexpengine
endif
let &cpo = s:cpo_save let &cpo = s:cpo_save
unlet s:cpo_save unlet s:cpo_save

View File

@@ -4,7 +4,7 @@
" Previously: Scott Bigham <dsb@killerbunnies.org> " Previously: Scott Bigham <dsb@killerbunnies.org>
" Homepage: http://github.com/vim-perl/vim-perl " Homepage: http://github.com/vim-perl/vim-perl
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues " Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: 2013-07-21 " Last Change: 2017-09-12
" To add embedded POD documentation highlighting to your syntax file, add " To add embedded POD documentation highlighting to your syntax file, add
" the commands: " the commands:
@@ -68,7 +68,7 @@ syn match podEscape2 "\d\+>"me=e-1 contained contains=@NoSpell
hi def link podCommand Statement hi def link podCommand Statement
hi def link podCmdText String hi def link podCmdText String
hi def link podOverIndent Number hi def link podOverIndent Number
hi def link podForKeywd Identifier hi def link podForKeywd Identifier
hi def link podFormat Identifier hi def link podFormat Identifier
hi def link podVerbatimLine PreProc hi def link podVerbatimLine PreProc
@@ -76,7 +76,6 @@ hi def link podSpecial Identifier
hi def link podEscape String hi def link podEscape String
hi def link podEscape2 Number hi def link podEscape2 Number
if exists("perl_pod_spellcheck_headings") if exists("perl_pod_spellcheck_headings")
" Spell-check headings " Spell-check headings
syn clear podCmdText syn clear podCmdText

View File

@@ -1,7 +1,7 @@
" Vim syntax file " Vim syntax file
" Language: readline(3) configuration file " Language: readline(3) configuration file
" Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2012-04-25 " Latest Revision: 2017-06-25
" readline_has_bash - if defined add support for bash specific " readline_has_bash - if defined add support for bash specific
" settings/functions " settings/functions
@@ -119,6 +119,7 @@ syn keyword readlineVariable contained
\ nextgroup=readlineBoolean \ nextgroup=readlineBoolean
\ skipwhite \ skipwhite
\ bind-tty-special-chars \ bind-tty-special-chars
\ colored-stats
\ completion-ignore-case \ completion-ignore-case
\ completion-map-case \ completion-map-case
\ convert-meta \ convert-meta
@@ -142,6 +143,7 @@ syn keyword readlineVariable contained
\ revert-all-at-newline \ revert-all-at-newline
\ show-all-if-ambiguous \ show-all-if-ambiguous
\ show-all-if-unmodified \ show-all-if-unmodified
\ show-mode-in-prompt
\ skip-completed-text \ skip-completed-text
\ visible-stats \ visible-stats
@@ -158,6 +160,7 @@ syn keyword readlineVariable contained
\ completion-prefix-display-length \ completion-prefix-display-length
\ completion-query-items \ completion-query-items
\ history-size \ history-size
\ keyseq-timeout
syn keyword readlineVariable contained syn keyword readlineVariable contained
\ nextgroup=readlineEditingMode \ nextgroup=readlineEditingMode

97
runtime/syntax/tap.vim Normal file
View File

@@ -0,0 +1,97 @@
" Vim syntax file
" Language: Verbose TAP Output
" Maintainer: Rufus Cable <rufus@threebytesfull.com>
" Remark: Simple syntax highlighting for TAP output
" License:
" Copyright: (c) 2008-2013 Rufus Cable
" Last Change: 2014-12-13
if exists("b:current_syntax")
finish
endif
syn match tapTestDiag /^ *#.*/ contains=tapTestTodo
syn match tapTestTime /^ *\[\d\d:\d\d:\d\d\].*/ contains=tapTestFile
syn match tapTestFile /\w\+\/[^. ]*/ contained
syn match tapTestFileWithDot /\w\+\/[^ ]*/ contained
syn match tapTestPlan /^ *\d\+\.\.\d\+$/
" tapTest is a line like 'ok 1', 'not ok 2', 'ok 3 - xxxx'
syn match tapTest /^ *\(not \)\?ok \d\+.*/ contains=tapTestStatusOK,tapTestStatusNotOK,tapTestLine
" tapTestLine is the line without the ok/not ok status - i.e. number and
" optional message
syn match tapTestLine /\d\+\( .*\|$\)/ contains=tapTestNumber,tapTestLoadMessage,tapTestTodo,tapTestSkip contained
" turn ok/not ok messages green/red respectively
syn match tapTestStatusOK /ok/ contained
syn match tapTestStatusNotOK /not ok/ contained
" highlight todo tests
syn match tapTestTodo /\(# TODO\|Failed (TODO)\) .*$/ contained contains=tapTestTodoRev
syn match tapTestTodoRev /\<TODO\>/ contained
" highlight skipped tests
syn match tapTestSkip /# skip .*$/ contained contains=tapTestSkipTag
syn match tapTestSkipTag /\(# \)\@<=skip\>/ contained
" look behind so "ok 123" and "not ok 124" match test number
syn match tapTestNumber /\(ok \)\@<=\d\d*/ contained
syn match tapTestLoadMessage /\*\*\*.*\*\*\*/ contained contains=tapTestThreeStars,tapTestFileWithDot
syn match tapTestThreeStars /\*\*\*/ contained
syn region tapTestRegion start=/^ *\(not \)\?ok.*$/me=e+1 end=/^\(\(not \)\?ok\|# Looks like you planned \|All tests successful\|Bailout called\)/me=s-1 fold transparent excludenl
syn region tapTestResultsOKRegion start=/^\(All tests successful\|Result: PASS\)/ end=/$/
syn region tapTestResultsNotOKRegion start=/^\(# Looks like you planned \|Bailout called\|# Looks like you failed \|Result: FAIL\)/ end=/$/
syn region tapTestResultsSummaryRegion start=/^Test Summary Report/ end=/^Files=.*$/ contains=tapTestResultsSummaryHeading,tapTestResultsSummaryNotOK
syn region tapTestResultsSummaryHeading start=/^Test Summary Report/ end=/^-\+$/ contained
syn region tapTestResultsSummaryNotOK start=/TODO passed:/ end=/$/ contained
syn region tapTestInstructionsRegion start=/\%1l/ end=/^$/
set foldtext=TAPTestLine_foldtext()
function! TAPTestLine_foldtext()
let line = getline(v:foldstart)
let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
return sub
endfunction
set foldminlines=5
set foldcolumn=2
set foldenable
set foldmethod=syntax
syn sync fromstart
if !exists("did_tapverboseoutput_syntax_inits")
let did_tapverboseoutput_syntax_inits = 1
hi tapTestStatusOK term=bold ctermfg=green guifg=Green
hi tapTestStatusNotOK term=reverse ctermfg=black ctermbg=red guifg=Black guibg=Red
hi tapTestTodo term=bold ctermfg=yellow ctermbg=black guifg=Yellow guibg=Black
hi tapTestTodoRev term=reverse ctermfg=black ctermbg=yellow guifg=Black guibg=Yellow
hi tapTestSkip term=bold ctermfg=lightblue guifg=LightBlue
hi tapTestSkipTag term=reverse ctermfg=black ctermbg=lightblue guifg=Black guibg=LightBlue
hi tapTestTime term=bold ctermfg=blue guifg=Blue
hi tapTestFile term=reverse ctermfg=black ctermbg=yellow guibg=Black guifg=Yellow
hi tapTestLoadedFile term=bold ctermfg=black ctermbg=cyan guibg=Cyan guifg=Black
hi tapTestThreeStars term=reverse ctermfg=blue guifg=Blue
hi tapTestPlan term=bold ctermfg=yellow guifg=Yellow
hi link tapTestFileWithDot tapTestLoadedFile
hi link tapTestNumber Number
hi link tapTestDiag Comment
hi tapTestRegion ctermbg=green
hi tapTestResultsOKRegion ctermbg=green ctermfg=black
hi tapTestResultsNotOKRegion ctermbg=red ctermfg=black
hi tapTestResultsSummaryHeading ctermbg=blue ctermfg=white
hi tapTestResultsSummaryNotOK ctermbg=red ctermfg=black
hi tapTestInstructionsRegion ctermbg=lightmagenta ctermfg=black
endif
let b:current_syntax="tapVerboseOutput"

View File

@@ -3,10 +3,10 @@
" Author: Moriki, Atsushi <4woods+vim@gmail.com> " Author: Moriki, Atsushi <4woods+vim@gmail.com>
" Homepage: http://github.com/vim-perl/vim-perl " Homepage: http://github.com/vim-perl/vim-perl
" Bugs/requests: http://github.com/vim-perl/vim-perl/issues " Bugs/requests: http://github.com/vim-perl/vim-perl/issues
" Last Change: 2013-07-21 " Last Change: 2015-04-25
" "
" Instration: " Installation:
" put tt2.vim and tt2html.vim in to your syntax diretory. " put tt2.vim and tt2html.vim in to your syntax directory.
" "
" add below in your filetype.vim. " add below in your filetype.vim.
" au BufNewFile,BufRead *.tt2 setf tt2 " au BufNewFile,BufRead *.tt2 setf tt2

File diff suppressed because it is too large Load Diff