diff options
37 files changed, 1102 insertions, 279 deletions
diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake index fbd107e45a..60afc88839 100644 --- a/cmake/FindMsgpack.cmake +++ b/cmake/FindMsgpack.cmake @@ -7,7 +7,7 @@ if(NOT MSGPACK_USE_BUNDLED) find_package(PkgConfig) if (PKG_CONFIG_FOUND) - pkg_search_module(PC_MSGPACK QUIET msgpackc msgpack) + pkg_search_module(PC_MSGPACK QUIET msgpackc>=1.0 msgpack>=1.0) endif() else() set(PC_MSGPACK_INCLUDEDIR) diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index dbc40fdf36..6dcddfd43e 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2015 Feb 28 +" Last Change: 2015 Apr 02 " " OPTIONS: " @@ -141,71 +141,80 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ if a:base != "" let context = substitute(context, '\s*[$a-zA-Z_0-9\x7f-\xff]*$', '', '') end + else + let context = '' end - let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(getline(0, line('.'))) + try + let winheight = winheight(0) + let winnr = winnr() - if context =~? '^use\s' || context ==? 'use' - return phpcomplete#CompleteUse(a:base) - endif + let [current_namespace, imports] = phpcomplete#GetCurrentNameSpace(getline(0, line('.'))) - if context =~ '\(->\|::\)$' - " {{{ - " Get name of the class - let classname = phpcomplete#GetClassName(line('.'), context, current_namespace, imports) - - " Get location of class definition, we have to iterate through all - if classname != '' - if classname =~ '\' - " split the last \ segment as a classname, everything else is the namespace - let classname_parts = split(classname, '\') - let namespace = join(classname_parts[0:-2], '\') - let classname = classname_parts[-1] - else - let namespace = '\' - endif - let classlocation = phpcomplete#GetClassLocation(classname, namespace) - else - let classlocation = '' + if context =~? '^use\s' || context ==? 'use' + return phpcomplete#CompleteUse(a:base) endif - if classlocation != '' - if classlocation == 'VIMPHP_BUILTINOBJECT' && has_key(g:php_builtin_classes, tolower(classname)) - return phpcomplete#CompleteBuiltInClass(context, classname, a:base) + if context =~ '\(->\|::\)$' + " {{{ + " Get name of the class + let classname = phpcomplete#GetClassName(line('.'), context, current_namespace, imports) + + " Get location of class definition, we have to iterate through all + if classname != '' + if classname =~ '\' + " split the last \ segment as a classname, everything else is the namespace + let classname_parts = split(classname, '\') + let namespace = join(classname_parts[0:-2], '\') + let classname = classname_parts[-1] + else + let namespace = '\' + endif + let classlocation = phpcomplete#GetClassLocation(classname, namespace) + else + let classlocation = '' endif - if filereadable(classlocation) - let classfile = readfile(classlocation) - let classcontent = '' - let classcontent .= "\n".phpcomplete#GetClassContents(classlocation, classname) - let sccontent = split(classcontent, "\n") - let visibility = expand('%:p') == fnamemodify(classlocation, ':p') ? 'private' : 'public' + if classlocation != '' + if classlocation == 'VIMPHP_BUILTINOBJECT' && has_key(g:php_builtin_classes, tolower(classname)) + return phpcomplete#CompleteBuiltInClass(context, classname, a:base) + endif - return phpcomplete#CompleteUserClass(context, a:base, sccontent, visibility) - endif - endif + if filereadable(classlocation) + let classfile = readfile(classlocation) + let classcontent = '' + let classcontent .= "\n".phpcomplete#GetClassContents(classlocation, classname) + let sccontent = split(classcontent, "\n") + let visibility = expand('%:p') == fnamemodify(classlocation, ':p') ? 'private' : 'public' - return phpcomplete#CompleteUnknownClass(a:base, context) - " }}} - elseif context =~? 'implements' - return phpcomplete#CompleteClassName(a:base, ['i'], current_namespace, imports) - elseif context =~? 'extends\s\+.\+$' && a:base == '' - return ['implements'] - elseif context =~? 'extends' - let kinds = context =~? 'class\s' ? ['c'] : ['i'] - return phpcomplete#CompleteClassName(a:base, kinds, current_namespace, imports) - elseif context =~? 'class [a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*' - " special case when you've typed the class keyword and the name too, only extends and implements allowed there - return filter(['extends', 'implements'], 'stridx(v:val, a:base) == 0') - elseif context =~? 'new' - return phpcomplete#CompleteClassName(a:base, ['c'], current_namespace, imports) - endif + return phpcomplete#CompleteUserClass(context, a:base, sccontent, visibility) + endif + endif - if a:base =~ '^\$' - return phpcomplete#CompleteVariable(a:base) - else - return phpcomplete#CompleteGeneral(a:base, current_namespace, imports) - endif + return phpcomplete#CompleteUnknownClass(a:base, context) + " }}} + elseif context =~? 'implements' + return phpcomplete#CompleteClassName(a:base, ['i'], current_namespace, imports) + elseif context =~? 'extends\s\+.\+$' && a:base == '' + return ['implements'] + elseif context =~? 'extends' + let kinds = context =~? 'class\s' ? ['c'] : ['i'] + return phpcomplete#CompleteClassName(a:base, kinds, current_namespace, imports) + elseif context =~? 'class [a-zA-Z_\x7f-\xff\\][a-zA-Z_0-9\x7f-\xff\\]*' + " special case when you've typed the class keyword and the name too, only extends and implements allowed there + return filter(['extends', 'implements'], 'stridx(v:val, a:base) == 0') + elseif context =~? 'new' + return phpcomplete#CompleteClassName(a:base, ['c'], current_namespace, imports) + endif + + if a:base =~ '^\$' + return phpcomplete#CompleteVariable(a:base) + else + return phpcomplete#CompleteGeneral(a:base, current_namespace, imports) + endif + finally + silent! exec winnr.'resize '.winheight + endtry endfunction " }}} @@ -1523,21 +1532,19 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor return '' endif - if line =~? '\v^\s*(abstract\s+|final\s+)*\s*class' - let class_name = matchstr(line, '\c\s*class\s*\zs'.class_name_pattern.'\ze') + if line =~? '\v^\s*(abstract\s+|final\s+)*\s*class\s' + let class_name = matchstr(line, '\cclass\s\+\zs'.class_name_pattern.'\ze') let extended_class = matchstr(line, '\cclass\s\+'.class_name_pattern.'\s\+extends\s\+\zs'.class_name_pattern.'\ze') let classname_candidate = a:context =~? 'parent::' ? extended_class : class_name - else - let i += 1 - continue + if classname_candidate != '' + let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType(classname_candidate, class_candidate_namespace, class_candidate_imports, methodstack) + " return absolute classname, without leading \ + return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate + endif endif - if classname_candidate != '' - let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType(classname_candidate, class_candidate_namespace, class_candidate_imports, methodstack) - " return absolute classname, without leading \ - return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate - endif + let i += 1 endwhile elseif a:context =~? '(\s*new\s\+'.class_name_pattern.'\s*)->' let classname_candidate = matchstr(a:context, '\cnew\s\+\zs'.class_name_pattern.'\ze') @@ -2031,7 +2038,7 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam " remember the window we started at let phpcomplete_original_window = winnr() - silent! tab 1new + silent! below 1new silent! 0put =cfile call search('\c\(class\|interface\|trait\)\_s\+'.a:class_name.'\(\>\|$\)') let cfline = line('.') @@ -2370,7 +2377,7 @@ endfunction! function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ let original_window = winnr() - silent! tab 1new + silent! below 1new silent! 0put =a:file_lines normal! G diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 140a2f2e66..e17281821c 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.4. Last change: 2014 Sep 23 +*autocmd.txt* For Vim version 7.4. Last change: 2015 Mar 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -973,6 +973,13 @@ WinLeave Before leaving a window. If the window to be ============================================================================== 6. Patterns *autocmd-patterns* *{pat}* +The {pat} argument can be a comma separated list. This works as if the +command was given with each pattern separately. Thus this command: > + :autocmd BufRead *.txt,*.info set et +Is equivalent to: > + :autocmd BufRead *.txt set et + :autocmd BufRead *.info set et + The file pattern {pat} is tested for a match against the file name in one of two ways: 1. When there is no '/' in the pattern, Vim checks for a match against only diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index f0747dad1b..6bdfa8dc8a 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -524,7 +524,7 @@ Funcref to a Dictionary, but the "self" variable is not available then. To avoid the extra name for the function it can be defined and directly assigned to a Dictionary in this way: > :let mydict = {'data': [0, 1, 2, 3]} - :function mydict.len() dict + :function mydict.len() : return len(self.data) :endfunction :echo mydict.len() @@ -1862,10 +1862,10 @@ getwinposx() Number X coord in pixels of GUI Vim window getwinposy() Number Y coord in pixels of GUI Vim window getwinvar( {nr}, {varname} [, {def}]) any variable {varname} in window {nr} -glob( {expr} [, {nosuf} [, {list}]]) +glob( {expr} [, {nosuf} [, {list} [, {alllinks}]]]) any expand file wildcards in {expr} glob2regpat( {expr}) String convert a glob pat into a search pat -globpath( {path}, {expr} [, {nosuf} [, {list}]]) +globpath( {path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) String do glob({expr}) for all dirs in {path} has( {feature}) Number TRUE if feature {feature} supported has_key( {dict}, {key}) Number TRUE if {dict} has entry {key} @@ -3754,7 +3754,7 @@ getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* :let list_is_on = getwinvar(2, '&list') :echo "myvar = " . getwinvar(1, 'myvar') < -glob({expr} [, {nosuf} [, {list}]]) *glob()* +glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* Expand the file wildcards in {expr}. See |wildcards| for the use of special characters. @@ -3771,8 +3771,11 @@ glob({expr} [, {nosuf} [, {list}]]) *glob()* matches, they are separated by <NL> characters. If the expansion fails, the result is an empty String or List. + A name for a non-existing file is not included. A symbolic link is only included if it points to an existing file. + However, when the {alllinks} argument is present and it is + non-zero then all symbolic links are included. For most systems backticks can be used to get files names from any external command. Example: > @@ -3792,7 +3795,8 @@ glob2regpat({expr}) *glob2regpat()* < This is equivalent to: > if filename =~ '^Make.*\.mak$' < -globpath({path}, {expr} [, {nosuf} [, {list}]]) *globpath()* + *globpath()* +globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) Perform glob() on all directories in {path} and concatenate the results. Example: > :echo globpath(&rtp, "syntax/c.vim") @@ -3818,6 +3822,8 @@ globpath({path}, {expr} [, {nosuf} [, {list}]]) *globpath()* they are separated by <NL> characters. Example: > :echo globpath(&rtp, "syntax/c.vim", 0, 1) < + {allinks} is used as with |glob()|. + The "**" item can be used to search in a directory tree. For example, to find all "README.txt" files in the directories in 'runtimepath' and below: > diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 766a440cb3..19bcb35da8 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -1,4 +1,4 @@ -*help.txt* For Vim version 7.4. Last change: 2012 Dec 06 +*help.txt* For Vim version 7.4. Last change: 2015 Apr 15 VIM - main help file k @@ -23,6 +23,7 @@ Get specific help: It is possible to go directly to whatever you want help Command-line editing c_ :help c_<Del> Vim command argument - :help -r Option ' :help 'textwidth' + Regular expression / :help /[ Search for help: Type ":help word", then hit CTRL-D to see matching help entries for "word". Or use ":helpgrep word". |:helpgrep| diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 59dbbf3067..21b5eef811 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.4. Last change: 2015 Jan 07 +*repeat.txt* For Vim version 7.4. Last change: 2015 Apr 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -583,6 +583,7 @@ For example, to profile the one_script.vim script file: > :prof[ile] start {fname} *:prof* *:profile* *E750* Start profiling, write the output in {fname} upon exit. + "~/" and environment variables in {fname} will be expanded. If {fname} already exists it will be silently overwritten. The variable |v:profiling| is set to one. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 6603d65645..6aed7441a0 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2015 Mar 20 +*syntax.txt* For Vim version 7.4. Last change: 2015 Mar 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3307,6 +3307,32 @@ must not click outside of the pixel strings, but feel free to improve it. It will look much better with a font in a quadratic cell size, e.g. for X: > :set guifont=-*-clean-medium-r-*-*-8-*-*-*-*-80-* + +YAML *yaml.vim* *ft-yaml-syntax* + + *g:yaml_schema* *b:yaml_schema* +A YAML schema is a combination of a set of tags and a mechanism for resolving +non-specific tags. For user this means that YAML parser may, depending on +plain scalar contents, treat plain scalar (which can actually be only string +and nothing else) as a value of the other type: null, boolean, floating-point, +integer. `g:yaml_schema` option determines according to which schema values +will be highlighted specially. Supported schemas are + +Schema Description ~ +failsafe No additional highlighting. +json Supports JSON-style numbers, booleans and null. +core Supports more number, boolean and null styles. +pyyaml In addition to core schema supports highlighting timestamps, + but there are some differences in what is recognized as + numbers and many additional boolean values not present in core + schema. + +Default schema is `core`. + +Note that schemas are not actually limited to plain scalars, but this is the +only difference between schemas defined in YAML specification and the only +difference defined in the syntax file. + ============================================================================== 5. Defining a syntax *:syn-define* *E410* diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index f81a4e3a2c..6a288f8965 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -1,4 +1,4 @@ -*usr_02.txt* For Vim version 7.4. Last change: 2010 Jul 20 +*usr_02.txt* For Vim version 7.4. Last change: 2015 Apr 12 VIM USER MANUAL - by Bram Moolenaar @@ -516,9 +516,11 @@ Summary: *help-summary* > :help subject() < Function "subject". > :help -subject -< Command-line option "-subject". > +< Command-line argument "-subject". > :help +subject < Compile-time feature "+subject". > + :help /* +< Regular expression item "*" > :help EventName < Autocommand event "EventName". > :help digraphs.txt diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 37a20be984..c5b01f0c40 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2015 Mar 13 +" Last Change: 2015 Apr 06 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1290,7 +1290,7 @@ au BufNewFile,BufRead *.mush setf mush au BufNewFile,BufRead Mutt{ng,}rc setf muttrc " Nano -au BufNewFile,BufRead */etc/nanorc,.nanorc setf nanorc +au BufNewFile,BufRead */etc/nanorc,*.nanorc setf nanorc " Nastran input/DMAP "au BufNewFile,BufRead *.dat setf nastran diff --git a/runtime/ftplugin/j.vim b/runtime/ftplugin/j.vim index 71ac4c5418..774696836f 100644 --- a/runtime/ftplugin/j.vim +++ b/runtime/ftplugin/j.vim @@ -2,7 +2,7 @@ " Language: J " Maintainer: David Bürgin <676c7473@gmail.com> " URL: https://github.com/glts/vim-j -" Last Change: 2015-01-11 +" Last Change: 2015-03-27 if exists('b:did_ftplugin') finish @@ -16,12 +16,9 @@ setlocal iskeyword=48-57,A-Z,_,a-z setlocal comments=:NB. setlocal commentstring=NB.\ %s setlocal formatoptions-=t -setlocal shiftwidth=2 -setlocal softtabstop=2 -setlocal expandtab setlocal matchpairs=(:) -let b:undo_ftplugin = 'setlocal matchpairs< expandtab< softtabstop< shiftwidth< formatoptions< commentstring< comments< iskeyword<' +let b:undo_ftplugin = 'setlocal matchpairs< formatoptions< commentstring< comments< iskeyword<' " Section movement with ]] ][ [[ []. The start/end patterns below are amended " inside the function in order to avoid matching on the current cursor line. diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index b97a905988..71443abe5b 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -245,6 +245,10 @@ call s:AddITags(s:indent_tags, [ \ 'header', 'group', 'keygen', 'mark', 'math', 'meter', 'nav', 'output', \ 'progress', 'ruby', 'section', 'svg', 'texture', 'time', 'video', \ 'wbr', 'text']) + +" Tags added for web components: +call s:AddITags(s:indent_tags, [ + \ 'content', 'shadow', 'template']) "}}} " Add Block Tags: these contain alien content @@ -287,7 +291,7 @@ func! s:CountITags(text) let s:nextrel = 0 " relative indent steps for next line [unit &sw]: let s:block = 0 " assume starting outside of a block let s:countonly = 1 " don't change state - call substitute(a:text, '<\zs/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') + call substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') let s:countonly = 0 endfunc "}}} @@ -299,7 +303,7 @@ func! s:CountTagsAndState(text) let s:nextrel = 0 " relative indent steps for next line [unit &sw]: let s:block = b:hi_newstate.block - let tmp = substitute(a:text, '<\zs/\=\w\+\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') + let tmp = substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g') if s:block == 3 let b:hi_newstate.scripttype = s:GetScriptType(matchstr(tmp, '\C.*<SCRIPT\>\zs[^>]*')) endif @@ -311,6 +315,9 @@ func! s:CheckTag(itag) "{{{ " Returns an empty string or "SCRIPT". " a:itag can be "tag" or "/tag" or "<!--" or "-->" + if (s:CheckCustomTag(a:itag)) + return "" + endif let ind = s:get_tag(a:itag) if ind == -1 " closing tag @@ -365,6 +372,36 @@ func! s:CheckBlockTag(blocktag, ind) return "" endfunc "}}} +" Used by s:CheckTag(). +func! s:CheckCustomTag(ctag) + "{{{ + " Returns 1 if ctag is the tag for a custom element, 0 otherwise. + " a:ctag can be "tag" or "/tag" or "<!--" or "-->" + let pattern = '\%\(\w\+-\)\+\w\+' + if match(a:ctag, pattern) == -1 + return 0 + endif + if matchstr(a:ctag, '\/\ze.\+') == "/" + " closing tag + if s:block != 0 + " ignore ctag within a block + return 1 + endif + if s:nextrel == 0 + let s:curind -= 1 + else + let s:nextrel -= 1 + endif + else + " opening tag + if s:block != 0 + return 1 + endif + let s:nextrel += 1 + endif + return 1 +endfunc "}}} + " Return the <script> type: either "javascript" or "" func! s:GetScriptType(str) "{{{ diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index a520e6317f..ac4909edba 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2015 Feb 27 +" Last Change: 2015 Mar 05 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -47,16 +47,17 @@ if !exists("c_no_cformat") endif " cCppString: same as cString, but ends at end of line -if s:ft ==# "cpp" && !exists("cpp_no_cpp11") +if s:ft ==# "cpp" && !exists("cpp_no_cpp11") && !exists("c_no_cformat") " ISO C++11 syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell -elseif s:ft ==# "c" && !exists("c_no_c11") +elseif s:ft ==# "c" && !exists("c_no_c11") && !exists("c_no_cformat") " ISO C99 syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend syn region cCppString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell else " older C or C++ + syn match cFormat display "%%" contained syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell endif @@ -80,7 +81,11 @@ syn match cSpecialCharacter display "L'\\x\x\+'" if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11")) " ISO C11 or ISO C++ 11 - syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend + if exists("c_no_cformat") + syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend + else + syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend + endif syn match cCharacter "[Uu]'[^\\]'" syn match cCharacter "[Uu]'[^']*'" contains=cSpecial if exists("c_gnu") @@ -389,8 +394,13 @@ endif syn cluster cLabelGroup contains=cUserLabel syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup -syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup -syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup +if s:ft ==# 'cpp' + syn match cUserCont display "^\s*\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup + syn match cUserCont display ";\s*\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup +else + syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup + syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup +endif syn match cUserLabel display "\I\i*" contained diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim index 15f0cbb4ff..526ecbcd53 100644 --- a/runtime/syntax/cpp.vim +++ b/runtime/syntax/cpp.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: C++ -" Current Maintainer: vim-jp (https://github.com/vim-jp/cpp-vim) +" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Previous Maintainer: Ken Shan <ccshan@post.harvard.edu> -" Last Change: 2014 May 14 +" Last Change: 2015 Mar 1 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -32,14 +32,21 @@ syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" syn keyword cppStorageClass mutable syn keyword cppStructure class typename template namespace syn keyword cppBoolean true false +syn keyword cppConstant __cplusplus " C++ 11 extensions if !exists("cpp_no_cpp11") syn keyword cppType override final syn keyword cppExceptions noexcept - syn keyword cppStorageClass constexpr decltype + syn keyword cppStorageClass constexpr decltype thread_local syn keyword cppConstant nullptr - syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell + syn keyword cppConstant ATOMIC_FLAG_INIT ATOMIC_VAR_INIT + syn keyword cppConstant ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE + syn keyword cppConstant ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE + syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE + syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE + syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE + syn region cppRawString matchgroup=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell endif " The minimum and maximum operators in GNU C++ diff --git a/runtime/syntax/csh.vim b/runtime/syntax/csh.vim index a67cb09189..9dc2c4ef56 100644 --- a/runtime/syntax/csh.vim +++ b/runtime/syntax/csh.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: C-shell (csh) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Version: 11 " Last Change: Oct 23, 2014 +" Version: 11 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_CSH " For version 5.x: Clear all syntax items diff --git a/runtime/syntax/groovy.vim b/runtime/syntax/groovy.vim index c745960bd5..65dbf17728 100644 --- a/runtime/syntax/groovy.vim +++ b/runtime/syntax/groovy.vim @@ -4,7 +4,7 @@ " Maintainer: Tobias Rapp <yahuxo@gmx.de> " Version: 0.1.13 " URL: http://www.vim.org/scripts/script.php?script_id=945 -" Last Change: 2013 Apr 24 +" Last Change: 2015 Apr 13 " THE ORIGINAL AUTHOR'S NOTES: " @@ -220,7 +220,6 @@ syn region groovyComment start="/\*" end="\*/" contains=@groovyCommen syn match groovyCommentStar contained "^\s*\*[^/]"me=e-1 syn match groovyCommentStar contained "^\s*\*$" syn match groovyLineComment "//.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell -syn match groovyLineComment "#.*" contains=@groovyCommentSpecial2,groovyTodo,@Spell GroovyHiLink groovyCommentString groovyString GroovyHiLink groovyComment2String groovyString GroovyHiLink groovyCommentCharacter groovyCharacter diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index 860181e0e6..e2d73111e4 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: php PHP 3/4/5 " Maintainer: Jason Woofenden <jason@jasonwoof.com> -" Last Change: Sep 18, 2014 -" URL: https://gitorious.org/jasonwoof/vim-syntax/blobs/master/php.vim +" Last Change: Mar 24, 2015 +" URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD " Former Maintainers: Peter Hodge <toomuchphp-vim@yahoo.com> " Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index f3218ffcb2..ad0df1f117 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,8 +2,8 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> -" Last Change: Jan 08, 2015 -" Version: 134 +" Last Change: Apr 10, 2015 +" Version: 136 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr) @@ -104,7 +104,7 @@ syn cluster shErrorList contains=shDoError,shIfError,shInError,shCaseError,shEsa if exists("b:is_kornshell") syn cluster ErrorList add=shDTestError endif -syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDerefSimple,shDo,shEcho,shEscape,shIf,shFor,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement +syn cluster shArithParenList contains=shArithmetic,shCaseEsac,shComment,shDeref,shDo,shDerefSimple,shEcho,shEscape,shNumber,shOperator,shPosnParm,shExSingleQuote,shExDoubleQuote,shRedir,shSingleQuote,shDoubleQuote,shStatement,shVariable,shAlias,shTest,shCtrlSeq,shSpecial,shParen,bashSpecialVariables,bashStatement,shIf,shFor syn cluster shArithList contains=@shArithParenList,shParenError syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq @@ -127,9 +127,9 @@ syn cluster shHereList contains=shBeginHere,shHerePayload syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo -syn cluster shLoopList contains=@shCaseList,shIf,shFor,shForPP,shTestOpr,shExpr,shDblBrace,shConditional,shCaseEsac,shTest,@shErrorList,shSet,shOption +syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator -syn cluster shTestList contains=shCharClass,shComment,shCommandSub,shDeref,shDerefSimple,shExDoubleQuote,shDoubleQuote,shExpr,shNumber,shOperator,shExSingleQuote,shSingleQuote,shTestOpr,shTest,shCtrlSeq +syn cluster shTestList contains=shCharClass,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr " Echo: {{{1 " ==== " This one is needed INSIDE a CommandSub, so that `echo bla` be correct @@ -197,13 +197,12 @@ syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\ syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern syn match shTestPattern contained '\w\+' -syn region shTestDoubleQuote contained start='"' skip='\\"' end='"' contains=shBQpairs +syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' syn match shTestSingleQuote contained '\\.' syn match shTestSingleQuote contained "'[^']*'" -syn match shBQpairs contained '\\\\' if exists("b:is_kornshell") || exists("b:is_bash") - syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList - syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList + syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\\\\\|\\$+ end="\]\]" contains=@shTestList,shComment + syn region shDblParen matchgroup=Delimiter start="((" skip=+\\\\\|\\$+ end="))" contains=@shTestList,shComment endif " Character Class In Range: {{{1 @@ -213,15 +212,16 @@ syn match shCharClass contained "\[:\(backspace\|escape\|return\|xdigit\|alnum " Loops: do, if, while, until {{{1 " ====== if s:sh_fold_ifdofor - syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList - syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList - syn region shFor fold matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn + syn region shDo fold transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList + syn region shIf fold transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList + syn region shFor fold matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\_s" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn + syn region shForPP fold matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr else - syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList - syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList - syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn + syn region shDo transparent matchgroup=shConditional start="\<do\>" matchgroup=shConditional end="\<done\>" contains=@shLoopList + syn region shIf transparent matchgroup=shConditional start="\<if\_s" matchgroup=shConditional skip=+-fi\>+ end="\<;\_s*then\>" end="\<fi\>" contains=@shIfList + syn region shFor matchgroup=shLoop start="\<for\ze\_s\s*\%(((\)\@!" end="\<in\>" end="\<do\>"me=e-2 contains=@shLoopList,shDblParen skipwhite nextgroup=shCurlyIn + syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr endif -syn region shForPP matchgroup=shLoop start='\<for\>\_s*((' end='))' contains=shTestOpr if exists("b:is_kornshell") || exists("b:is_bash") syn cluster shCaseList add=shRepeat syn cluster shFunctionList add=shRepeat @@ -409,19 +409,27 @@ endif if exists("b:is_bash") if s:sh_fold_functions - syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - syn region shFunctionTwo fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionTwo fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionFour fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment else - syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList - syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList + syn region shFunctionTwo matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList + syn region shFunctionFour matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained endif else if s:sh_fold_functions - syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment - syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionOne fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionTwo fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment + syn region shFunctionFour fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment else - syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList - syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList + syn region shFunctionTwo matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained + syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList + syn region shFunctionFour matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained endif endif @@ -577,7 +585,7 @@ hi def link shDoubleQuote shString hi def link shEcho shString hi def link shEchoDelim shOperator hi def link shEchoQuote shString -"hi def link shForPP shLoop +hi def link shForPP shLoop hi def link shEmbeddedEcho shString hi def link shEscape shCommandSub hi def link shExDoubleQuote shDoubleQuote @@ -604,7 +612,6 @@ hi def link shTestOpr shConditional hi def link shTestPattern shString hi def link shTestDoubleQuote shString hi def link shTestSingleQuote shString -hi def link shBQpairs shString hi def link shVariable shSetList hi def link shWrapLineOperator shOperator diff --git a/runtime/syntax/sm.vim b/runtime/syntax/sm.vim index ad96cdb3b5..8fdc14b71a 100644 --- a/runtime/syntax/sm.vim +++ b/runtime/syntax/sm.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: sendmail " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Jan 13, 2015 -" Version: 6 +" Last Change: Oct 23, 2014 +" Version: 7 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SM if exists("b:current_syntax") diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index dcdeca2e6c..f704766877 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> -" Last Change: Nov 18, 2014 -" Version: 83 +" Last Change: Apr 02, 2015 +" Version: 84 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -391,10 +391,17 @@ endif " particular support for bold and italic {{{1 if s:tex_fast =~ 'b' if s:tex_conceal =~ 'b' - syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup - syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup - syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" end="}" concealends contains=@texItalGroup - syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" end="}" concealends contains=@texBoldGroup + if !exists("g:tex_nospell") || !g:tex_nospell + syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texBoldGroup,@Spell + syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texItalGroup,@Spell + syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texItalGroup,@Spell + syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texBoldGroup,@Spell + else + syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texBoldGroup + syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texItalGroup + syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texItalGroup + syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*\ze{" matchgroup=Delimiter end="}" concealends contains=@texBoldGroup + endif endif endif @@ -576,14 +583,14 @@ else syn match texComment "%.*$" contains=@texCommentGroup if s:tex_fast =~ 'c' syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold - syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" fold contains=@texFoldGroup,@NoSpell - syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" fold contains=@Spell,@texFoldGroup + syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" fold contains=@texFoldGroup,@NoSpell + syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" fold contains=@Spell,@texFoldGroup endif else - syn match texComment "%.*$" contains=@texCommentGroup + syn match texComment "%.*$" contains=@texCommentGroup if s:tex_fast =~ 'c' - syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell - syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" contains=@Spell,@texFoldGroup + syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell + syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" contains=@Spell,@texFoldGroup endif endif endif diff --git a/runtime/syntax/upstreamdat.vim b/runtime/syntax/upstreamdat.vim index 7be806730d..e3b415a4bc 100644 --- a/runtime/syntax/upstreamdat.vim +++ b/runtime/syntax/upstreamdat.vim @@ -1,13 +1,14 @@ " Vim syntax file " Language: Innovation Data Processing upstream.dat file " Maintainer: Rob Owens <rowens@fdrinnovation.com> -" Latest Revision: 2013-06-17 +" Latest Revision: 2013-11-27 " Quit when a syntax file was already loaded if exists("b:current_syntax") finish endif +" Parameters: syn keyword upstreamdat_Parameter ACCEPTPCREMOTE syn keyword upstreamdat_Parameter ACCEPTREMOTE syn keyword upstreamdat_Parameter ACTION @@ -291,6 +292,14 @@ syn keyword upstreamdat_Parameter XFERECORDSIZE syn keyword upstreamdat_Parameter XFERRECSEP syn keyword upstreamdat_Parameter XFERRECUSECR +" File Specs: +syn match upstreamdat_Filespec /file spec\c \d\{1,3}.*/ + +" Comments: +syn match upstreamdat_Comment /^#.*/ + hi def link upstreamdat_Parameter Type +"hi def link upstreamdat_Filespec Underlined +hi def link upstreamdat_Comment Comment let b:current_syntax = "upstreamdat" diff --git a/runtime/syntax/upstreamrpt.vim b/runtime/syntax/upstreamrpt.vim new file mode 100644 index 0000000000..170fc8f509 --- /dev/null +++ b/runtime/syntax/upstreamrpt.vim @@ -0,0 +1,310 @@ +" Vim syntax file +" Language: Innovation Data Processing upstream.rpt file +" Maintainer: Rob Owens <rowens@fdrinnovation.com> +" Latest Revision: 2014-03-13 + +" Quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +setlocal foldmethod=syntax + +" Parameters: +syn keyword upstreamdat_Parameter ACCEPTPCREMOTE +syn keyword upstreamdat_Parameter ACCEPTREMOTE +syn keyword upstreamdat_Parameter ACTION +syn keyword upstreamdat_Parameter ACTIVATEONENTRY +syn keyword upstreamdat_Parameter ARCHIVEBIT +syn keyword upstreamdat_Parameter ARCHIVEBIT +syn keyword upstreamdat_Parameter ASCTOEBC +syn keyword upstreamdat_Parameter ASRBACKUP +syn keyword upstreamdat_Parameter ATTENDED +syn keyword upstreamdat_Parameter AUTHORITATIVE +syn keyword upstreamdat_Parameter AUTHORITATIVERESTORE +syn keyword upstreamdat_Parameter AUTHORITATIVERESTORE +syn keyword upstreamdat_Parameter BACKUPPROFILE +syn keyword upstreamdat_Parameter BACKUPPROFILE2 +syn keyword upstreamdat_Parameter BACKUPREPARSEFILES +syn keyword upstreamdat_Parameter BACKUPREPARSEFILES +syn keyword upstreamdat_Parameter BACKUPVERIFY +syn keyword upstreamdat_Parameter BLANKTRUNC +syn keyword upstreamdat_Parameter CALCDASDSIZE +syn keyword upstreamdat_Parameter CHANGEDIRATTRIBS +syn keyword upstreamdat_Parameter CHANGEDIRATTRIBS +syn keyword upstreamdat_Parameter COMPRESSLEVEL +syn keyword upstreamdat_Parameter CONTROLFILE +syn keyword upstreamdat_Parameter DASDOVERRIDE +syn keyword upstreamdat_Parameter DATELIMIT +syn keyword upstreamdat_Parameter DATELIMIT +syn keyword upstreamdat_Parameter DAYSOLD +syn keyword upstreamdat_Parameter DAYSOLD +syn keyword upstreamdat_Parameter DELETED +syn keyword upstreamdat_Parameter DELETED +syn keyword upstreamdat_Parameter DELETEPROMPTS +syn keyword upstreamdat_Parameter DELETEPROMPTS +syn keyword upstreamdat_Parameter DESTINATION +syn keyword upstreamdat_Parameter DESTINATION +syn keyword upstreamdat_Parameter DIRDELETE +syn keyword upstreamdat_Parameter DIRECTORVMC +syn keyword upstreamdat_Parameter DIRONLYRESTOREOK +syn keyword upstreamdat_Parameter DIRSONLY +syn keyword upstreamdat_Parameter DIRSONLY +syn keyword upstreamdat_Parameter DISASTERRECOVERY +syn keyword upstreamdat_Parameter DISPLAY +syn keyword upstreamdat_Parameter DRIVEALIAS +syn keyword upstreamdat_Parameter DRIVEALIAS +syn keyword upstreamdat_Parameter DUALCOPY +syn keyword upstreamdat_Parameter DUPDAYS +syn keyword upstreamdat_Parameter DUPLICATE +syn keyword upstreamdat_Parameter EBCTOASC +syn keyword upstreamdat_Parameter ENCRYPT +syn keyword upstreamdat_Parameter ENCRYPTLEVEL +syn keyword upstreamdat_Parameter EXCLUDELISTNAME +syn keyword upstreamdat_Parameter FAILBACKUPONERROR +syn keyword upstreamdat_Parameter FAILBACKUPONERROR +syn keyword upstreamdat_Parameter FAILIFNOFILES +syn keyword upstreamdat_Parameter FAILIFNOFILES +syn keyword upstreamdat_Parameter FAILIFSKIP +syn keyword upstreamdat_Parameter FAILJOB +syn keyword upstreamdat_Parameter FAILRESTOREONERROR +syn keyword upstreamdat_Parameter FAILRESTOREONERROR +syn keyword upstreamdat_Parameter FILEDATE +syn keyword upstreamdat_Parameter FILEDATE +syn keyword upstreamdat_Parameter FILEDELETE +syn keyword upstreamdat_Parameter FILEDELETE +syn keyword upstreamdat_Parameter FILES +syn keyword upstreamdat_Parameter FILES +syn keyword upstreamdat_Parameter FILESOPENFORUPDAT +syn keyword upstreamdat_Parameter FILESOPENFORUPDAT +syn keyword upstreamdat_Parameter FILETRANSFER +syn keyword upstreamdat_Parameter GETREMOTEFILES +syn keyword upstreamdat_Parameter HARDLINKDB +syn keyword upstreamdat_Parameter HARDLINKS +syn keyword upstreamdat_Parameter HARDLINKS +syn keyword upstreamdat_Parameter HIDDENFILES +syn keyword upstreamdat_Parameter HIDDENFILES +syn keyword upstreamdat_Parameter HOLDTAPE +syn keyword upstreamdat_Parameter HOLDUSERDIRS +syn keyword upstreamdat_Parameter HOSTFILENAME +syn keyword upstreamdat_Parameter HOSTRECORD +syn keyword upstreamdat_Parameter HOSTSORT +syn keyword upstreamdat_Parameter IGNOREPLUGINSFORRESTORE +syn keyword upstreamdat_Parameter INCRDB +syn keyword upstreamdat_Parameter INCRDBARCHIVEBIT +syn keyword upstreamdat_Parameter INCRDBDELETEDFILES +syn keyword upstreamdat_Parameter INCREMENTAL +syn keyword upstreamdat_Parameter INCREMENTAL +syn keyword upstreamdat_Parameter INQOPTIONS +syn keyword upstreamdat_Parameter INSTALLWIN2KAGENT +syn keyword upstreamdat_Parameter INSTALLWIN2KAGENT +syn keyword upstreamdat_Parameter JOBOPTIONS +syn keyword upstreamdat_Parameter JOBRETURNCODEMAP +syn keyword upstreamdat_Parameter JOBWAITTIMELIMIT +syn keyword upstreamdat_Parameter KEEPALIVE +syn keyword upstreamdat_Parameter LANINTERFACE +syn keyword upstreamdat_Parameter LANWSNAME +syn keyword upstreamdat_Parameter LANWSPASSWORD +syn keyword upstreamdat_Parameter LASTACCESS +syn keyword upstreamdat_Parameter LASTACCESS +syn keyword upstreamdat_Parameter LATESTDATE +syn keyword upstreamdat_Parameter LATESTDATE +syn keyword upstreamdat_Parameter LATESTTIME +syn keyword upstreamdat_Parameter LATESTTIME +syn keyword upstreamdat_Parameter LATESTVERSION +syn keyword upstreamdat_Parameter LINEBLOCK +syn keyword upstreamdat_Parameter LINETRUNC +syn keyword upstreamdat_Parameter LISTENFORREMOTE +syn keyword upstreamdat_Parameter LOCALBACKUP +syn keyword upstreamdat_Parameter LOCALBACKUPDIR +syn keyword upstreamdat_Parameter LOCALBACKUPMAX +syn keyword upstreamdat_Parameter LOCALBACKUPMAXFILESIZE +syn keyword upstreamdat_Parameter LOCALBACKUPMAXSIZE +syn keyword upstreamdat_Parameter LOCALEXCLUDEFILE +syn keyword upstreamdat_Parameter LOCALPARAMETERS +syn keyword upstreamdat_Parameter LOCALPASSWORD +syn keyword upstreamdat_Parameter LOCALRESTORE +syn keyword upstreamdat_Parameter LOCALUSER +syn keyword upstreamdat_Parameter LOFS +syn keyword upstreamdat_Parameter LOGNONFATAL +syn keyword upstreamdat_Parameter MAXBACKUPFILESFAIL +syn keyword upstreamdat_Parameter MAXBACKUPTIME +syn keyword upstreamdat_Parameter MAXDUPS +syn keyword upstreamdat_Parameter MAXFILENAMESIZE +syn keyword upstreamdat_Parameter MAXKFILESIZE +syn keyword upstreamdat_Parameter MAXLOGDAYS +syn keyword upstreamdat_Parameter MAXRESTOREFILESFAIL +syn keyword upstreamdat_Parameter MAXRESTORETIME +syn keyword upstreamdat_Parameter MAXRETRY +syn keyword upstreamdat_Parameter MAXRPTDAYS +syn keyword upstreamdat_Parameter MERGE +syn keyword upstreamdat_Parameter MIGRBITS +syn keyword upstreamdat_Parameter MIGRBITS +syn keyword upstreamdat_Parameter MINCOMPRESSSIZE +syn keyword upstreamdat_Parameter MINIMIZE +syn keyword upstreamdat_Parameter MODIFYFILE +syn keyword upstreamdat_Parameter MOUNTPOINTS +syn keyword upstreamdat_Parameter MOUNTPOINTS +syn keyword upstreamdat_Parameter NDS +syn keyword upstreamdat_Parameter NDS +syn keyword upstreamdat_Parameter NEWFILECOMPARE +syn keyword upstreamdat_Parameter NFSBELOW +syn keyword upstreamdat_Parameter NODATAOK +syn keyword upstreamdat_Parameter NODIRFORINCREMENTAL +syn keyword upstreamdat_Parameter NODIRFORINCREMENTAL +syn keyword upstreamdat_Parameter NONFILEDATABITMAP +syn keyword upstreamdat_Parameter NONFILEDATABITMAP +syn keyword upstreamdat_Parameter NOPOINTRESTORE +syn keyword upstreamdat_Parameter NOSPECINHERITANCE +syn keyword upstreamdat_Parameter NOTIFYEVENTS +syn keyword upstreamdat_Parameter NOTIFYFAILUREATTACHMENT +syn keyword upstreamdat_Parameter NOTIFYSUCCESSATTACHMENT +syn keyword upstreamdat_Parameter NOTIFYTARGETS +syn keyword upstreamdat_Parameter NOUIDGIDNAMES +syn keyword upstreamdat_Parameter NOUIDGIDNAMES +syn keyword upstreamdat_Parameter NOVELLMIGRATE +syn keyword upstreamdat_Parameter NOVELLMIGRATE +syn keyword upstreamdat_Parameter NOVELLMIGRATEADDEXT +syn keyword upstreamdat_Parameter NOVELLMIGRATEADDEXT +syn keyword upstreamdat_Parameter NOVELLPROFILE +syn keyword upstreamdat_Parameter NOVELLRECALL +syn keyword upstreamdat_Parameter NTFSADDPERMISSION +syn keyword upstreamdat_Parameter NTFSADDPERMISSION +syn keyword upstreamdat_Parameter NTREGRESTORE +syn keyword upstreamdat_Parameter OSTYPE +syn keyword upstreamdat_Parameter OUTPORT +syn keyword upstreamdat_Parameter PACKFLUSHAFTERFILE +syn keyword upstreamdat_Parameter PACKRECSIZE +syn keyword upstreamdat_Parameter PARAMETER +syn keyword upstreamdat_Parameter PASSWORD +syn keyword upstreamdat_Parameter PATHNAME +syn keyword upstreamdat_Parameter PATHNAME +syn keyword upstreamdat_Parameter PERFORMBITMAP +syn keyword upstreamdat_Parameter PERFORMNUMRECORDS +syn keyword upstreamdat_Parameter PERFORMRECORDSIZE +syn keyword upstreamdat_Parameter PLUGIN +syn keyword upstreamdat_Parameter PLUGIN +syn keyword upstreamdat_Parameter PLUGINPARAMETERS +syn keyword upstreamdat_Parameter PLUGINPARAMETERS +syn keyword upstreamdat_Parameter POSTJOB +syn keyword upstreamdat_Parameter PREJOB +syn keyword upstreamdat_Parameter PRTYCLASS +syn keyword upstreamdat_Parameter PRTYLEVEL +syn keyword upstreamdat_Parameter RECALLCLEANUP +syn keyword upstreamdat_Parameter RECALLOFFLINEFILES +syn keyword upstreamdat_Parameter RECALLOFFLINEFILES +syn keyword upstreamdat_Parameter RECORDSIZE +syn keyword upstreamdat_Parameter REMOTEADDR +syn keyword upstreamdat_Parameter REMOTEAPPLPREF +syn keyword upstreamdat_Parameter REMOTEAPPLRETRY +syn keyword upstreamdat_Parameter REMOTECONNECTTYPE +syn keyword upstreamdat_Parameter REMOTEFLAGS +syn keyword upstreamdat_Parameter REMOTEIPADAPTER +syn keyword upstreamdat_Parameter REMOTELOCALPARAMETERS +syn keyword upstreamdat_Parameter REMOTELOGMODE +syn keyword upstreamdat_Parameter REMOTELUNAME +syn keyword upstreamdat_Parameter REMOTEMAXRETRIES +syn keyword upstreamdat_Parameter REMOTEMODENAME +syn keyword upstreamdat_Parameter REMOTEPARAMETERFILE +syn keyword upstreamdat_Parameter REMOTEPORT +syn keyword upstreamdat_Parameter REMOTEREQUEST +syn keyword upstreamdat_Parameter REMOTERESTART +syn keyword upstreamdat_Parameter REMOTEROUTE +syn keyword upstreamdat_Parameter REMOTETARGETNAME +syn keyword upstreamdat_Parameter REMOTETCP +syn keyword upstreamdat_Parameter REMOTETIMEOUT +syn keyword upstreamdat_Parameter REMOTETMAXRETRY +syn keyword upstreamdat_Parameter REMOTETPN +syn keyword upstreamdat_Parameter REMOTEUSAPPL +syn keyword upstreamdat_Parameter REMOTEVERIFY +syn keyword upstreamdat_Parameter REMOTEWTOCOMP +syn keyword upstreamdat_Parameter REPORTNAME +syn keyword upstreamdat_Parameter REPORTOPTIONS +syn keyword upstreamdat_Parameter RESTARTLASTFILE +syn keyword upstreamdat_Parameter RESTART +syn keyword upstreamdat_Parameter RESTARTTYPE +syn keyword upstreamdat_Parameter RESTARTVERSIONDATE +syn keyword upstreamdat_Parameter RESTOREARCHIVEBIT +syn keyword upstreamdat_Parameter RESTORECHECKPOINT +syn keyword upstreamdat_Parameter RESTOREDATELIMIT +syn keyword upstreamdat_Parameter RESTOREDATELIMIT +syn keyword upstreamdat_Parameter RESTOREFILEFAIL +syn keyword upstreamdat_Parameter RESTOREMOUNTPOINTS +syn keyword upstreamdat_Parameter RESTOREMOUNTPOINTS +syn keyword upstreamdat_Parameter RESTORESEGMENTS +syn keyword upstreamdat_Parameter RESTORESEGMENTS +syn keyword upstreamdat_Parameter RESTORETODIFFFS +syn keyword upstreamdat_Parameter RETAIN +syn keyword upstreamdat_Parameter RETAIN +syn keyword upstreamdat_Parameter ROOTENTRY +syn keyword upstreamdat_Parameter ROOTENTRY +syn keyword upstreamdat_Parameter SAN +syn keyword upstreamdat_Parameter SCHEDULENAME +syn keyword upstreamdat_Parameter SEGMENTEDFILESIZE +syn keyword upstreamdat_Parameter SEGMENTEDFILESIZE +syn keyword upstreamdat_Parameter SEGMENTSIZE +syn keyword upstreamdat_Parameter SEGMENTSIZE +syn keyword upstreamdat_Parameter SENDHOSTDETAILS +syn keyword upstreamdat_Parameter SINGLEFS +syn keyword upstreamdat_Parameter SIZETRC +syn keyword upstreamdat_Parameter SKIP +syn keyword upstreamdat_Parameter SKIPBACKUPSCAN +syn keyword upstreamdat_Parameter SKIPOLD +syn keyword upstreamdat_Parameter SKIPOLD +syn keyword upstreamdat_Parameter SMSTARGETSERVICENAME +syn keyword upstreamdat_Parameter SMSTSA +syn keyword upstreamdat_Parameter SOLO +syn keyword upstreamdat_Parameter SORTBACKUP +syn keyword upstreamdat_Parameter SOSDISK +syn keyword upstreamdat_Parameter SOSDISK +syn keyword upstreamdat_Parameter SOSTIMESTAMP +syn keyword upstreamdat_Parameter SOSTIMESTAMP +syn keyword upstreamdat_Parameter SOSTIMESTAMPPATH +syn keyword upstreamdat_Parameter SOSTIMESTAMPPATH +syn keyword upstreamdat_Parameter SPECNUMBER +syn keyword upstreamdat_Parameter SPECNUMBER +syn keyword upstreamdat_Parameter SPECTYPE +syn keyword upstreamdat_Parameter SPECTYPE +syn keyword upstreamdat_Parameter STARTTIME +syn keyword upstreamdat_Parameter STORAGETYPE +syn keyword upstreamdat_Parameter SUBDIRECTORIES +syn keyword upstreamdat_Parameter SUBDIRECTORIES +syn keyword upstreamdat_Parameter SWITCHTOTAPEMB +syn keyword upstreamdat_Parameter TCPADDRESS +syn keyword upstreamdat_Parameter TCPTIMEOUT +syn keyword upstreamdat_Parameter TIMEOVERRIDE +syn keyword upstreamdat_Parameter TRACE +syn keyword upstreamdat_Parameter TRANSLATE +syn keyword upstreamdat_Parameter ULTRACOMP +syn keyword upstreamdat_Parameter ULTREG +syn keyword upstreamdat_Parameter ULTUPD +syn keyword upstreamdat_Parameter UNCMACHINEALIAS +syn keyword upstreamdat_Parameter UNCMACHINEALIAS +syn keyword upstreamdat_Parameter USEALEBRA +syn keyword upstreamdat_Parameter USECONTROLFILE +syn keyword upstreamdat_Parameter USEGID +syn keyword upstreamdat_Parameter USERID +syn keyword upstreamdat_Parameter USEUID +syn keyword upstreamdat_Parameter USNOUIDGIDERRORS +syn keyword upstreamdat_Parameter UTF8 +syn keyword upstreamdat_Parameter VAULTNUMBER +syn keyword upstreamdat_Parameter VERSIONDATE +syn keyword upstreamdat_Parameter WRITESPARSE +syn keyword upstreamdat_Parameter XFERECORDSIZE +syn keyword upstreamdat_Parameter XFERRECSEP +syn keyword upstreamdat_Parameter XFERRECUSECR + +" File Specs: +syn match upstreamdat_Filespec /file spec\c \d\{1,3}.*/ + +" Comments: +syn match upstreamdat_Comment /^#.*/ + +" List Of Parameters: +syn region upstreamdat_Parms start="Current Parameters:" end="End Of Parameters" transparent fold + +hi def link upstreamdat_Parameter Type +"hi def link upstreamdat_Filespec Underlined +hi def link upstreamdat_Comment Comment + +let b:current_syntax = "upstreamdat" diff --git a/runtime/syntax/usw2kagtlog.vim b/runtime/syntax/usw2kagtlog.vim index 0a34128f9b..a112340d12 100644 --- a/runtime/syntax/usw2kagtlog.vim +++ b/runtime/syntax/usw2kagtlog.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Innovation Data Processing USW2KAgt.log file " Maintainer: Rob Owens <rowens@fdrinnovation.com> -" Latest Revision: 2013-09-19 +" Latest Revision: 2014-04-01 " Quit when a syntax file was already loaded if exists("b:current_syntax") @@ -17,8 +17,12 @@ syn match usw2kagtlog_MsgI /Msg #\(Agt\|PC\|Srv\)\d\{4,5}I/ nextgroup=usw2kagtlo syn match usw2kagtlog_MsgW /Msg #\(Agt\|PC\|Srv\)\d\{4,5}W/ nextgroup=usw2kagtlog_Process skipwhite " Processes: syn region usw2kagtlog_Process start="(" end=")" contained -syn region usw2kagtlog_Process start="Starting the processing for a \zs\"" end="\ze client request" -syn region usw2kagtlog_Process start="Ending the processing for a \zs\"" end="\ze client request" +"syn region usw2kagtlog_Process start="Starting the processing for a \zs\"" end="\ze client request" +"syn region usw2kagtlog_Process start="Ending the processing for a \zs\"" end="\ze client request" +"syn region usw2kagtlog_Process start="Starting the processing for a \zs\"" end="\ze client\s\{0,1}\r\{0,1}\s\{1,9}request" +"syn region usw2kagtlog_Process start="Ending the processing for a \zs\"" end="\ze client\s\{0,1}\r\{0,1}\s\{1,9}request" +syn region usw2kagtlog_Process start="Starting the processing for a \zs\"" end="\ze client" +syn region usw2kagtlog_Process start="Ending the processing for a \zs\"" end="\ze client" " IP Address: syn match usw2kagtlog_IPaddr / \d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/ " Profile: diff --git a/runtime/syntax/yacc.vim b/runtime/syntax/yacc.vim index 9dc6cccb2d..977ffa75e4 100644 --- a/runtime/syntax/yacc.vim +++ b/runtime/syntax/yacc.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Yacc " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Jan 14, 2015 -" Version: 12 +" Last Change: Apr 02, 2015 +" Version: 13 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " " Options: {{{1 diff --git a/runtime/syntax/yaml.vim b/runtime/syntax/yaml.vim index 073dbf7418..626dc8a77f 100644 --- a/runtime/syntax/yaml.vim +++ b/runtime/syntax/yaml.vim @@ -2,7 +2,7 @@ " Language: YAML (YAML Ain't Markup Language) 1.2 " Maintainer: Nikolai Pavlov <zyx.vim@gmail.com> " First author: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2010-10-08 +" Latest Revision: 2015-03-28 if exists('b:current_syntax') finish @@ -11,13 +11,40 @@ endif let s:cpo_save = &cpo set cpo&vim -let s:ns_char = '\%(\%([\n\r\uFEFF \t]\)\@!\p\)' -let s:ns_word_char = '\%(\w\|-\)' -let s:ns_uri_char = '\%(%\x\x\|'.s:ns_word_char.'\|[#/;?:@&=+$,.!~*''()\[\]]\)' +" Choose the schema to use +" TODO: Validate schema +if !exists('b:yaml_schema') + if exists('g:yaml_schema') + let b:yaml_schema = g:yaml_schema + else + let b:yaml_schema = 'core' + endif +endif + +let s:ns_char = '\%([\n\r\uFEFF \t]\@!\p\)' +let s:ns_word_char = '[[:alnum:]_\-]' +let s:ns_uri_char = '\%(%\x\x\|'.s:ns_word_char.'\|[#/;?:@&=+$,.!~*''()[\]]\)' let s:ns_tag_char = '\%(%\x\x\|'.s:ns_word_char.'\|[#/;?:@&=+$.~*''()]\)' -let s:c_ns_anchor_char = '\%(\%([\n\r\uFEFF \t,\[\]{}]\)\@!\p\)' -let s:c_indicator = '[\-?:,\[\]{}#&*!|>''"%@`]' -let s:c_flow_indicator = '[,\[\]{}]' +let s:c_ns_anchor_char = '\%([\n\r\uFEFF \t,[\]{}]\@!\p\)' +let s:c_indicator = '[\-?:,[\]{}#&*!|>''"%@`]' +let s:c_flow_indicator = '[,[\]{}]' + +let s:ns_char_without_c_indicator = substitute(s:ns_char, '\v\C[\zs', '\=s:c_indicator[1:-2]', '') + +let s:_collection = '[^\@!\(\%(\\\.\|\[^\\\]]\)\+\)]' +let s:_neg_collection = '[^\(\%(\\\.\|\[^\\\]]\)\+\)]' +function s:SimplifyToAssumeAllPrintable(p) + return substitute(a:p, '\V\C\\%('.s:_collection.'\\@!\\p\\)', '[^\1]', '') +endfunction +let s:ns_char = s:SimplifyToAssumeAllPrintable(s:ns_char) +let s:ns_char_without_c_indicator = s:SimplifyToAssumeAllPrintable(s:ns_char_without_c_indicator) +let s:c_ns_anchor_char = s:SimplifyToAssumeAllPrintable(s:c_ns_anchor_char) + +function s:SimplifyAdjacentCollections(p) + return substitute(a:p, '\V\C'.s:_collection.'\\|'.s:_collection, '[\1\2]', 'g') +endfunction +let s:ns_uri_char = s:SimplifyAdjacentCollections(s:ns_uri_char) +let s:ns_tag_char = s:SimplifyAdjacentCollections(s:ns_tag_char) let s:c_verbatim_tag = '!<'.s:ns_uri_char.'\+>' let s:c_named_tag_handle = '!'.s:ns_word_char.'\+!' @@ -46,11 +73,15 @@ let s:ns_tag_prefix = s:ns_local_tag_prefix. let s:ns_plain_safe_out = s:ns_char let s:ns_plain_safe_in = '\%('.s:c_flow_indicator.'\@!'.s:ns_char.'\)' -let s:ns_plain_first_in = '\%('.s:c_indicator.'\@!'.s:ns_char.'\|[?:\-]\%('.s:ns_plain_safe_in.'\)\@=\)' -let s:ns_plain_first_out = '\%('.s:c_indicator.'\@!'.s:ns_char.'\|[?:\-]\%('.s:ns_plain_safe_out.'\)\@=\)' +let s:ns_plain_safe_in = substitute(s:ns_plain_safe_in, '\V\C\\%('.s:_collection.'\\@!'.s:_neg_collection.'\\)', '[^\1\2]', '') +let s:ns_plain_safe_in_without_colhash = substitute(s:ns_plain_safe_in, '\V\C'.s:_neg_collection, '[^\1:#]', '') +let s:ns_plain_safe_out_without_colhash = substitute(s:ns_plain_safe_out, '\V\C'.s:_neg_collection, '[^\1:#]', '') -let s:ns_plain_char_in = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_in.'\|[:#]\@!'.s:ns_plain_safe_in.'\)' -let s:ns_plain_char_out = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_out.'\|[:#]\@!'.s:ns_plain_safe_out.'\)' +let s:ns_plain_first_in = '\%('.s:ns_char_without_c_indicator.'\|[?:\-]\%('.s:ns_plain_safe_in.'\)\@=\)' +let s:ns_plain_first_out = '\%('.s:ns_char_without_c_indicator.'\|[?:\-]\%('.s:ns_plain_safe_out.'\)\@=\)' + +let s:ns_plain_char_in = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_in.'\|'.s:ns_plain_safe_in_without_colhash.'\)' +let s:ns_plain_char_out = '\%('.s:ns_char.'#\|:'.s:ns_plain_safe_out.'\|'.s:ns_plain_safe_out_without_colhash.'\)' let s:ns_plain_out = s:ns_plain_first_out . s:ns_plain_char_out.'*' let s:ns_plain_in = s:ns_plain_first_in . s:ns_plain_char_in.'*' @@ -89,9 +120,11 @@ syn match yamlSingleEscape contained "''" syn match yamlBlockScalarHeader contained '\s\+\zs[|>]\%([+-]\=[1-9]\|[1-9]\=[+-]\)\=' +syn cluster yamlConstant contains=yamlBool,yamlNull + syn cluster yamlFlow contains=yamlFlowString,yamlFlowMapping,yamlFlowCollection syn cluster yamlFlow add=yamlFlowMappingKey,yamlFlowMappingMerge -syn cluster yamlFlow add=yamlConstant,yamlPlainScalar,yamlFloat +syn cluster yamlFlow add=@yamlConstant,yamlPlainScalar,yamlFloat syn cluster yamlFlow add=yamlTimestamp,yamlInteger,yamlMappingKeyStart syn cluster yamlFlow add=yamlComment syn region yamlFlowMapping matchgroup=yamlFlowIndicator start='{' end='}' contains=@yamlFlow @@ -103,15 +136,15 @@ execute 'syn match yamlPlainScalar contained /'.s:ns_plain_in.'/' syn match yamlMappingKeyStart '?\ze\s' syn match yamlMappingKeyStart '?' contained -execute 'syn match yamlFlowMappingKey /'.s:ns_plain_in.'\ze\s*:/ contained '. +execute 'syn match yamlFlowMappingKey /\%#=1'.s:ns_plain_in.'\%(\s\+'.s:ns_plain_in.'\)*\ze\s*:/ contained '. \'nextgroup=yamlKeyValueDelimiter' syn match yamlFlowMappingMerge /<<\ze\s*:/ contained nextgroup=yamlKeyValueDelimiter syn match yamlBlockCollectionItemStart '^\s*\zs-\%(\s\+-\)*\s' nextgroup=yamlBlockMappingKey,yamlBlockMappingMerge " Use the old regexp engine, the NFA engine doesn't like all the \@ items. -execute 'syn match yamlBlockMappingKey /\%#=1^\s*\zs'.s:ns_plain_out.'\ze\s*:\%(\s\|$\)/ '. +execute 'syn match yamlBlockMappingKey /\%#=1^\s*\zs'.s:ns_plain_out.'\%(\s\+'.s:ns_plain_out.'\)*\ze\s*:\%(\s\|$\)/ '. \'nextgroup=yamlKeyValueDelimiter' -execute 'syn match yamlBlockMappingKey /\%#=1\s*\zs'.s:ns_plain_out.'\ze\s*:\%(\s\|$\)/ contained '. +execute 'syn match yamlBlockMappingKey /\%#=1\s*\zs'.s:ns_plain_out.'\%(\s\+'.s:ns_plain_out.'\)*\ze\s*:\%(\s\|$\)/ contained '. \'nextgroup=yamlKeyValueDelimiter' syn match yamlBlockMappingMerge /^\s*\zs<<\ze:\%(\s\|$\)/ nextgroup=yamlKeyValueDelimiter syn match yamlBlockMappingMerge /<<\ze\s*:\%(\s\|$\)/ nextgroup=yamlKeyValueDelimiter contained @@ -119,14 +152,32 @@ syn match yamlBlockMappingMerge /<<\ze\s*:\%(\s\|$\)/ nextgroup=yamlKeyValueDeli syn match yamlKeyValueDelimiter /\s*:/ contained syn match yamlKeyValueDelimiter /\s*:/ contained -syn keyword yamlConstant true True TRUE false False FALSE -syn keyword yamlConstant null Null NULL -syn match yamlConstant '\<\~\>' - -syn match yamlTimestamp /\%([\[\]{}, \t]\@!\p\)\@<!\%(\d\{4}-\d\d\=-\d\d\=\%(\%([Tt]\|\s\+\)\%(\d\d\=\):\%(\d\d\):\%(\d\d\)\%(\.\%(\d*\)\)\=\%(\s*\%(Z\|[+-]\d\d\=\%(:\d\d\)\=\)\)\=\)\=\)\%([\[\]{}, \t]\@!\p\)\@!/ +syn cluster yamlScalarWithSpecials contains=yamlPlainScalar,yamlBlockMappingKey,yamlFlowMappingKey + +let s:_bounder = s:SimplifyToAssumeAllPrintable('\%([[\]{}, \t]\@!\p\)') +if b:yaml_schema is# 'json' + syn keyword yamlNull null contained containedin=@yamlScalarWithSpecials + syn keyword yamlBool true false + exe 'syn match yamlInteger /'.s:_bounder.'\@1<!\%(0\|-\=[1-9][0-9]*\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlFloat /'.s:_bounder.'\@1<!\%(-\=[1-9][0-9]*\%(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|0\|-\=\.inf\|\.nan\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' +elseif b:yaml_schema is# 'core' + syn keyword yamlNull null Null NULL contained containedin=@yamlScalarWithSpecials + syn keyword yamlBool true True TRUE false False FALSE contained containedin=@yamlScalarWithSpecials + exe 'syn match yamlNull /'.s:_bounder.'\@1<!\~'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlInteger /'.s:_bounder.'\@1<!\%([+-]\=\%(0\%(b[0-1_]\+\|[0-7_]\+\|x[0-9a-fA-F_]\+\)\=\|\%([1-9][0-9_]*\%(:[0-5]\=\d\)\+\)\)\|[1-9][0-9_]*\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlFloat /'.s:_bounder.'\@1<!\%([+-]\=\%(\%(\d[0-9_]*\)\.[0-9_]*\%([eE][+-]\=\d\+\)\=\|\.[0-9_]\+\%([eE][-+]\=[0-9]\+\)\=\|\d[0-9_]*\%(:[0-5]\=\d\)\+\.[0-9_]*\|\.\%(inf\|Inf\|INF\)\)\|\%(\.\%(nan\|NaN\|NAN\)\)\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' +elseif b:yaml_schema is# 'pyyaml' + syn keyword yamlNull null Null NULL contained containedin=@yamlScalarWithSpecials + syn keyword yamlBool true True TRUE false False FALSE yes Yes YES no No NO on On ON off Off OFF contained containedin=@yamlScalarWithSpecials + exe 'syn match yamlNull /'.s:_bounder.'\@1<!\~'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlFloat /'.s:_bounder.'\@1<!\%(\v[-+]?%(\d[0-9_]*)\.[0-9_]*%([eE][-+]\d+)?|\.[0-9_]+%([eE][-+]\d+)?|[-+]?\d[0-9_]*%(\:[0-5]?\d)+\.[0-9_]*|[-+]?\.%(inf|Inf|INF)|\.%(nan|NaN|NAN)\m\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlInteger /'.s:_bounder.'\@1<!\%(\v[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?%(0|[1-9][0-9_]*)|[-+]?0x[0-9a-fA-F_]+|[-+]?[1-9][0-9_]*%(:[0-5]?\d)+\m\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' + exe 'syn match yamlTimestamp /'.s:_bounder.'\@1<!\%(\v\d\d\d\d\-\d\d\-\d\d|\d\d\d\d \-\d\d? \-\d\d?%([Tt]|[ \t]+)\d\d?\:\d\d \:\d\d %(\.\d*)?%([ \t]*%(Z|[-+]\d\d?%(\:\d\d)?))?\m\)'.s:_bounder.'\@!/ contained containedin=@yamlScalarWithSpecials' +elseif b:yaml_schema is# 'failsafe' + " Nothing +endif +unlet s:_bounder -syn match yamlInteger /\%([\[\]{}, \t]\@!\p\)\@<!\%([+-]\=\%(0\%(b[0-1_]\+\|[0-7_]\+\|x[0-9a-fA-F_]\+\)\=\|\%([1-9][0-9_]*\%(:[0-5]\=\d\)\+\)\)\|[1-9][0-9_]*\)\%([\[\]{}, \t]\@!\p\)\@!/ -syn match yamlFloat /\%([\[\]{}, \t]\@!\p\)\@<!\%([+-]\=\%(\%(\d[0-9_]*\)\.[0-9_]*\%([eE][+-]\d\+\)\=\|\.[0-9_]\+\%([eE][-+][0-9]\+\)\=\|\d[0-9_]*\%(:[0-5]\=\d\)\+\.[0-9_]*\|\.\%(inf\|Inf\|INF\)\)\|\%(\.\%(nan\|NaN\|NAN\)\)\)\%([\[\]{}, \t]\@!\p\)\@!/ execute 'syn match yamlNodeTag '.string(s:c_ns_tag_property) execute 'syn match yamlAnchor '.string(s:c_ns_anchor_property) @@ -170,6 +221,9 @@ hi def link yamlKeyValueDelimiter Special hi def link yamlConstant Constant +hi def link yamlNull yamlConstant +hi def link yamlBool yamlConstant + hi def link yamlAnchor Type hi def link yamlAlias Type hi def link yamlNodeTag Type @@ -180,8 +234,10 @@ hi def link yamlTimestamp Number let b:current_syntax = "yaml" -unlet s:ns_word_char s:ns_uri_char s:c_verbatim_tag s:c_named_tag_handle s:c_secondary_tag_handle s:c_primary_tag_handle s:c_tag_handle s:ns_tag_char s:c_ns_shorthand_tag s:c_non_specific_tag s:c_ns_tag_property s:c_ns_anchor_char s:c_ns_anchor_name s:c_ns_anchor_property s:c_ns_alias_node s:ns_char s:ns_directive_name s:ns_local_tag_prefix s:ns_global_tag_prefix s:ns_tag_prefix s:c_indicator s:ns_plain_safe_out s:c_flow_indicator s:ns_plain_safe_in s:ns_plain_first_in s:ns_plain_first_out s:ns_plain_char_in s:ns_plain_char_out s:ns_plain_out s:ns_plain_in +unlet s:ns_word_char s:ns_uri_char s:c_verbatim_tag s:c_named_tag_handle s:c_secondary_tag_handle s:c_primary_tag_handle s:c_tag_handle s:ns_tag_char s:c_ns_shorthand_tag s:c_non_specific_tag s:c_ns_tag_property s:c_ns_anchor_char s:c_ns_anchor_name s:c_ns_anchor_property s:c_ns_alias_node s:ns_char s:ns_directive_name s:ns_local_tag_prefix s:ns_global_tag_prefix s:ns_tag_prefix s:c_indicator s:ns_plain_safe_out s:c_flow_indicator s:ns_plain_safe_in s:ns_plain_first_in s:ns_plain_first_out s:ns_plain_char_in s:ns_plain_char_out s:ns_plain_out s:ns_plain_in s:ns_char_without_c_indicator s:ns_plain_safe_in_without_colhash s:ns_plain_safe_out_without_colhash +unlet s:_collection s:_neg_collection +delfunction s:SimplifyAdjacentCollections +delfunction s:SimplifyToAssumeAllPrintable let &cpo = s:cpo_save unlet s:cpo_save - diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim index 97f646b91a..48c7a3535a 100644 --- a/runtime/vimrc_example.vim +++ b/runtime/vimrc_example.vim @@ -34,10 +34,8 @@ augroup vimrcEx " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler - " Also don't do it when the mark is in the first line, that is the default - " position when opening a file. autocmd BufReadPost * - \ if line("'\"") > 1 && line("'\"") <= line("$") | + \ if line("'\"") >= 1 && line("'\"") <= line("$") | \ execute "normal! g`\"" | \ endif diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 219bd38d82..a1c5f958d1 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2890,9 +2890,12 @@ static int do_unlet_var(lval_T *lp, char_u *name_end, int forceit) else if (do_unlet(lp->ll_name, forceit) == FAIL) ret = FAIL; *name_end = cc; - } else if (tv_check_lock(lp->ll_tv->v_lock, lp->ll_name)) + } else if ((lp->ll_list != NULL + && tv_check_lock(lp->ll_list->lv_lock, lp->ll_name)) + || (lp->ll_dict != NULL + && tv_check_lock(lp->ll_dict->dv_lock, lp->ll_name))) { return FAIL; - else if (lp->ll_range) { + } else if (lp->ll_range) { listitem_T *li; listitem_T *ll_li = lp->ll_li; int ll_n1 = lp->ll_n1; @@ -2953,17 +2956,30 @@ int do_unlet(char_u *name, int forceit) hashtab_T *ht; hashitem_T *hi; char_u *varname; + dict_T *d; dictitem_T *di; dict_T *dict; ht = find_var_ht_dict(name, &varname, &dict); if (ht != NULL && *varname != NUL) { + if (ht == &globvarht) { + d = &globvardict; + } else if (current_funccal != NULL + && ht == ¤t_funccal->l_vars.dv_hashtab) { + d = ¤t_funccal->l_vars; + } else { + di = find_var_in_ht(ht, *name, (char_u *)"", false); + d = di->di_tv.vval.v_dict; + } + hi = hash_find(ht, varname); if (!HASHITEM_EMPTY(hi)) { di = HI2DI(hi); if (var_check_fixed(di->di_flags, name) - || var_check_ro(di->di_flags, name)) + || var_check_ro(di->di_flags, name) + || tv_check_lock(d->dv_lock, name)) { return FAIL; + } typval_T oldtv; bool watched = is_watched(dict); @@ -6055,7 +6071,7 @@ dictitem_T *dictitem_alloc(char_u *key) FUNC_ATTR_NONNULL_RET #ifndef __clang_analyzer__ STRCPY(di->di_key, key); #endif - di->di_flags = 0; + di->di_flags = DI_FLAGS_ALLOC; return di; } @@ -6067,7 +6083,7 @@ static dictitem_T *dictitem_copy(dictitem_T *org) FUNC_ATTR_NONNULL_RET dictitem_T *di = xmalloc(sizeof(dictitem_T) + STRLEN(org->di_key)); STRCPY(di->di_key, org->di_key); - di->di_flags = 0; + di->di_flags = DI_FLAGS_ALLOC; copy_tv(&org->di_tv, &di->di_tv); return di; @@ -6095,7 +6111,9 @@ static void dictitem_remove(dict_T *dict, dictitem_T *item) void dictitem_free(dictitem_T *item) { clear_tv(&item->di_tv); - xfree(item); + if (item->di_flags & DI_FLAGS_ALLOC) { + xfree(item); + } } /// Make a copy of dictionary @@ -9212,6 +9230,7 @@ void dict_extend(dict_T *d1, dict_T *d2, char_u *action) hashitem_T *hi2; int todo; bool watched = is_watched(d1); + char *arg_errmsg = N_("extend() argument"); todo = (int)d2->dv_hashtab.ht_used; for (hi2 = d2->dv_hashtab.ht_array; todo > 0; ++hi2) { @@ -9245,6 +9264,11 @@ void dict_extend(dict_T *d1, dict_T *d2, char_u *action) } else if (*action == 'f' && HI2DI(hi2) != di1) { typval_T oldtv; + if (tv_check_lock(di1->di_tv.v_lock, (char_u *)_(arg_errmsg)) + || var_check_ro(di1->di_flags, (char_u *)_(arg_errmsg))) { + break; + } + if (watched) { copy_tv(&di1->di_tv, &oldtv); } @@ -9460,12 +9484,14 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map) if (argvars[0].v_type == VAR_LIST) { if ((l = argvars[0].vval.v_list) == NULL - || tv_check_lock(l->lv_lock, (char_u *)_(arg_errmsg))) + || (!map && tv_check_lock(l->lv_lock, (char_u *)_(arg_errmsg)))) { return; + } } else if (argvars[0].v_type == VAR_DICT) { if ((d = argvars[0].vval.v_dict) == NULL - || tv_check_lock(d->dv_lock, (char_u *)_(arg_errmsg))) + || (!map && tv_check_lock(d->dv_lock, (char_u *)_(arg_errmsg)))) { return; + } } else { EMSG2(_(e_listdictarg), ermsg); return; @@ -9494,17 +9520,26 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map) for (hi = ht->ht_array; todo > 0; ++hi) { if (!HASHITEM_EMPTY(hi)) { --todo; + di = HI2DI(hi); - if (tv_check_lock(di->di_tv.v_lock, - (char_u *)_(arg_errmsg))) + if (map + && (tv_check_lock(di->di_tv.v_lock, (char_u *)_(arg_errmsg)) + || var_check_ro(di->di_flags, (char_u *)_(arg_errmsg)))) { break; + } + vimvars[VV_KEY].vv_str = vim_strsave(di->di_key); int r = filter_map_one(&di->di_tv, expr, map, &rem); clear_tv(&vimvars[VV_KEY].vv_tv); if (r == FAIL || did_emsg) break; - if (!map && rem) + if (!map && rem) { + if (var_check_fixed(di->di_flags, (char_u *)_(arg_errmsg)) + || var_check_ro(di->di_flags, (char_u *)_(arg_errmsg))) { + break; + } dictitem_remove(d, di); + } } } hash_unlock(ht); @@ -9512,8 +9547,9 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map) vimvars[VV_KEY].vv_type = VAR_NUMBER; for (li = l->lv_first; li != NULL; li = nli) { - if (tv_check_lock(li->li_tv.v_lock, (char_u *)_(arg_errmsg))) + if (map && tv_check_lock(li->li_tv.v_lock, (char_u *)_(arg_errmsg))) { break; + } nli = li->li_next; vimvars[VV_KEY].vv_nr = idx; if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL @@ -10786,15 +10822,15 @@ static void f_globpath(typval_T *argvars, typval_T *rettv) } } -/* - * "glob2regpat()" function - */ +// "glob2regpat()" function static void f_glob2regpat(typval_T *argvars, typval_T *rettv) { - char_u *pat = get_tv_string_chk(&argvars[0]); + char_u *pat = get_tv_string_chk(&argvars[0]); // NULL on type error - rettv->v_type = VAR_STRING; - rettv->vval.v_string = file_pat_to_reg_pat(pat, NULL, NULL, FALSE); + rettv->v_type = VAR_STRING; + rettv->vval.v_string = (pat == NULL) + ? NULL + : file_pat_to_reg_pat(pat, NULL, NULL, false); } /* @@ -13878,9 +13914,10 @@ static void f_remove(typval_T *argvars, typval_T *rettv) key = get_tv_string_chk(&argvars[1]); if (key != NULL) { di = dict_find(d, key, -1); - if (di == NULL) + if (di == NULL) { EMSG2(_(e_dictkey), key); - else { + } else if (!var_check_fixed(di->di_flags, (char_u *)_(arg_errmsg)) + && !var_check_ro(di->di_flags, (char_u *)_(arg_errmsg))) { *rettv = di->di_tv; init_tv(&di->di_tv); dictitem_remove(d, di); @@ -18648,14 +18685,16 @@ static void vars_clear_ext(hashtab_T *ht, int free_val) if (!HASHITEM_EMPTY(hi)) { --todo; - /* Free the variable. Don't remove it from the hashtab, - * ht_array might change then. hash_clear() takes care of it - * later. */ + // Free the variable. Don't remove it from the hashtab, + // ht_array might change then. hash_clear() takes care of it + // later. v = HI2DI(hi); - if (free_val) + if (free_val) { clear_tv(&v->di_tv); - if ((v->di_flags & DI_FLAGS_FIX) == 0) + } + if (v->di_flags & DI_FLAGS_ALLOC) { xfree(v); + } } } hash_clear(ht); @@ -18829,7 +18868,7 @@ set_var ( xfree(v); return; } - v->di_flags = 0; + v->di_flags = DI_FLAGS_ALLOC; } if (copy || tv->v_type == VAR_NUMBER || tv->v_type == VAR_FLOAT) { @@ -20720,7 +20759,7 @@ call_user_func ( v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX; } else { v = xmalloc(sizeof(dictitem_T) + STRLEN(name)); - v->di_flags = DI_FLAGS_RO; + v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX | DI_FLAGS_ALLOC; } STRCPY(v->di_key, name); hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v)); diff --git a/src/nvim/eval_defs.h b/src/nvim/eval_defs.h index ed419268d2..cdad1f3197 100644 --- a/src/nvim/eval_defs.h +++ b/src/nvim/eval_defs.h @@ -101,10 +101,11 @@ struct dictitem_S { typedef struct dictitem_S dictitem_T; -#define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */ -#define DI_FLAGS_RO_SBX 2 /* "di_flags" value: read-only in the sandbox */ -#define DI_FLAGS_FIX 4 /* "di_flags" value: fixed variable, not allocated */ -#define DI_FLAGS_LOCK 8 /* "di_flags" value: locked variable */ +#define DI_FLAGS_RO 1 // "di_flags" value: read-only variable +#define DI_FLAGS_RO_SBX 2 // "di_flags" value: read-only in the sandbox +#define DI_FLAGS_FIX 4 // "di_flags" value: fixed: no :unlet or remove() +#define DI_FLAGS_LOCK 8 // "di_flags" value: locked variable +#define DI_FLAGS_ALLOC 16 // "di_flags" value: separately allocated /* * Structure to hold info about a Dictionary. diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index c095a7d27f..badb5b85b0 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -7106,6 +7106,7 @@ char_u * file_pat_to_reg_pat( char *allow_dirs, // Result passed back out in here int no_bslash // Don't use a backward slash as pathsep ) + FUNC_ATTR_NONNULL_ARG(1) { const char_u *endp; char_u *reg_pat; @@ -7118,6 +7119,10 @@ char_u * file_pat_to_reg_pat( if (pat_end == NULL) pat_end = pat + STRLEN(pat); + if (pat_end == pat) { + return (char_u *)xstrdup("^$"); + } + size_t size = 2; // '^' at start, '$' at end. for (p = pat; p < pat_end; p++) { diff --git a/src/nvim/path.c b/src/nvim/path.c index 5ac3d07f67..8b9a49dfc0 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -681,11 +681,16 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, /* remove backslashes for the remaining components only */ (void)do_path_expand(gap, buf, len + 1, flags, false); } else { - /* no more wildcards, check if there is a match */ - /* remove backslashes for the remaining components only */ - if (*path_end != NUL) + FileInfo file_info; + + // no more wildcards, check if there is a match + // remove backslashes for the remaining components only + if (*path_end != NUL) { backslash_halve(buf + len + 1); - if (os_file_exists(buf)) { /* add existing file */ + } + // add existing file or symbolic link + if ((flags & EW_ALLLINKS) ? os_fileinfo_link((char *)buf, &file_info) + : os_file_exists(buf)) { addfile(gap, buf, flags); } } @@ -1294,26 +1299,28 @@ expand_backtick ( return cnt; } -/* - * Add a file to a file list. Accepted flags: - * EW_DIR add directories - * EW_FILE add files - * EW_EXEC add executable files - * EW_NOTFOUND add even when it doesn't exist - * EW_ADDSLASH add slash after directory name - */ -void -addfile ( +// Add a file to a file list. Accepted flags: +// EW_DIR add directories +// EW_FILE add files +// EW_EXEC add executable files +// EW_NOTFOUND add even when it doesn't exist +// EW_ADDSLASH add slash after directory name +// EW_ALLLINKS add symlink also when the referred file does not exist +void addfile( garray_T *gap, char_u *f, /* filename */ int flags ) { bool isdir; + FileInfo file_info; - /* if the file/dir doesn't exist, may not add it */ - if (!(flags & EW_NOTFOUND) && !os_file_exists(f)) + // if the file/dir/link doesn't exist, may not add it + if (!(flags & EW_NOTFOUND) && + ((flags & EW_ALLLINKS) ? + !os_fileinfo_link((char *)f, &file_info) : !os_file_exists(f))) { return; + } #ifdef FNAME_ILLEGAL /* if the file/dir contains illegal characters, don't add it */ diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index e01e812a70..608aa38466 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -796,13 +796,14 @@ static void reg_equi_class(int c) if (enc_utf8 || STRCMP(p_enc, "latin1") == 0 || STRCMP(p_enc, "iso-8859-15") == 0) { switch (c) { - case 'A': case '\300': case '\301': case '\302': + // Do not use '\300' style, it results in a negative number. + case 'A': case 0xc0: case 0xc1: case 0xc2: + case 0xc3: case 0xc4: case 0xc5: CASEMBC(0x100) CASEMBC(0x102) CASEMBC(0x104) CASEMBC(0x1cd) CASEMBC(0x1de) CASEMBC(0x1e0) CASEMBC(0x1ea2) - case '\303': case '\304': case '\305': - regmbc('A'); regmbc('\300'); regmbc('\301'); - regmbc('\302'); regmbc('\303'); regmbc('\304'); - regmbc('\305'); + regmbc('A'); regmbc(0xc0); regmbc(0xc1); + regmbc(0xc2); regmbc(0xc3); regmbc(0xc4); + regmbc(0xc5); REGMBC(0x100) REGMBC(0x102) REGMBC(0x104) REGMBC(0x1cd) REGMBC(0x1de) REGMBC(0x1e0) REGMBC(0x1ea2) @@ -810,9 +811,9 @@ static void reg_equi_class(int c) case 'B': CASEMBC(0x1e02) CASEMBC(0x1e06) regmbc('B'); REGMBC(0x1e02) REGMBC(0x1e06) return; - case 'C': case '\307': + case 'C': case 0xc7: CASEMBC(0x106) CASEMBC(0x108) CASEMBC(0x10a) CASEMBC(0x10c) - regmbc('C'); regmbc('\307'); + regmbc('C'); regmbc(0xc7); REGMBC(0x106) REGMBC(0x108) REGMBC(0x10a) REGMBC(0x10c) return; @@ -821,11 +822,11 @@ static void reg_equi_class(int c) regmbc('D'); REGMBC(0x10e) REGMBC(0x110) REGMBC(0x1e0a) REGMBC(0x1e0e) REGMBC(0x1e10) return; - case 'E': case '\310': case '\311': case '\312': case '\313': + case 'E': case 0xc8: case 0xc9: case 0xca: case 0xcb: CASEMBC(0x112) CASEMBC(0x114) CASEMBC(0x116) CASEMBC(0x118) CASEMBC(0x11a) CASEMBC(0x1eba) CASEMBC(0x1ebc) - regmbc('E'); regmbc('\310'); regmbc('\311'); - regmbc('\312'); regmbc('\313'); + regmbc('E'); regmbc(0xc8); regmbc(0xc9); + regmbc(0xca); regmbc(0xcb); REGMBC(0x112) REGMBC(0x114) REGMBC(0x116) REGMBC(0x118) REGMBC(0x11a) REGMBC(0x1eba) REGMBC(0x1ebc) @@ -845,11 +846,11 @@ static void reg_equi_class(int c) regmbc('H'); REGMBC(0x124) REGMBC(0x126) REGMBC(0x1e22) REGMBC(0x1e26) REGMBC(0x1e28) return; - case 'I': case '\314': case '\315': case '\316': case '\317': + case 'I': case 0xcc: case 0xcd: case 0xce: case 0xcf: CASEMBC(0x128) CASEMBC(0x12a) CASEMBC(0x12c) CASEMBC(0x12e) CASEMBC(0x130) CASEMBC(0x1cf) CASEMBC(0x1ec8) - regmbc('I'); regmbc('\314'); regmbc('\315'); - regmbc('\316'); regmbc('\317'); + regmbc('I'); regmbc(0xcc); regmbc(0xcd); + regmbc(0xce); regmbc(0xcf); REGMBC(0x128) REGMBC(0x12a) REGMBC(0x12c) REGMBC(0x12e) REGMBC(0x130) REGMBC(0x1cf) REGMBC(0x1ec8) @@ -871,20 +872,20 @@ static void reg_equi_class(int c) case 'M': CASEMBC(0x1e3e) CASEMBC(0x1e40) regmbc('M'); REGMBC(0x1e3e) REGMBC(0x1e40) return; - case 'N': case '\321': + case 'N': case 0xd1: CASEMBC(0x143) CASEMBC(0x145) CASEMBC(0x147) CASEMBC(0x1e44) CASEMBC(0x1e48) - regmbc('N'); regmbc('\321'); + regmbc('N'); regmbc(0xd1); REGMBC(0x143) REGMBC(0x145) REGMBC(0x147) REGMBC(0x1e44) REGMBC(0x1e48) return; - case 'O': case '\322': case '\323': case '\324': case '\325': - case '\326': case '\330': + case 'O': case 0xd2: case 0xd3: case 0xd4: case 0xd5: + case 0xd6: case 0xd8: CASEMBC(0x14c) CASEMBC(0x14e) CASEMBC(0x150) CASEMBC(0x1a0) CASEMBC(0x1d1) CASEMBC(0x1ea) CASEMBC(0x1ec) CASEMBC(0x1ece) - regmbc('O'); regmbc('\322'); regmbc('\323'); - regmbc('\324'); regmbc('\325'); regmbc('\326'); - regmbc('\330'); + regmbc('O'); regmbc(0xd2); regmbc(0xd3); + regmbc(0xd4); regmbc(0xd5); regmbc(0xd6); + regmbc(0xd8); REGMBC(0x14c) REGMBC(0x14e) REGMBC(0x150) REGMBC(0x1a0) REGMBC(0x1d1) REGMBC(0x1ea) REGMBC(0x1ec) REGMBC(0x1ece) @@ -907,12 +908,12 @@ static void reg_equi_class(int c) regmbc('T'); REGMBC(0x162) REGMBC(0x164) REGMBC(0x166) REGMBC(0x1e6a) REGMBC(0x1e6e) return; - case 'U': case '\331': case '\332': case '\333': case '\334': + case 'U': case 0xd9: case 0xda: case 0xdb: case 0xdc: CASEMBC(0x168) CASEMBC(0x16a) CASEMBC(0x16c) CASEMBC(0x16e) CASEMBC(0x170) CASEMBC(0x172) CASEMBC(0x1af) CASEMBC(0x1d3) CASEMBC(0x1ee6) - regmbc('U'); regmbc('\331'); regmbc('\332'); - regmbc('\333'); regmbc('\334'); + regmbc('U'); regmbc(0xd9); regmbc(0xda); + regmbc(0xdb); regmbc(0xdc); REGMBC(0x168) REGMBC(0x16a) REGMBC(0x16c) REGMBC(0x16e) REGMBC(0x170) REGMBC(0x172) REGMBC(0x1af) REGMBC(0x1d3) REGMBC(0x1ee6) @@ -928,10 +929,10 @@ static void reg_equi_class(int c) case 'X': CASEMBC(0x1e8a) CASEMBC(0x1e8c) regmbc('X'); REGMBC(0x1e8a) REGMBC(0x1e8c) return; - case 'Y': case '\335': + case 'Y': case 0xdd: CASEMBC(0x176) CASEMBC(0x178) CASEMBC(0x1e8e) CASEMBC(0x1ef2) CASEMBC(0x1ef6) CASEMBC(0x1ef8) - regmbc('Y'); regmbc('\335'); + regmbc('Y'); regmbc(0xdd); REGMBC(0x176) REGMBC(0x178) REGMBC(0x1e8e) REGMBC(0x1ef2) REGMBC(0x1ef6) REGMBC(0x1ef8) return; @@ -941,13 +942,13 @@ static void reg_equi_class(int c) REGMBC(0x17d) REGMBC(0x1b5) REGMBC(0x1e90) REGMBC(0x1e94) return; - case 'a': case '\340': case '\341': case '\342': - case '\343': case '\344': case '\345': + case 'a': case 0xe0: case 0xe1: case 0xe2: + case 0xe3: case 0xe4: case 0xe5: CASEMBC(0x101) CASEMBC(0x103) CASEMBC(0x105) CASEMBC(0x1ce) CASEMBC(0x1df) CASEMBC(0x1e1) CASEMBC(0x1ea3) - regmbc('a'); regmbc('\340'); regmbc('\341'); - regmbc('\342'); regmbc('\343'); regmbc('\344'); - regmbc('\345'); + regmbc('a'); regmbc(0xe0); regmbc(0xe1); + regmbc(0xe2); regmbc(0xe3); regmbc(0xe4); + regmbc(0xe5); REGMBC(0x101) REGMBC(0x103) REGMBC(0x105) REGMBC(0x1ce) REGMBC(0x1df) REGMBC(0x1e1) REGMBC(0x1ea3) @@ -955,9 +956,9 @@ static void reg_equi_class(int c) case 'b': CASEMBC(0x1e03) CASEMBC(0x1e07) regmbc('b'); REGMBC(0x1e03) REGMBC(0x1e07) return; - case 'c': case '\347': + case 'c': case 0xe7: CASEMBC(0x107) CASEMBC(0x109) CASEMBC(0x10b) CASEMBC(0x10d) - regmbc('c'); regmbc('\347'); + regmbc('c'); regmbc(0xe7); REGMBC(0x107) REGMBC(0x109) REGMBC(0x10b) REGMBC(0x10d) return; @@ -966,11 +967,11 @@ static void reg_equi_class(int c) regmbc('d'); REGMBC(0x10f) REGMBC(0x111) REGMBC(0x1e0b) REGMBC(0x1e0f) REGMBC(0x1e11) return; - case 'e': case '\350': case '\351': case '\352': case '\353': + case 'e': case 0xe8: case 0xe9: case 0xea: case 0xeb: CASEMBC(0x113) CASEMBC(0x115) CASEMBC(0x117) CASEMBC(0x119) CASEMBC(0x11b) CASEMBC(0x1ebb) CASEMBC(0x1ebd) - regmbc('e'); regmbc('\350'); regmbc('\351'); - regmbc('\352'); regmbc('\353'); + regmbc('e'); regmbc(0xe8); regmbc(0xe9); + regmbc(0xea); regmbc(0xeb); REGMBC(0x113) REGMBC(0x115) REGMBC(0x117) REGMBC(0x119) REGMBC(0x11b) REGMBC(0x1ebb) REGMBC(0x1ebd) @@ -991,11 +992,11 @@ static void reg_equi_class(int c) REGMBC(0x1e23) REGMBC(0x1e27) REGMBC(0x1e29) REGMBC(0x1e96) return; - case 'i': case '\354': case '\355': case '\356': case '\357': + case 'i': case 0xec: case 0xed: case 0xee: case 0xef: CASEMBC(0x129) CASEMBC(0x12b) CASEMBC(0x12d) CASEMBC(0x12f) CASEMBC(0x1d0) CASEMBC(0x1ec9) - regmbc('i'); regmbc('\354'); regmbc('\355'); - regmbc('\356'); regmbc('\357'); + regmbc('i'); regmbc(0xec); regmbc(0xed); + regmbc(0xee); regmbc(0xef); REGMBC(0x129) REGMBC(0x12b) REGMBC(0x12d) REGMBC(0x12f) REGMBC(0x1d0) REGMBC(0x1ec9) return; @@ -1016,20 +1017,20 @@ static void reg_equi_class(int c) case 'm': CASEMBC(0x1e3f) CASEMBC(0x1e41) regmbc('m'); REGMBC(0x1e3f) REGMBC(0x1e41) return; - case 'n': case '\361': + case 'n': case 0xf1: CASEMBC(0x144) CASEMBC(0x146) CASEMBC(0x148) CASEMBC(0x149) CASEMBC(0x1e45) CASEMBC(0x1e49) - regmbc('n'); regmbc('\361'); + regmbc('n'); regmbc(0xf1); REGMBC(0x144) REGMBC(0x146) REGMBC(0x148) REGMBC(0x149) REGMBC(0x1e45) REGMBC(0x1e49) return; - case 'o': case '\362': case '\363': case '\364': case '\365': - case '\366': case '\370': + case 'o': case 0xf2: case 0xf3: case 0xf4: case 0xf5: + case 0xf6: case 0xf8: CASEMBC(0x14d) CASEMBC(0x14f) CASEMBC(0x151) CASEMBC(0x1a1) CASEMBC(0x1d2) CASEMBC(0x1eb) CASEMBC(0x1ed) CASEMBC(0x1ecf) - regmbc('o'); regmbc('\362'); regmbc('\363'); - regmbc('\364'); regmbc('\365'); regmbc('\366'); - regmbc('\370'); + regmbc('o'); regmbc(0xf2); regmbc(0xf3); + regmbc(0xf4); regmbc(0xf5); regmbc(0xf6); + regmbc(0xf8); REGMBC(0x14d) REGMBC(0x14f) REGMBC(0x151) REGMBC(0x1a1) REGMBC(0x1d2) REGMBC(0x1eb) REGMBC(0x1ed) REGMBC(0x1ecf) @@ -1052,12 +1053,12 @@ static void reg_equi_class(int c) regmbc('t'); REGMBC(0x163) REGMBC(0x165) REGMBC(0x167) REGMBC(0x1e6b) REGMBC(0x1e6f) REGMBC(0x1e97) return; - case 'u': case '\371': case '\372': case '\373': case '\374': + case 'u': case 0xf9: case 0xfa: case 0xfb: case 0xfc: CASEMBC(0x169) CASEMBC(0x16b) CASEMBC(0x16d) CASEMBC(0x16f) CASEMBC(0x171) CASEMBC(0x173) CASEMBC(0x1b0) CASEMBC(0x1d4) CASEMBC(0x1ee7) - regmbc('u'); regmbc('\371'); regmbc('\372'); - regmbc('\373'); regmbc('\374'); + regmbc('u'); regmbc(0xf9); regmbc(0xfa); + regmbc(0xfb); regmbc(0xfc); REGMBC(0x169) REGMBC(0x16b) REGMBC(0x16d) REGMBC(0x16f) REGMBC(0x171) REGMBC(0x173) REGMBC(0x1b0) REGMBC(0x1d4) REGMBC(0x1ee7) @@ -1074,10 +1075,10 @@ static void reg_equi_class(int c) case 'x': CASEMBC(0x1e8b) CASEMBC(0x1e8d) regmbc('x'); REGMBC(0x1e8b) REGMBC(0x1e8d) return; - case 'y': case '\375': case '\377': + case 'y': case 0xfd: case 0xff: CASEMBC(0x177) CASEMBC(0x1e8f) CASEMBC(0x1e99) CASEMBC(0x1ef3) CASEMBC(0x1ef7) CASEMBC(0x1ef9) - regmbc('y'); regmbc('\375'); regmbc('\377'); + regmbc('y'); regmbc(0xfd); regmbc(0xff); REGMBC(0x177) REGMBC(0x1e8f) REGMBC(0x1e99) REGMBC(0x1ef3) REGMBC(0x1ef7) REGMBC(0x1ef9) return; diff --git a/src/nvim/strings.c b/src/nvim/strings.c index fe91141375..37a0fb82da 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -425,9 +425,13 @@ char_u *vim_strchr(const char_u *string, int c) const char_u *p = string; if (enc_utf8 && c >= 0x80) { while (*p != NUL) { - if (utf_ptr2char(p) == c) + int l = (*mb_ptr2len)(p); + + // Avoid matching an illegal byte here. + if (l > 1 && utf_ptr2char(p) == c) { return (char_u *) p; - p += (*mb_ptr2len)(p); + } + p += l; } return NULL; } diff --git a/src/nvim/testdir/test55.in b/src/nvim/testdir/test55.in index c4e82d429c..7b6f684caa 100644 --- a/src/nvim/testdir/test55.in +++ b/src/nvim/testdir/test55.in @@ -282,6 +282,166 @@ let l = [0, 1, 2, 3] : $put =ps : endfor :endfor +:" +:" Unletting locked variables +:$put ='Unletting:' +:for depth in range(5) +: $put ='depth is ' . depth +: for u in range(3) +: unlet l +: let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}] +: exe "lockvar " . depth . " l" +: if u == 1 +: exe "unlockvar l" +: elseif u == 2 +: exe "unlockvar " . depth . " l" +: endif +: let ps = islocked("l").islocked("l[1]").islocked("l[1][1]").islocked("l[1][1][0]").'-'.islocked("l[2]").islocked("l[2]['6']").islocked("l[2]['6'][7]") +: $put =ps +: let ps = '' +: try +: unlet l[2]['6'][7] +: let ps .= 'p' +: catch +: let ps .= 'F' +: endtry +: try +: unlet l[2][6] +: let ps .= 'p' +: catch +: let ps .= 'F' +: endtry +: try +: unlet l[2] +: let ps .= 'p' +: catch +: let ps .= 'F' +: endtry +: try +: unlet l[1][1][0] +: let ps .= 'p' +: catch +: let ps .= 'F' +: endtry +: try +: unlet l[1][1] +: let ps .= 'p' +: catch +: let ps .= 'F' +: endtry +: try +: unlet l[1] +: let ps .= 'p' +: catch +: let ps .= 'F' +: endtry +: try +: unlet l +: let ps .= 'p' +: catch +: let ps .= 'F' +: endtry +: $put =ps +: endfor +:endfor +:" +:" Locked variables and :unlet or list / dict functions +:$put ='Locks and commands or functions:' +:" +:$put ='No :unlet after lock on dict:' +:unlet! d +:let d = {'a': 99, 'b': 100} +:lockvar 1 d +:try +: unlet d.a +: $put ='did :unlet' +:catch +: $put =v:exception[:16] +:endtry +:$put =string(d) +:" +:$put =':unlet after lock on dict item:' +:unlet! d +:let d = {'a': 99, 'b': 100} +:lockvar d.a +:try +: unlet d.a +: $put ='did :unlet' +:catch +: $put =v:exception[:16] +:endtry +:$put =string(d) +:" +:$put ='filter() after lock on dict item:' +:unlet! d +:let d = {'a': 99, 'b': 100} +:lockvar d.a +:try +: call filter(d, 'v:key != "a"') +: $put ='did filter()' +:catch +: $put =v:exception[:16] +:endtry +:$put =string(d) +:" +:$put ='map() after lock on dict:' +:unlet! d +:let d = {'a': 99, 'b': 100} +:lockvar 1 d +:try +: call map(d, 'v:val + 200') +: $put ='did map()' +:catch +: $put =v:exception[:16] +:endtry +:$put =string(d) +:" +:$put ='No extend() after lock on dict item:' +:unlet! d +:let d = {'a': 99, 'b': 100} +:lockvar d.a +:try +: $put =string(extend(d, {'a': 123})) +: $put ='did extend()' +:catch +: $put =v:exception[:14] +:endtry +:$put =string(d) +:" +:$put ='No remove() of write-protected scope-level variable:' +:fun! Tfunc(this_is_a_loooooooooong_parameter_name) +: try +: $put =string(remove(a:, 'this_is_a_loooooooooong_parameter_name')) +: $put ='did remove()' +: catch +: $put =v:exception[:14] +: endtry +:endfun +:call Tfunc('testval') +:" +:$put ='No extend() of write-protected scope-level variable:' +:fun! Tfunc(this_is_a_loooooooooong_parameter_name) +: try +: $put =string(extend(a:, {'this_is_a_loooooooooong_parameter_name': 1234})) +: $put ='did extend()' +: catch +: $put =v:exception[:14] +: endtry +:endfun +:call Tfunc('testval') +:" +:$put ='No :unlet of variable in locked scope:' +:let b:testvar = 123 +:lockvar 1 b: +:try +: unlet b:testvar +: $put ='b:testvar was :unlet: '. (!exists('b:testvar')) +:catch +: $put =v:exception[:16] +:endtry +:unlockvar 1 b: +:unlet! b:testvar +:" :unlet l :let l = [1, 2, 3, 4] :lockvar! l diff --git a/src/nvim/testdir/test55.ok b/src/nvim/testdir/test55.ok index ba029b2898..4e0303c26e 100644 --- a/src/nvim/testdir/test55.ok +++ b/src/nvim/testdir/test55.ok @@ -86,6 +86,64 @@ FFFFFFF FFpFFpp 0000-000 ppppppp +Unletting: +depth is 0 +0000-000 +ppppppp +0000-000 +ppppppp +0000-000 +ppppppp +depth is 1 +1000-000 +ppFppFp +0000-000 +ppppppp +0000-000 +ppppppp +depth is 2 +1100-100 +pFFpFFp +0000-000 +ppppppp +0000-000 +ppppppp +depth is 3 +1110-110 +FFFFFFp +0010-010 +FppFppp +0000-000 +ppppppp +depth is 4 +1111-111 +FFFFFFp +0011-011 +FppFppp +0000-000 +ppppppp +Locks and commands or functions: +No :unlet after lock on dict: +Vim(unlet):E741: +{'a': 99, 'b': 100} +:unlet after lock on dict item: +did :unlet +{'b': 100} +filter() after lock on dict item: +did filter() +{'b': 100} +map() after lock on dict: +did map() +{'a': 299, 'b': 300} +No extend() after lock on dict item: +Vim(put):E741: +{'a': 99, 'b': 100} +No remove() of write-protected scope-level variable: +Vim(put):E795: +No extend() of write-protected scope-level variable: +Vim(put):E742: +No :unlet of variable in locked scope: +Vim(unlet):E741: [1, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4] diff --git a/src/nvim/version.c b/src/nvim/version.c index dcd1773a7a..0d62445483 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -69,6 +69,16 @@ static char *features[] = { // clang-format off static int included_patches[] = { + 1137, + + + + 1081, + + + + + 1055, // 1054, // 1053, @@ -420,13 +430,13 @@ static int included_patches[] = { 707, 706, // 705 NA - // 704, + 704, // 703 NA 702, // 701 NA // 700, 699, - // 698, + 698, // 697, 696, 695, @@ -468,7 +478,7 @@ static int included_patches[] = { 659, 658, // 657 NA - // 656, + 656, 655, 654, 653, diff --git a/src/nvim/window.c b/src/nvim/window.c index 853f8755c3..191cb04d75 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1913,9 +1913,16 @@ int win_close(win_T *win, int free_buf) */ if (win->w_buffer != NULL) { win->w_closing = true; - close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE); - if (win_valid(win)) + close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, true); + if (win_valid(win)) { win->w_closing = false; + } + + // Make sure curbuf is valid. It can become invalid if 'bufhidden' is + // "wipe". + if (!buf_valid(curbuf)) { + curbuf = firstbuf; + } } if (only_one_window() && win_valid(win) && win->w_buffer == NULL diff --git a/test/functional/legacy/glob2regpat_spec.lua b/test/functional/legacy/glob2regpat_spec.lua new file mode 100644 index 0000000000..357128bcb6 --- /dev/null +++ b/test/functional/legacy/glob2regpat_spec.lua @@ -0,0 +1,22 @@ +-- Tests for signs + +local helpers = require('test.functional.helpers') +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect +local eq, neq, eval = helpers.eq, helpers.neq, helpers.eval + +describe('glob2regpat()', function() + before_each(clear) + + it('handles invalid input', function() + execute('call glob2regpat(1.33)') + helpers.feed('<cr>') + neq(nil, string.find(eval('v:errmsg'), '^E806:')) + end) + it('returns ^$ for empty input', function() + eq('^$', eval("glob2regpat('')")) + end) + it('handles valid input', function() + eq('^foo\\.', eval("glob2regpat('foo.*')")) + eq('\\.vim$', eval("glob2regpat('*.vim')")) + end) +end) diff --git a/test/functional/legacy/quickfix_spec.lua b/test/functional/legacy/quickfix_spec.lua new file mode 100644 index 0000000000..7a9958b949 --- /dev/null +++ b/test/functional/legacy/quickfix_spec.lua @@ -0,0 +1,18 @@ +-- Test for the quickfix commands. + +local helpers = require('test.functional.helpers') +local insert, source = helpers.insert, helpers.source +local clear, expect = helpers.clear, helpers.expect + +describe('helpgrep', function() + before_each(clear) + + it('works', function() + source([[ + helpgrep quickfix + copen + " This wipes out the buffer, make sure that doesn't cause trouble. + cclose + ]]) + end) +end) |