aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/tutor.vim3
-rw-r--r--runtime/doc/autocmd.txt9
-rw-r--r--runtime/doc/eval.txt16
-rw-r--r--runtime/doc/help.txt13
-rw-r--r--runtime/doc/options.txt5
-rw-r--r--runtime/doc/syntax.txt28
-rw-r--r--runtime/doc/usr_02.txt6
-rw-r--r--runtime/filetype.vim4
-rw-r--r--runtime/ftplugin/j.vim7
-rw-r--r--runtime/indent/html.vim41
-rw-r--r--runtime/syntax/c.vim22
-rw-r--r--runtime/syntax/cpp.vim15
-rw-r--r--runtime/syntax/upstreamdat.vim11
-rw-r--r--runtime/syntax/upstreamrpt.vim310
-rw-r--r--runtime/syntax/usw2kagtlog.vim10
-rw-r--r--runtime/syntax/yaml.vim104
-rw-r--r--runtime/vimrc_example.vim4
-rw-r--r--src/nvim/charset.c11
-rw-r--r--src/nvim/edit.c64
-rw-r--r--src/nvim/eval.c37
-rw-r--r--src/nvim/ex_getln.c3
-rw-r--r--src/nvim/ex_getln.h19
-rw-r--r--src/nvim/fileio.c2
-rw-r--r--src/nvim/message.c3
-rw-r--r--src/nvim/path.c39
-rw-r--r--src/nvim/path.h1
-rw-r--r--src/nvim/regexp_nfa.c52
-rw-r--r--src/nvim/screen.c3
-rw-r--r--src/nvim/search.c50
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/test83-tags22
-rw-r--r--src/nvim/testdir/test83-tags3102
-rw-r--r--src/nvim/testdir/test83.in75
-rw-r--r--src/nvim/testdir/test83.ok4
-rw-r--r--src/nvim/version.c10
-rw-r--r--src/nvim/window.c291
-rw-r--r--test/functional/legacy/083_tag_search_with_file_encoding_spec.lua110
-rw-r--r--test/functional/legacy/erasebackword_spec.lua24
38 files changed, 997 insertions, 514 deletions
diff --git a/runtime/autoload/tutor.vim b/runtime/autoload/tutor.vim
index 4d5a10a97c..43d8a87886 100644
--- a/runtime/autoload/tutor.vim
+++ b/runtime/autoload/tutor.vim
@@ -251,13 +251,14 @@ endfunction
" Tutor Cmd: {{{1
function! s:Locale()
- let l:lang = ""
if exists('v:lang') && v:lang =~ '\a\a'
let l:lang = v:lang
elseif $LC_ALL =~ '\a\a'
let l:lang = $LC_ALL
elseif $LANG =~ '\a\a'
let l:lang = $LANG
+ else
+ let l:lang = 'en_US'
endif
return split(l:lang, '_')
endfunction
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..3d44ed83d7 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 11
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|
@@ -170,6 +171,16 @@ Standard plugins ~
|pi_zip.txt| Zip archive explorer
LOCAL ADDITIONS: *local-additions*
+|Mines.txt| The Mines Game Jul 30, 2009
+|Tabular.txt| Configurable, flexible, intuitive text aligning
+|cecutil.txt| DrChip's Utilities Jun 11, 2004
+|example.txt| Example for a locally added help file
+|matchit.txt| Extended "%" matching
+|pi_netrw.txt| For Vim version 7.4. Last change: 2014 Jul 09
+|synchk.txt| Syntax Checker May 15, 2013
+|test.txt| Testing the hélp cömmånd nôw
+|typecorr.txt| Plugin for correcting typing mistakes
+|helpp.txt| Dummy line to avoid an error message
------------------------------------------------------------------------------
*bars* Bars example
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 013e7c742c..bbd9cc1e2b 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -3984,8 +3984,9 @@ A jump table for the options with a short description can be found at |Q_op|.
conceal:c Character to show in place of concealed text, when
'conceallevel' is set to 1. A space when omitted.
*lcs-nbsp*
- nbsp:c Character to show for a non-breakable space (character
- 0xA0, 160). Left blank when omitted.
+ nbsp:c Character to show for a non-breakable space character
+ (0xA0 (160 decimal) and U+202F). Left blank when
+ omitted.
The characters ':' and ',' should not be used. UTF-8 characters can
be used when 'encoding' is "utf-8", otherwise only printable
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/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/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/charset.c b/src/nvim/charset.c
index e0c9443511..9c63eca1f2 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -1791,7 +1791,6 @@ void vim_str2nr(char_u *start, int *prep, int *len,
int pre = 0; // default is decimal
int negative = false;
unsigned long un = 0;
- int n;
if (ptr[0] == '-') {
negative = true;
@@ -1818,7 +1817,7 @@ void vim_str2nr(char_u *start, int *prep, int *len,
if (dooct) {
// Don't interpret "0", "08" or "0129" as octal.
- for (n = 1; ascii_isdigit(ptr[n]); ++n) {
+ for (int n = 1; ascii_isdigit(ptr[n]); ++n) {
if (ptr[n] > '7') {
// can't be octal
pre = 0;
@@ -1836,9 +1835,6 @@ void vim_str2nr(char_u *start, int *prep, int *len,
// Do the string-to-numeric conversion "manually" to avoid sscanf quirks.
if ((pre == 'B') || (pre == 'b') || (dobin > 1)) {
// bin
- if (pre != 0) {
- n += 2; // skip over "0b"
- }
while ('0' <= *ptr && *ptr <= '1') {
un = 2 * un + (unsigned long)(*ptr - '0');
ptr++;
@@ -1849,11 +1845,8 @@ void vim_str2nr(char_u *start, int *prep, int *len,
un = 8 * un + (unsigned long)(*ptr - '0');
ptr++;
}
- } else if (pre != 0 || dohex > 1) {
+ } else if ((pre == 'X') || (pre == 'x') || dohex > 1) {
// hex
- if (pre != 0) {
- n += 2; // skip over "0x"
- }
while (ascii_isxdigit(*ptr)) {
un = 16 * un + (unsigned long)hex2nr(*ptr);
ptr++;
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index ccfc9b4803..dbbcf4f1b9 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -7586,27 +7586,35 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
* happen when using 'sts' and 'linebreak'. */
if (vcol >= start_vcol)
ins_bs_one(&vcol);
- }
- /*
- * Delete upto starting point, start of line or previous word.
- */
- else do {
- if (!revins_on) /* put cursor on char to be deleted */
- dec_cursor();
- /* start of word? */
- if (mode == BACKSPACE_WORD && !ascii_isspace(gchar_cursor())) {
- mode = BACKSPACE_WORD_NOT_SPACE;
- temp = vim_iswordc(gchar_cursor());
+ // Delete upto starting point, start of line or previous word.
+ } else {
+ int cclass = 0, prev_cclass = 0;
+
+ if (has_mbyte) {
+ cclass = mb_get_class(get_cursor_pos_ptr());
+ }
+ do {
+ if (!revins_on) { // put cursor on char to be deleted
+ dec_cursor();
}
- /* end of word? */
- else if (mode == BACKSPACE_WORD_NOT_SPACE
- && (ascii_isspace(cc = gchar_cursor())
- || vim_iswordc(cc) != temp)) {
- if (!revins_on)
+ cc = gchar_cursor();
+ // look multi-byte character class
+ if (has_mbyte) {
+ prev_cclass = cclass;
+ cclass = mb_get_class(get_cursor_pos_ptr());
+ }
+ if (mode == BACKSPACE_WORD && !ascii_isspace(cc)) { // start of word?
+ mode = BACKSPACE_WORD_NOT_SPACE;
+ temp = vim_iswordc(cc);
+ } else if (mode == BACKSPACE_WORD_NOT_SPACE
+ && ((ascii_isspace(cc) || vim_iswordc(cc) != temp)
+ || prev_cclass != cclass)) { // end of word?
+ if (!revins_on) {
inc_cursor();
- else if (State & REPLACE_FLAG)
+ } else if (State & REPLACE_FLAG) {
dec_cursor();
+ }
break;
}
if (State & REPLACE_FLAG)
@@ -7639,18 +7647,18 @@ static int ins_bs(int c, int mode, int *inserted_space_p)
(curwin->w_cursor.col > mincol
&& (curwin->w_cursor.lnum != Insstart_orig.lnum
|| curwin->w_cursor.col != Insstart_orig.col)));
- did_backspace = TRUE;
+ }
+ did_backspace = true;
}
- did_si = FALSE;
- can_si = FALSE;
- can_si_back = FALSE;
- if (curwin->w_cursor.col <= 1)
- did_ai = FALSE;
- /*
- * It's a little strange to put backspaces into the redo
- * buffer, but it makes auto-indent a lot easier to deal
- * with.
- */
+ did_si = false;
+ can_si = false;
+ can_si_back = false;
+ if (curwin->w_cursor.col <= 1) {
+ did_ai = false;
+ }
+ // It's a little strange to put backspaces into the redo
+ // buffer, but it makes auto-indent a lot easier to deal
+ // with.
AppendCharToRedobuff(c);
/* If deleted before the insertion point, adjust it */
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index a5a8671697..219bd38d82 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -4638,10 +4638,13 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
int n, nr;
int c = toupper(*p);
- if (c == 'X')
+ if (c == 'X') {
n = 2;
- else
+ } else if (*p == 'u') {
n = 4;
+ } else {
+ n = 8;
+ }
nr = 0;
while (--n >= 0 && ascii_isxdigit(p[1])) {
++p;
@@ -7188,9 +7191,9 @@ static struct fst {
{ "getwinposx", 0, 0, f_getwinposx },
{ "getwinposy", 0, 0, f_getwinposy },
{ "getwinvar", 2, 3, f_getwinvar },
- { "glob", 1, 3, f_glob },
+ { "glob", 1, 4, f_glob },
{ "glob2regpat", 1, 1, f_glob2regpat },
- { "globpath", 2, 4, f_globpath },
+ { "globpath", 2, 5, f_globpath },
{ "has", 1, 1, f_has },
{ "has_key", 2, 2, f_has_key },
{ "haslocaldir", 0, 0, f_haslocaldir },
@@ -10701,10 +10704,15 @@ static void f_glob(typval_T *argvars, typval_T *rettv)
if (argvars[1].v_type != VAR_UNKNOWN) {
if (get_tv_number_chk(&argvars[1], &error))
options |= WILD_KEEP_ALL;
- if (argvars[2].v_type != VAR_UNKNOWN
- && get_tv_number_chk(&argvars[2], &error)) {
- rettv->v_type = VAR_LIST;
- rettv->vval.v_list = NULL;
+ if (argvars[2].v_type != VAR_UNKNOWN) {
+ if (get_tv_number_chk(&argvars[2], &error)) {
+ rettv->v_type = VAR_LIST;
+ rettv->vval.v_list = NULL;
+ }
+ if (argvars[3].v_type != VAR_UNKNOWN
+ && get_tv_number_chk(&argvars[3], &error)) {
+ options |= WILD_ALLLINKS;
+ }
}
}
if (!error) {
@@ -10743,10 +10751,15 @@ static void f_globpath(typval_T *argvars, typval_T *rettv)
flags |= WILD_KEEP_ALL;
}
- if (argvars[3].v_type != VAR_UNKNOWN
- && get_tv_number_chk(&argvars[3], &error)) {
- rettv->v_type = VAR_LIST;
- rettv->vval.v_list = NULL;
+ if (argvars[3].v_type != VAR_UNKNOWN) {
+ if (get_tv_number_chk(&argvars[3], &error)) {
+ rettv->v_type = VAR_LIST;
+ rettv->vval.v_list = NULL;
+ }
+ if (argvars[4].v_type != VAR_UNKNOWN
+ && get_tv_number_chk(&argvars[4], &error)) {
+ flags |= WILD_ALLLINKS;
+ }
}
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 87a6bf8901..b19331ad06 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -3701,6 +3701,9 @@ ExpandFromContext (
flags |= EW_KEEPALL;
if (options & WILD_SILENT)
flags |= EW_SILENT;
+ if (options & WILD_ALLLINKS) {
+ flags |= EW_ALLLINKS;
+ }
if (xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_DIRECTORIES
diff --git a/src/nvim/ex_getln.h b/src/nvim/ex_getln.h
index c537d681c6..21da8b9d42 100644
--- a/src/nvim/ex_getln.h
+++ b/src/nvim/ex_getln.h
@@ -14,15 +14,16 @@
#define WILD_LONGEST 7
#define WILD_ALL_KEEP 8
-#define WILD_LIST_NOTFOUND 1
-#define WILD_HOME_REPLACE 2
-#define WILD_USE_NL 4
-#define WILD_NO_BEEP 8
-#define WILD_ADD_SLASH 16
-#define WILD_KEEP_ALL 32
-#define WILD_SILENT 64
-#define WILD_ESCAPE 128
-#define WILD_ICASE 256
+#define WILD_LIST_NOTFOUND 0x01
+#define WILD_HOME_REPLACE 0x02
+#define WILD_USE_NL 0x04
+#define WILD_NO_BEEP 0x08
+#define WILD_ADD_SLASH 0x10
+#define WILD_KEEP_ALL 0x20
+#define WILD_SILENT 0x40
+#define WILD_ESCAPE 0x80
+#define WILD_ICASE 0x100
+#define WILD_ALLLINKS 0x200
/// Present history tables
typedef enum {
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 26376afa27..c095a7d27f 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -6305,7 +6305,7 @@ bool has_event(int event) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
/// @param force When true, ignore autocmd_busy
/// @param group autocmd group ID or AUGROUP_ALL
/// @param buf Buffer for <abuf>
-/// @param exarg Ex command arguments
+/// @param eap Ex command arguments
///
/// @return true if some commands were executed.
static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 00f4c0a85c..1dd71baaa4 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -1396,7 +1396,8 @@ void msg_prt_line(char_u *s, int list)
c = *p_extra++;
} else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1) {
col += (*mb_ptr2cells)(s);
- if (lcs_nbsp != NUL && list && mb_ptr2char(s) == 160) {
+ if (lcs_nbsp != NUL && list
+ && (mb_ptr2char(s) == 160 || mb_ptr2char(s) == 0x202f)) {
mb_char2bytes(lcs_nbsp, buf);
buf[(*mb_ptr2len)(buf)] = NUL;
} else {
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/path.h b/src/nvim/path.h
index 628ea335ed..eac367d0ac 100644
--- a/src/nvim/path.h
+++ b/src/nvim/path.h
@@ -20,6 +20,7 @@
#define EW_KEEPDOLLAR 0x800 /* do not escape $, $var is expanded */
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
* is used when executing commands and EW_SILENT for interactive expanding. */
+#define EW_ALLLINKS 0x1000 // also links not pointing to existing file
/// Return value for the comparison of two files. Also @see path_full_compare.
typedef enum file_comparison {
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index 1fd024a062..4020fa6e28 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -4762,48 +4762,54 @@ static int skip_to_start(int c, colnr_T *colp)
*/
static long find_match_text(colnr_T startcol, int regstart, char_u *match_text)
{
- colnr_T col = startcol;
- int c1, c2;
- int len1, len2;
- int match;
+#define PTR2LEN(x) enc_utf8 ? utf_ptr2len(x) : MB_PTR2LEN(x)
- for (;; ) {
- match = TRUE;
- len2 = MB_CHAR2LEN(regstart); /* skip regstart */
- for (len1 = 0; match_text[len1] != NUL; len1 += MB_CHAR2LEN(c1)) {
- c1 = PTR2CHAR(match_text + len1);
- c2 = PTR2CHAR(regline + col + len2);
- if (c1 != c2 && (!ireg_ic || vim_tolower(c1) != vim_tolower(c2))) {
- match = FALSE;
+ colnr_T col = startcol;
+ int regstart_len = PTR2LEN(regline + startcol);
+
+ for (;;) {
+ bool match = true;
+ char_u *s1 = match_text;
+ char_u *s2 = regline + col + regstart_len; // skip regstart
+ while (*s1) {
+ int c1_len = PTR2LEN(s1);
+ int c1 = PTR2CHAR(s1);
+ int c2_len = PTR2LEN(s2);
+ int c2 = PTR2CHAR(s2);
+
+ if ((c1 != c2 && (!ireg_ic || vim_tolower(c1) != vim_tolower(c2))) ||
+ c1_len != c2_len) {
+ match = false;
break;
}
- len2 += MB_CHAR2LEN(c2);
+ s1 += c1_len;
+ s2 += c2_len;
}
if (match
- /* check that no composing char follows */
- && !(enc_utf8
- && STRLEN(regline) > (size_t)(col + len2)
- && utf_iscomposing(PTR2CHAR(regline + col + len2)))
- ) {
+ // check that no composing char follows
+ && !(enc_utf8 && utf_iscomposing(PTR2CHAR(s2)))) {
cleanup_subexpr();
if (REG_MULTI) {
reg_startpos[0].lnum = reglnum;
reg_startpos[0].col = col;
reg_endpos[0].lnum = reglnum;
- reg_endpos[0].col = col + len2;
+ reg_endpos[0].col = s2 - regline;
} else {
reg_startp[0] = regline + col;
- reg_endp[0] = regline + col + len2;
+ reg_endp[0] = s2;
}
return 1L;
}
- /* Try finding regstart after the current match. */
- col += MB_CHAR2LEN(regstart); /* skip regstart */
- if (skip_to_start(regstart, &col) == FAIL)
+ // Try finding regstart after the current match.
+ col += regstart_len; // skip regstart
+ if (skip_to_start(regstart, &col) == FAIL) {
break;
+ }
}
return 0L;
+
+#undef PTR2LEN
}
/*
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 9a64a7c3a9..c6d1ea790e 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -3202,7 +3202,8 @@ win_line (
// 'list': change char 160 to lcs_nbsp and space to lcs_space.
if (wp->w_p_list
- && (((c == 160 || (mb_utf8 && mb_c == 160)) && lcs_nbsp)
+ && (((c == 160 || (mb_utf8 && (mb_c == 160 || mb_c == 0x202f)))
+ && lcs_nbsp)
|| (c == ' ' && lcs_space && ptr - line <= trailcol))) {
c = (c == ' ') ? lcs_space : lcs_nbsp;
if (area_attr == 0 && search_attr == 0) {
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 18a72524cb..d393ee7d02 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -621,43 +621,39 @@ int searchit(
break;
}
matchcol = endpos.col;
- /* for empty match: advance one char */
- if (matchcol == matchpos.col
- && ptr[matchcol] != NUL) {
- if (has_mbyte)
- matchcol +=
- (*mb_ptr2len)(ptr + matchcol);
- else
- ++matchcol;
- }
+ // for empty match (matchcol == matchpos.col): advance one char
} else {
+ // Prepare to start after first matched character.
matchcol = matchpos.col;
- if (ptr[matchcol] != NUL) {
- if (has_mbyte)
- matchcol += (*mb_ptr2len)(ptr
- + matchcol);
- else
- ++matchcol;
- }
}
- if (matchcol == 0 && (options & SEARCH_START))
+
+ if (matchcol == matchpos.col && ptr[matchcol] != NUL) {
+ matchcol += MB_PTR2LEN(ptr + matchcol);
+ }
+
+ if (matchcol == 0 && (options & SEARCH_START)) {
break;
- if (STRLEN(ptr) <= (size_t)matchcol || ptr[matchcol] == NUL
- || (nmatched = vim_regexec_multi(&regmatch,
- win, buf, lnum + matchpos.lnum,
- matchcol,
- tm
- )) == 0) {
- match_ok = FALSE;
+ }
+
+ if (ptr[matchcol] == NUL ||
+ (nmatched = vim_regexec_multi(&regmatch, win, buf, lnum,
+ matchcol, tm)) == 0) {
+ match_ok = false;
break;
}
matchpos = regmatch.startpos[0];
endpos = regmatch.endpos[0];
submatch = first_submatch(&regmatch);
- /* Need to get the line pointer again, a
- * multi-line search may have made it invalid. */
- ptr = ml_get_buf(buf, lnum + matchpos.lnum, FALSE);
+ // This while-loop only works with matchpos.lnum == 0.
+ // For bigger values the next line pointer ptr might not be a
+ // buffer line.
+ if (matchpos.lnum != 0) {
+ break;
+ }
+ // Need to get the line pointer again, a multi-line search may
+ // have made it invalid.
+ ptr = ml_get_buf(buf, lnum, false);
}
if (!match_ok)
continue;
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index aaa6f4b97e..e27ac227c8 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -22,7 +22,6 @@ SCRIPTS := test_eval.out \
test68.out test69.out \
test73.out \
test79.out \
- test83.out \
test88.out \
test_listlbr.out \
test_breakindent.out \
diff --git a/src/nvim/testdir/test83-tags2 b/src/nvim/testdir/test83-tags2
deleted file mode 100644
index 7f9f21b0eb..0000000000
--- a/src/nvim/testdir/test83-tags2
+++ /dev/null
@@ -1,2 +0,0 @@
-!_TAG_FILE_ENCODING cp932 //
-`ab Xtags2.txt /`ab
diff --git a/src/nvim/testdir/test83-tags3 b/src/nvim/testdir/test83-tags3
deleted file mode 100644
index 0cb6591562..0000000000
--- a/src/nvim/testdir/test83-tags3
+++ /dev/null
@@ -1,102 +0,0 @@
-!_TAG_FILE_SORTED 1 //
-!_TAG_FILE_ENCODING cp932 //
-abc1 Xtags3.txt /`ab
-abc2 Xtags3.txt /`ab
-abc3 Xtags3.txt /`ab
-abc4 Xtags3.txt /`ab
-abc5 Xtags3.txt /`ab
-abc6 Xtags3.txt /`ab
-abc7 Xtags3.txt /`ab
-abc8 Xtags3.txt /`ab
-abc9 Xtags3.txt /`ab
-abc10 Xtags3.txt /`ab
-abc11 Xtags3.txt /`ab
-abc12 Xtags3.txt /`ab
-abc13 Xtags3.txt /`ab
-abc14 Xtags3.txt /`ab
-abc15 Xtags3.txt /`ab
-abc16 Xtags3.txt /`ab
-abc17 Xtags3.txt /`ab
-abc18 Xtags3.txt /`ab
-abc19 Xtags3.txt /`ab
-abc20 Xtags3.txt /`ab
-abc21 Xtags3.txt /`ab
-abc22 Xtags3.txt /`ab
-abc23 Xtags3.txt /`ab
-abc24 Xtags3.txt /`ab
-abc25 Xtags3.txt /`ab
-abc26 Xtags3.txt /`ab
-abc27 Xtags3.txt /`ab
-abc28 Xtags3.txt /`ab
-abc29 Xtags3.txt /`ab
-abc30 Xtags3.txt /`ab
-abc31 Xtags3.txt /`ab
-abc32 Xtags3.txt /`ab
-abc33 Xtags3.txt /`ab
-abc34 Xtags3.txt /`ab
-abc35 Xtags3.txt /`ab
-abc36 Xtags3.txt /`ab
-abc37 Xtags3.txt /`ab
-abc38 Xtags3.txt /`ab
-abc39 Xtags3.txt /`ab
-abc40 Xtags3.txt /`ab
-abc41 Xtags3.txt /`ab
-abc42 Xtags3.txt /`ab
-abc43 Xtags3.txt /`ab
-abc44 Xtags3.txt /`ab
-abc45 Xtags3.txt /`ab
-abc46 Xtags3.txt /`ab
-abc47 Xtags3.txt /`ab
-abc48 Xtags3.txt /`ab
-abc49 Xtags3.txt /`ab
-abc50 Xtags3.txt /`ab
-abc51 Xtags3.txt /`ab
-abc52 Xtags3.txt /`ab
-abc53 Xtags3.txt /`ab
-abc54 Xtags3.txt /`ab
-abc55 Xtags3.txt /`ab
-abc56 Xtags3.txt /`ab
-abc57 Xtags3.txt /`ab
-abc58 Xtags3.txt /`ab
-abc59 Xtags3.txt /`ab
-abc60 Xtags3.txt /`ab
-abc61 Xtags3.txt /`ab
-abc62 Xtags3.txt /`ab
-abc63 Xtags3.txt /`ab
-abc64 Xtags3.txt /`ab
-abc65 Xtags3.txt /`ab
-abc66 Xtags3.txt /`ab
-abc67 Xtags3.txt /`ab
-abc68 Xtags3.txt /`ab
-abc69 Xtags3.txt /`ab
-abc70 Xtags3.txt /`ab
-abc71 Xtags3.txt /`ab
-abc72 Xtags3.txt /`ab
-abc73 Xtags3.txt /`ab
-abc74 Xtags3.txt /`ab
-abc75 Xtags3.txt /`ab
-abc76 Xtags3.txt /`ab
-abc77 Xtags3.txt /`ab
-abc78 Xtags3.txt /`ab
-abc79 Xtags3.txt /`ab
-abc80 Xtags3.txt /`ab
-abc81 Xtags3.txt /`ab
-abc82 Xtags3.txt /`ab
-abc83 Xtags3.txt /`ab
-abc84 Xtags3.txt /`ab
-abc85 Xtags3.txt /`ab
-abc86 Xtags3.txt /`ab
-abc87 Xtags3.txt /`ab
-abc88 Xtags3.txt /`ab
-abc89 Xtags3.txt /`ab
-abc90 Xtags3.txt /`ab
-abc91 Xtags3.txt /`ab
-abc92 Xtags3.txt /`ab
-abc93 Xtags3.txt /`ab
-abc94 Xtags3.txt /`ab
-abc95 Xtags3.txt /`ab
-abc96 Xtags3.txt /`ab
-abc97 Xtags3.txt /`ab
-abc98 Xtags3.txt /`ab
-abc99 Xtags3.txt /`ab
-abc100 Xtags3.txt /`ab
diff --git a/src/nvim/testdir/test83.in b/src/nvim/testdir/test83.in
deleted file mode 100644
index d54b1bcddd..0000000000
--- a/src/nvim/testdir/test83.in
+++ /dev/null
@@ -1,75 +0,0 @@
-Tests for tag search with !_TAG_FILE_ENCODING.
-
-STARTTEST
-:so mbyte.vim
-:if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21"
-: e! test.ok
-: w! test.out
-: qa!
-:endif
-
-:/^text for tags1$/,/^text for tags1$/+1w! Xtags1.txt
-:/^text for tags2$/,/^text for tags2$/+1w! Xtags2.txt
-:/^text for tags3$/,/^text for tags3$/+1w! Xtags3.txt
-:/^tags1$/+1,/^tags1-end$/-1w! Xtags1
-
-ggdG
-
-:call setline('.', 'Results of test83')
-
-:" case1:
-:new
-:set tags=Xtags1
-:let v:errmsg = ''
-:tag abcdefghijklmnopqrs
-:if v:errmsg =~ 'E426:' || getline('.') != 'abcdefghijklmnopqrs'
-: close
-: put ='case1: failed'
-:else
-: close
-: put ='case1: ok'
-:endif
-
-:" case2:
-:new
-:set tags=test83-tags2
-:let v:errmsg = ''
-:tag /.BC
-:if v:errmsg =~ 'E426:' || getline('.') != 'ABC'
-: close
-: put ='case2: failed'
-:else
-: close
-: put ='case2: ok'
-:endif
-
-:" case3:
-:new
-:set tags=test83-tags3
-:let v:errmsg = ''
-:tag abc50
-:if v:errmsg =~ 'E426:' || getline('.') != 'ABC'
-: close
-: put ='case3: failed'
-:else
-: close
-: put ='case3: ok'
-:endif
-:close
-
-:wq! test.out
-ENDTEST
-
-text for tags1
-abcdefghijklmnopqrs
-
-text for tags2
-ABC
-
-text for tags3
-ABC
-
-tags1
-!_TAG_FILE_ENCODING utf-8 //
-abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs
-tags1-end
diff --git a/src/nvim/testdir/test83.ok b/src/nvim/testdir/test83.ok
deleted file mode 100644
index 61a1a04a18..0000000000
--- a/src/nvim/testdir/test83.ok
+++ /dev/null
@@ -1,4 +0,0 @@
-Results of test83
-case1: ok
-case2: ok
-case3: ok
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 03fa3ca9df..178d242587 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -385,7 +385,7 @@ static int included_patches[] = {
// 742,
// 741,
// 740,
- // 739,
+ 739,
// 738 NA
// 737,
736,
@@ -402,7 +402,7 @@ static int included_patches[] = {
// 725,
// 724 NA
723,
- // 722,
+ 722,
721,
// 720 NA
719,
@@ -444,7 +444,7 @@ static int included_patches[] = {
// 683 NA
682,
// 681 NA
- // 680,
+ 680,
// 679 NA
// 678 NA
// 677 NA
@@ -468,9 +468,9 @@ static int included_patches[] = {
659,
658,
// 657 NA
- // 656,
+ 656,
655,
- // 654,
+ 654,
653,
// 652 NA
651,
diff --git a/src/nvim/window.c b/src/nvim/window.c
index f0c6cacdf0..853f8755c3 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1044,19 +1044,21 @@ static void win_init_some(win_T *newp, win_T *oldp)
}
-/*
- * Check if "win" is a pointer to an existing window.
- */
-int win_valid(win_T *win)
+/// Check if "win" is a pointer to an existing window in the current tabpage.
+///
+/// @param win window to check
+bool win_valid(win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
- if (win == NULL)
- return FALSE;
+ if (win == NULL) {
+ return false;
+ }
+
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp == win) {
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
/*
@@ -1732,21 +1734,18 @@ close_windows (
shell_new_rows();
}
-/*
- * Return TRUE if the current window is the only window that exists (ignoring
- * "aucmd_win").
- * Returns FALSE if there is a window, possibly in another tab page.
- */
-static int last_window(void)
+/// Check that current window is the last one.
+///
+/// @return true if the current window is the only window that exists, false if
+/// there is another, possibly in another tab page.
+static bool last_window(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
return one_window() && first_tabpage->tp_next == NULL;
}
-/*
- * Return TRUE if there is only one window other than "aucmd_win" in the
- * current tab page.
- */
-bool one_window(void)
+/// Check that current tab page contains no more then one window other than
+/// "aucmd_win".
+bool one_window(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
bool seen_one = false;
@@ -1761,14 +1760,20 @@ bool one_window(void)
return true;
}
-/*
- * Close the possibly last window in a tab page.
- * Returns TRUE when the window was closed already.
- */
-static int close_last_window_tabpage(win_T *win, int free_buf, tabpage_T *prev_curtab)
+/// Close the possibly last window in a tab page.
+///
+/// @param win window to close
+/// @param free_buf whether to free the window's current buffer
+/// @param prev_curtab previous tabpage that will be closed if "win" is the
+/// last window in the tabpage
+///
+/// @return true when the window was closed already.
+static bool close_last_window_tabpage(win_T *win, bool free_buf,
+ tabpage_T *prev_curtab)
+ FUNC_ATTR_NONNULL_ARG(1)
{
if (firstwin != lastwin) {
- return FALSE;
+ return false;
}
buf_T *old_curbuf = curbuf;
@@ -1809,14 +1814,15 @@ static int close_last_window_tabpage(win_T *win, int free_buf, tabpage_T *prev_c
terminal_resize(term, 0, 0);
}
- /* Since goto_tabpage_tp above did not trigger *Enter autocommands, do
- * that now. */
- apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, FALSE, curbuf);
- apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
- apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
- if (old_curbuf != curbuf)
- apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
- return TRUE;
+ // Since goto_tabpage_tp above did not trigger *Enter autocommands, do
+ // that now.
+ apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, false, curbuf);
+ apply_autocmds(EVENT_WINENTER, NULL, NULL, false, curbuf);
+ apply_autocmds(EVENT_TABENTER, NULL, NULL, false, curbuf);
+ if (old_curbuf != curbuf) {
+ apply_autocmds(EVENT_BUFENTER, NULL, NULL, false, curbuf);
+ }
+ return true;
}
/*
@@ -2301,20 +2307,22 @@ static win_T *frame2win(frame_T *frp)
return frp->fr_win;
}
-/*
- * Return TRUE if frame "frp" contains window "wp".
- */
-static int frame_has_win(frame_T *frp, win_T *wp)
+/// Check that the frame "frp" contains the window "wp".
+///
+/// @param frp frame
+/// @param wp window
+static bool frame_has_win(frame_T *frp, win_T *wp)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ARG(1)
{
- frame_T *p;
-
- if (frp->fr_layout == FR_LEAF)
+ if (frp->fr_layout == FR_LEAF) {
return frp->fr_win == wp;
-
- for (p = frp->fr_child; p != NULL; p = p->fr_next)
- if (frame_has_win(p, wp))
- return TRUE;
- return FALSE;
+ }
+ for (frame_T *p = frp->fr_child; p != NULL; p = p->fr_next) {
+ if (frame_has_win(p, wp)) {
+ return true;
+ }
+ }
+ return false;
}
/*
@@ -2406,58 +2414,72 @@ frame_new_height (
topfrp->fr_height = height;
}
-/*
- * Return TRUE if height of frame "frp" should not be changed because of
- * the 'winfixheight' option.
- */
-static int frame_fixed_height(frame_T *frp)
+/// Return true if height of frame "frp" should not be changed because of
+/// the 'winfixheight' option.
+///
+/// @param frp frame
+///
+/// @return true if the frame has a fixed height
+static bool frame_fixed_height(frame_T *frp)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
- /* frame with one window: fixed height if 'winfixheight' set. */
- if (frp->fr_win != NULL)
+ // frame with one window: fixed height if 'winfixheight' set.
+ if (frp->fr_win != NULL) {
return frp->fr_win->w_p_wfh;
-
+ }
if (frp->fr_layout == FR_ROW) {
- /* The frame is fixed height if one of the frames in the row is fixed
- * height. */
- for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next)
- if (frame_fixed_height(frp))
- return TRUE;
- return FALSE;
+ // The frame is fixed height if one of the frames in the row is fixed
+ // height.
+ for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) {
+ if (frame_fixed_height(frp)) {
+ return true;
+ }
+ }
+ return false;
}
- /* frp->fr_layout == FR_COL: The frame is fixed height if all of the
- * frames in the row are fixed height. */
- for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next)
- if (!frame_fixed_height(frp))
- return FALSE;
- return TRUE;
+ // frp->fr_layout == FR_COL: The frame is fixed height if all of the
+ // frames in the row are fixed height.
+ for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) {
+ if (!frame_fixed_height(frp)) {
+ return false;
+ }
+ }
+ return true;
}
-/*
- * Return TRUE if width of frame "frp" should not be changed because of
- * the 'winfixwidth' option.
- */
-static int frame_fixed_width(frame_T *frp)
+/// Return true if width of frame "frp" should not be changed because of
+/// the 'winfixwidth' option.
+///
+/// @param frp frame
+///
+/// @return true if the frame has a fixed width
+static bool frame_fixed_width(frame_T *frp)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
- /* frame with one window: fixed width if 'winfixwidth' set. */
- if (frp->fr_win != NULL)
+ // frame with one window: fixed width if 'winfixwidth' set.
+ if (frp->fr_win != NULL) {
return frp->fr_win->w_p_wfw;
-
+ }
if (frp->fr_layout == FR_COL) {
- /* The frame is fixed width if one of the frames in the row is fixed
- * width. */
- for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next)
- if (frame_fixed_width(frp))
- return TRUE;
- return FALSE;
+ // The frame is fixed width if one of the frames in the row is fixed
+ // width.
+ for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) {
+ if (frame_fixed_width(frp)) {
+ return true;
+ }
+ }
+ return false;
}
- /* frp->fr_layout == FR_ROW: The frame is fixed width if all of the
- * frames in the row are fixed width. */
- for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next)
- if (!frame_fixed_width(frp))
- return FALSE;
- return TRUE;
+ // frp->fr_layout == FR_ROW: The frame is fixed width if all of the
+ // frames in the row are fixed width.
+ for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) {
+ if (!frame_fixed_width(frp)) {
+ return false;
+ }
+ }
+ return true;
}
/*
@@ -3028,10 +3050,10 @@ int make_tabpages(int maxcount)
return count - todo;
}
-/*
- * Return TRUE when "tpc" points to a valid tab page.
- */
-bool valid_tabpage(tabpage_T *tpc)
+/// Check that tpc points to a valid tab page.
+///
+/// @param[in] tpc Tabpage to check.
+bool valid_tabpage(tabpage_T *tpc) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
FOR_ALL_TABS(tp) {
if (tp == tpc) {
@@ -5052,27 +5074,22 @@ int min_rows(void)
return total;
}
-/*
- * Return TRUE if there is only one window (in the current tab page), not
- * counting a help or preview window, unless it is the current window.
- * Does not count "aucmd_win".
- */
-int only_one_window(void)
+/// Check that there is only one window (and only one tab page), not counting a
+/// help or preview window, unless it is the current window. Does not count
+/// "aucmd_win".
+bool only_one_window(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
- int count = 0;
-
- /* If there is another tab page there always is another window. */
- if (first_tabpage->tp_next != NULL)
- return FALSE;
+ // If there is another tab page there always is another window.
+ if (first_tabpage->tp_next != NULL) {
+ return false;
+ }
+ int count = 0;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_buffer != NULL
&& (!((wp->w_buffer->b_help && !curbuf->b_help)
- || wp->w_p_pvw
- ) || wp == curwin)
- && wp != aucmd_win
- ) {
- ++count;
+ || wp->w_p_pvw) || wp == curwin) && wp != aucmd_win) {
+ count++;
}
}
return count <= 1;
@@ -5571,38 +5588,42 @@ matchitem_T *get_match(win_T *wp, int id)
}
-/*
- * Return TRUE if "topfrp" and its children are at the right height.
- */
-static int frame_check_height(frame_T *topfrp, int height)
+/// Check that "topfrp" and its children are at the right height.
+///
+/// @param topfrp top frame pointer
+/// @param height expected height
+static bool frame_check_height(frame_T *topfrp, int height)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
- frame_T *frp;
-
- if (topfrp->fr_height != height)
- return FALSE;
-
- if (topfrp->fr_layout == FR_ROW)
- for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
- if (frp->fr_height != height)
- return FALSE;
-
- return TRUE;
+ if (topfrp->fr_height != height) {
+ return false;
+ }
+ if (topfrp->fr_layout == FR_ROW) {
+ for (frame_T *frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) {
+ if (frp->fr_height != height) {
+ return false;
+ }
+ }
+ }
+ return true;
}
-/*
- * Return TRUE if "topfrp" and its children are at the right width.
- */
-static int frame_check_width(frame_T *topfrp, int width)
+/// Check that "topfrp" and its children are at the right width.
+///
+/// @param topfrp top frame pointer
+/// @param width expected width
+static bool frame_check_width(frame_T *topfrp, int width)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
- frame_T *frp;
-
- if (topfrp->fr_width != width)
- return FALSE;
-
- if (topfrp->fr_layout == FR_COL)
- for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
- if (frp->fr_width != width)
- return FALSE;
-
- return TRUE;
+ if (topfrp->fr_width != width) {
+ return false;
+ }
+ if (topfrp->fr_layout == FR_COL) {
+ for (frame_T *frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next) {
+ if (frp->fr_width != width) {
+ return false;
+ }
+ }
+ }
+ return true;
}
diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
new file mode 100644
index 0000000000..dc6df007e6
--- /dev/null
+++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua
@@ -0,0 +1,110 @@
+-- Tests for tag search with !_TAG_FILE_ENCODING.
+
+local helpers = require('test.functional.helpers')
+local insert, source, clear, expect, write_file = helpers.insert,
+ helpers.source, helpers.clear, helpers.expect, helpers.write_file
+
+local function has_iconv()
+ clear() -- ensures session
+ return 1 == helpers.eval('has("iconv")')
+end
+
+describe('tag search with !_TAG_FILE_ENCODING', function()
+ setup(function()
+ clear()
+ -- Create some temp files that are needed for the test run. In the old
+ -- test suite this was done by putting the text inside the file test83.in
+ -- and executing some "/first/,/last/w! tmpfile" commands.
+ write_file('Xtags1.txt', 'text for tags1\nabcdefghijklmnopqrs\n')
+ write_file('Xtags2.txt', 'text for tags2\nABC\n')
+ write_file('Xtags3.txt', 'text for tags3\nABC\n')
+ write_file('Xtags1', [[
+ !_TAG_FILE_ENCODING utf-8 //
+ abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs
+ ]])
+ write_file('test83-tags2',
+ '!_TAG_FILE_ENCODING cp932 //\n' ..
+ '\x82`\x82a\x82b Xtags2.txt /\x82`\x82a\x82b\n'
+ )
+ -- The last file is very long but repetetive and can be generated on the
+ -- fly.
+ local text = helpers.dedent([[
+ !_TAG_FILE_SORTED 1 //
+ !_TAG_FILE_ENCODING cp932 //
+ ]])
+ local line = ' Xtags3.txt /\x82`\x82a\x82b\n'
+ for i = 1, 100 do
+ text = text .. 'abc' .. i .. line
+ end
+ write_file('test83-tags3', text)
+ end)
+ teardown(function()
+ os.remove('Xtags1')
+ os.remove('Xtags1.txt')
+ os.remove('Xtags2.txt')
+ os.remove('Xtags3.txt')
+ os.remove('test83-tags2')
+ os.remove('test83-tags3')
+ end)
+
+ if not has_iconv() then
+ pending('skipped (missing iconv)', function() end)
+ else
+ it('is working', function()
+
+ insert('Results of test83')
+
+ -- Case1:
+ source([[
+ new
+ set tags=Xtags1
+ let v:errmsg = ''
+ tag abcdefghijklmnopqrs
+ if v:errmsg =~ 'E426:' || getline('.') != 'abcdefghijklmnopqrs'
+ close
+ put ='case1: failed'
+ else
+ close
+ put ='case1: ok'
+ endif
+ ]])
+
+ -- Case2:
+ source([[
+ new
+ set tags=test83-tags2
+ let v:errmsg = ''
+ tag /.BC
+ if v:errmsg =~ 'E426:' || getline('.') != 'ABC'
+ close
+ put ='case2: failed'
+ else
+ close
+ put ='case2: ok'
+ endif
+ ]])
+
+ -- Case3:
+ source([[
+ new
+ set tags=test83-tags3
+ let v:errmsg = ''
+ tag abc50
+ if v:errmsg =~ 'E426:' || getline('.') != 'ABC'
+ close
+ put ='case3: failed'
+ else
+ close
+ put ='case3: ok'
+ endif
+ ]])
+
+ -- Assert buffer contents.
+ expect([[
+ Results of test83
+ case1: ok
+ case2: ok
+ case3: ok]])
+ end)
+ end
+end)
diff --git a/test/functional/legacy/erasebackword_spec.lua b/test/functional/legacy/erasebackword_spec.lua
new file mode 100644
index 0000000000..cb3967b763
--- /dev/null
+++ b/test/functional/legacy/erasebackword_spec.lua
@@ -0,0 +1,24 @@
+-- Test for CTRL-W in Insert mode
+
+local helpers = require('test.functional.helpers')
+local clear, feed, expect = helpers.clear, helpers.feed, helpers.expect
+
+describe('CTRL-W in Insert mode', function()
+ setup(clear)
+
+ it('works for multi-byte characters', function()
+
+ for i = 1, 6 do
+ feed('o wwwこんにちわ世界ワールドvim ' .. string.rep('<C-w>', i) .. '<esc>')
+ end
+
+ expect([[
+
+ wwwこんにちわ世界ワールド
+ wwwこんにちわ世界
+ wwwこんにちわ
+ www
+
+ ]])
+ end)
+end)