diff options
author | Matthieu Coudron <mattator@gmail.com> | 2020-08-15 17:45:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-15 17:45:18 +0200 |
commit | 37aa9c9c94551ffed8ba5721d5b8ea8e172d7377 (patch) | |
tree | edc210f304d4353dbeb4224b5e42941f332d7a1d /runtime | |
parent | 75aeb815b4db487186e1f4471b37f54430468c76 (diff) | |
parent | 056d99b0f6072030a8946303fce58a86fd83bf57 (diff) | |
download | rneovim-37aa9c9c94551ffed8ba5721d5b8ea8e172d7377.tar.gz rneovim-37aa9c9c94551ffed8ba5721d5b8ea8e172d7377.tar.bz2 rneovim-37aa9c9c94551ffed8ba5721d5b8ea8e172d7377.zip |
Merge pull request #12713 from janlazo/vim-8.2.1347
vim-patch:8.1.{573,1674,2097,2098,2341},8.2.{1347,1360,1361,1364,1369,1377,1379,1386,1409,1410,1438,1441,1458}
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/compiler/xo.vim | 26 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 14 | ||||
-rw-r--r-- | runtime/doc/map.txt | 30 | ||||
-rw-r--r-- | runtime/doc/options.txt | 4 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 2 | ||||
-rw-r--r-- | runtime/filetype.vim | 8 | ||||
-rw-r--r-- | runtime/tools/check_colors.vim | 51 |
7 files changed, 97 insertions, 38 deletions
diff --git a/runtime/compiler/xo.vim b/runtime/compiler/xo.vim new file mode 100644 index 0000000000..525657d4bb --- /dev/null +++ b/runtime/compiler/xo.vim @@ -0,0 +1,26 @@ +" Vim compiler file +" Compiler: XO +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2019 Jul 10 + +if exists("current_compiler") + finish +endif +let current_compiler = "xo" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo&vim + +" CompilerSet makeprg=npx\ xo\ --reporter\ compact + +CompilerSet makeprg=xo\ --reporter\ compact +CompilerSet errorformat=%f:\ line\ %l\\,\ col\ %c\\,\ %trror\ %m, + \%f:\ line\ %l\\,\ col\ %c\\,\ %tarning\ %m, + \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index efb6272e58..448885296d 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2224,6 +2224,7 @@ inputsecret({prompt} [, {text}]) String like input() but hiding the text insert({list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}] +interrupt() none interrupt script execution invert({expr}) Number bitwise invert isdirectory({directory}) Number |TRUE| if {directory} is a directory isinf({expr}) Number determine if {expr} is infinity value @@ -5412,6 +5413,19 @@ insert({list}, {item} [, {idx}]) *insert()* Note that when {item} is a |List| it is inserted as a single item. Use |extend()| to concatenate |Lists|. +interrupt() *interrupt()* + Interrupt script execution. It works more or less like the + user typing CTRL-C, most commands won't execute and control + returns to the user. This is useful to abort execution + from lower down, e.g. in an autocommand. Example: > + :function s:check_typoname(file) + : if fnamemodify(a:file, ':t') == '[' + : echomsg 'Maybe typo' + : call interrupt() + : endif + :endfunction + :au BufWritePre * call s:check_typoname(expand('<amatch>')) + invert({expr}) *invert()* Bitwise invert. The argument is converted to a number. A List, Dict or Float argument causes an error. Example: > diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index ed31ecc42e..1514f03c55 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1078,6 +1078,10 @@ When executing an autocommand or a user command, it will run in the context of the script it was defined in. This makes it possible that the command calls a local function or uses a local mapping. +In case the value is used in a context where <SID> cannot be correctly +expanded, use the expand() function: > + let &includexpr = expand('<SID>') .. 'My_includeexpr()' + Otherwise, using "<SID>" outside of a script context is an error. If you need to get the script number to use in a complicated script, you can @@ -1162,6 +1166,10 @@ See |:verbose-cmd| for more information. attributes (see below) are {attr}. If the command already exists, an error is reported, unless a ! is specified, in which case the command is redefined. + There is one exception: When sourcing a script again, + a command that was previously defined in that script + will be silently replaced. + :delc[ommand] {cmd} *:delc* *:delcommand* *E184* Delete the user-defined command {cmd}. @@ -1169,7 +1177,8 @@ See |:verbose-cmd| for more information. :comc[lear] *:comc* *:comclear* Delete all user-defined commands. -Command attributes + +Command attributes ~ User-defined commands are treated by Vim just like any other Ex commands. They can have arguments, or have a range specified. Arguments are subject to @@ -1180,8 +1189,9 @@ There are a number of attributes, split into four categories: argument handling, completion behavior, range handling, and special cases. The attributes are described below, by category. -Argument handling *E175* *E176* *:command-nargs* +Argument handling ~ + *E175* *E176* *:command-nargs* By default, a user defined command will take no arguments (and an error is reported if any are supplied). However, it is possible to specify that the command can take arguments, using the -nargs attribute. Valid cases are: @@ -1257,9 +1267,9 @@ completion can be enabled: Note: That some completion methods might expand environment variables. -Custom completion *:command-completion-custom* - *:command-completion-customlist* - *E467* *E468* +Custom completion ~ + *:command-completion-custom* + *:command-completion-customlist* *E467* *E468* It is possible to define customized completion schemes via the "custom,{func}" or the "customlist,{func}" completion argument. The {func} part should be a function with the following signature: > @@ -1304,8 +1314,8 @@ the 'path' option: > This example does not work for file names with spaces! -Range handling *E177* *E178* *:command-range* - *:command-count* +Range handling ~ + *E177* *E178* *:command-range* *:command-count* By default, user-defined commands do not accept a line number range. However, it is possible to specify that the command does take a range (the -range attribute), or that it takes an arbitrary count value, either in the line @@ -1342,7 +1352,8 @@ Possible values are: -addr=other other kind of range -Special cases *:command-bang* *:command-bar* +Special cases ~ + *:command-bang* *:command-bar* *:command-register* *:command-buffer* There are some special cases as well: @@ -1360,7 +1371,8 @@ replacement text separately. Note that these arguments can be abbreviated, but that is a deprecated feature. Use the full name for new scripts. -Replacement text + +Replacement text ~ The replacement text for a user defined command is scanned for special escape sequences, using <...> notation. Escape sequences are replaced with values diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 29f4abf250..8efd876d76 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5043,9 +5043,7 @@ A jump table for the options with a short description can be found at |Q_op|. Don't include both "curdir" and "sesdir". When neither "curdir" nor "sesdir" is included, file names are stored with absolute paths. - "slash" and "unix" are useful on Windows when sharing session files - with Unix. The Unix version of Vim cannot source dos format scripts, - but the Windows version of Vim can source unix format scripts. + "slash" and "unix" are always enabled. *'shada'* *'sd'* *E526* *E527* *E528* 'shada' 'sd' string (Vim default for diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 24b562543e..0ba2711090 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -50,7 +50,7 @@ the differences. - 'listchars' defaults to "tab:> ,trail:-,nbsp:+" - 'nrformats' defaults to "bin,hex" - 'ruler' is enabled -- 'sessionoptions' excludes "options" +- 'sessionoptions' enables "slash,unix", excludes "options" - 'shortmess' includes "F", excludes "S" - 'showcmd' is enabled - 'sidescroll' defaults to 1 diff --git a/runtime/filetype.vim b/runtime/filetype.vim index c0d656107c..41a9188905 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -180,7 +180,7 @@ au BufNewFile,BufRead *.at setf m4 au BufNewFile,BufRead *.ave setf ave " Awk -au BufNewFile,BufRead *.awk setf awk +au BufNewFile,BufRead *.awk,*.gawk setf awk " B au BufNewFile,BufRead *.mch,*.ref,*.imp setf b @@ -1089,6 +1089,9 @@ au BufNewFile,BufRead .netrc setf netrc " Ninja file au BufNewFile,BufRead *.ninja setf ninja +" NPM RC file +au BufNewFile,BufRead npmrc,.npmrc setf dosini + " Novell netware batch files au BufNewFile,BufRead *.ncf setf ncf @@ -1195,6 +1198,9 @@ au BufNewFile,BufRead *.pod6 setf pod6 " Also .ctp for Cake template file au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp setf php +" PHP config +au BufNewFile,BufRead php.ini,php.ini-* setf dosini + " Pike and Cmod au BufNewFile,BufRead *.pike,*.pmod setf pike au BufNewFile,BufRead *.cmod setf cmod diff --git a/runtime/tools/check_colors.vim b/runtime/tools/check_colors.vim index 57b71b19db..e4acbc33ec 100644 --- a/runtime/tools/check_colors.vim +++ b/runtime/tools/check_colors.vim @@ -1,6 +1,6 @@ " This script tests a color scheme for some errors and lists potential errors. " Load the scheme and source this script, like this: -" :edit colors/desert.vim | :so colors/tools/check_colors.vim +" :edit colors/desert.vim | :so tools/check_colors.vim let s:save_cpo= &cpo set cpo&vim @@ -8,7 +8,7 @@ set cpo&vim func! Test_check_colors() let l:savedview = winsaveview() call cursor(1,1) - let err={} + let err = {} " 1) Check g:colors_name is existing if !search('\<\%(g:\)\?colors_name\>', 'cnW') @@ -81,36 +81,39 @@ func! Test_check_colors() \ 'WarningMsg', \ 'WildMenu', \ ] - let groups={} + let groups = {} for group in hi_groups - if search('\c@suppress\s\+'.group, 'cnW') + if search('\c@suppress\s\+\<' .. group .. '\>', 'cnW') " skip check, if the script contains a line like " @suppress Visual: - let groups[group] = 'Ignoring '.group continue endif - if search('hi\%[ghlight]!\= \+link \+'.group, 'cnW') " Linked group + if search('hi\%[ghlight]!\= \+link \+' .. group, 'cnW') " Linked group continue endif - if !search('hi\%[ghlight] \+'.group, 'cnW') - let groups[group] = 'No highlight definition for '.group + if !search('hi\%[ghlight] \+\<' .. group .. '\>', 'cnW') + let groups[group] = 'No highlight definition for ' .. group continue endif - if !search('hi\%[ghlight] \+'.group. '.*fg=', 'cnW') - let groups[group] = 'Missing foreground color for '.group + if !search('hi\%[ghlight] \+\<' .. group .. '\>.*[bf]g=', 'cnW') + let groups[group] = 'Missing foreground or background color for ' .. group continue endif - if search('hi\%[ghlight] \+'.group. '.*guibg=', 'cnW') && - \ !search('hi\%[ghlight] \+'.group. '.*ctermbg=', 'cnW') - let groups[group] = 'Missing bg terminal color for '.group + if search('hi\%[ghlight] \+\<' .. group .. '\>.*guibg=', 'cnW') && + \ !search('hi\%[ghlight] \+\<' .. group .. '\>.*ctermbg=', 'cnW') + \ && group != 'Cursor' + let groups[group] = 'Missing bg terminal color for ' .. group continue endif - if !search('hi\%[ghlight] \+'.group. '.*guifg=', 'cnW') - let groups[group] = 'Missing guifg definition for '.group + if !search('hi\%[ghlight] \+\<' .. group .. '\>.*guifg=', 'cnW') + \ && group !~ '^Diff' + let groups[group] = 'Missing guifg definition for ' .. group continue endif - if !search('hi\%[ghlight] \+'.group. '.*ctermfg=', 'cnW') - let groups[group] = 'Missing ctermfg definition for '.group + if !search('hi\%[ghlight] \+\<' .. group .. '\>.*ctermfg=', 'cnW') + \ && group !~ '^Diff' + \ && group != 'Cursor' + let groups[group] = 'Missing ctermfg definition for ' .. group continue endif " do not check for background colors, they could be intentionally left out @@ -120,10 +123,10 @@ func! Test_check_colors() " 3) Check, that it does not set background highlighting " Doesn't ':hi Normal ctermfg=253 ctermfg=233' also set the background sometimes? - let bg_set='\(set\?\|setl\(ocal\)\?\) .*\(background\|bg\)=\(dark\|light\)' - let bg_let='let \%([&]\%([lg]:\)\?\)\%(background\|bg\)\s*=\s*\([''"]\?\)\w\+\1' - let bg_pat='\%('.bg_set. '\|'.bg_let.'\)' - let line=search(bg_pat, 'cnW') + let bg_set = '\(set\?\|setl\(ocal\)\?\) .*\(background\|bg\)=\(dark\|light\)' + let bg_let = 'let \%([&]\%([lg]:\)\?\)\%(background\|bg\)\s*=\s*\([''"]\?\)\w\+\1' + let bg_pat = '\%(' .. bg_set .. '\|' .. bg_let .. '\)' + let line = search(bg_pat, 'cnW') if search(bg_pat, 'cnW') exe line if search('hi \U\w\+\s\+\S', 'cbnW') @@ -145,7 +148,7 @@ func! Test_check_colors() " if exists("syntax_on") " syntax reset " endif - let pat='hi\%[ghlight]\s*clear\n\s*if\s*exists(\([''"]\)syntax_on\1)\n\s*syn\%[tax]\s*reset\n\s*endif' + let pat = 'hi\%[ghlight]\s*clear\n\s*if\s*exists(\([''"]\)syntax_on\1)\n\s*syn\%[tax]\s*reset\n\s*endif' if !search(pat, 'cnW') let err['init'] = 'No initialization' endif @@ -160,7 +163,7 @@ func! Test_check_colors() let ft_groups = [] " let group = '\%('.join(hi_groups, '\|').'\)' " More efficient than a for loop, but less informative for group in hi_groups - let pat='\Chi\%[ghlight]!\= *\%[link] \+\zs'.group.'\w\+\>\ze \+.' " Skips `hi clear` + let pat = '\Chi\%[ghlight]!\= *\%[link] \+\zs' .. group .. '\w\+\>\ze \+.' " Skips `hi clear` if search(pat, 'cW') call add(ft_groups, matchstr(getline('.'), pat)) endif @@ -172,7 +175,7 @@ func! Test_check_colors() " 8) Were debugPC and debugBreakpoint defined? for group in ['debugPC', 'debugBreakpoint'] - let pat='\Chi\%[ghlight]!\= *\%[link] \+\zs'.group.'\>' + let pat = '\Chi\%[ghlight]!\= *\%[link] \+\zs' .. group .. '\>' if search(pat, 'cnW') let line = search(pat, 'cW') let err['filetype'] = get(err, 'filetype', 'Should not define: ') . matchstr(getline('.'), pat). ' ' |