Skip to content

Commit

Permalink
Update runtime files.
Browse files Browse the repository at this point in the history
  • Loading branch information
brammool committed May 26, 2019
1 parent 20c023a commit 68e6560
Show file tree
Hide file tree
Showing 37 changed files with 8,925 additions and 227 deletions.
127 changes: 110 additions & 17 deletions runtime/colors/tools/check_colors.vim
@@ -1,11 +1,12 @@
" This script tests a color scheme for some errors. Load the scheme and source
" this script. e.g. :e colors/desert.vim | :so check_colors.vim
" Will output possible errors.
" 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

let s:save_cpo= &cpo
set cpo&vim

func! Test_check_colors()
let l:savedview = winsaveview()
call cursor(1,1)
let err={}

Expand All @@ -17,11 +18,69 @@ func! Test_check_colors()
endif

" 2) Check for some well-defined highlighting groups
" Some items, check several groups, e.g. Diff, Spell
let hi_groups = ['ColorColumn', 'Diff', 'ErrorMsg', 'Folded',
\ 'FoldColumn', 'IncSearch', 'LineNr', 'ModeMsg', 'MoreMsg', 'NonText',
\ 'Normal', 'Pmenu', 'Todo', 'Search', 'Spell', 'StatusLine', 'TabLine',
\ 'Title', 'Visual', 'WarningMsg', 'WildMenu']
let hi_groups = [
\ 'ColorColumn',
\ 'Comment',
\ 'Conceal',
\ 'Constant',
\ 'Cursor',
\ 'CursorColumn',
\ 'CursorLine',
\ 'CursorLineNr',
\ 'DiffAdd',
\ 'DiffChange',
\ 'DiffDelete',
\ 'DiffText',
\ 'Directory',
\ 'EndOfBuffer',
\ 'Error',
\ 'ErrorMsg',
\ 'FoldColumn',
\ 'Folded',
\ 'Identifier',
\ 'Ignore',
\ 'IncSearch',
\ 'LineNr',
\ 'MatchParen',
\ 'ModeMsg',
\ 'MoreMsg',
\ 'NonText',
\ 'Normal',
\ 'Pmenu',
\ 'PmenuSbar',
\ 'PmenuSel',
\ 'PmenuThumb',
\ 'PreProc',
\ 'Question',
\ 'QuickFixLine',
\ 'Search',
\ 'SignColumn',
\ 'Special',
\ 'SpecialKey',
\ 'SpellBad',
\ 'SpellCap',
\ 'SpellLocal',
\ 'SpellRare',
\ 'Statement',
\ 'StatusLine',
\ 'StatusLineNC',
\ 'StatusLineTerm',
\ 'StatusLineTermNC',
\ 'TabLine',
\ 'TabLineFill',
\ 'TabLineSel',
\ 'Title',
\ 'Todo',
\ 'ToolbarButton',
\ 'ToolbarLine',
\ 'Type',
\ 'Underlined',
\ 'VertSplit',
\ 'Visual',
\ 'VisualNOS',
\ 'WarningMsg',
\ 'WildMenu',
\ ]
let groups={}
for group in hi_groups
if search('\c@suppress\s\+'.group, 'cnW')
Expand All @@ -30,6 +89,9 @@ func! Test_check_colors()
let groups[group] = 'Ignoring '.group
continue
endif
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
continue
Expand All @@ -43,12 +105,15 @@ func! Test_check_colors()
let groups[group] = 'Missing bg terminal color for '.group
continue
endif
call search('hi\%[ghlight] \+'.group, 'cW')
" only check in the current line
if !search('guifg', 'cnW', line('.')) || !search('ctermfg', 'cnW', line('.'))
" do not check for background colors, they could be intentionally left out
let groups[group] = 'Missing fg definition for '.group
if !search('hi\%[ghlight] \+'.group. '.*guifg=', 'cnW')
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
continue
endif
" do not check for background colors, they could be intentionally left out
call cursor(1,1)
endfor
let err['highlight'] = groups
Expand Down Expand Up @@ -91,27 +156,55 @@ func! Test_check_colors()
endif

" 7) Does not define filetype specific groups like vimCommand, htmlTag,
let hi_groups = ['vim', 'html', 'python', 'sh', 'ruby']
let hi_groups = filter(getcompletion('', 'filetype'), { _,v -> v !~# '\%[no]syn\%(color\|load\|tax\)' })
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]\s*\zs'.group.'\w\+\>'
let pat='\Chi\%[ghlight]!\= *\%[link] \+\zs'.group.'\w\+\>\ze \+.' " Skips `hi clear`
if search(pat, 'cW')
call add(ft_groups, matchstr(getline('.'), pat))
endif
call cursor(1,1)
endfor
if !empty(ft_groups)
let err['filetype'] = get(err, 'filetype', 'Should not define: ') . join(uniq(sort(ft_groups)))
endif

" 8) Were debugPC and debugBreakpoint defined?
for group in ['debugPC', 'debugBreakpoint']
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). ' '
endif
call cursor(1,1)
endfor

" 9) Normal should be defined first, not use reverse, fg or bg
call cursor(1,1)
let pat = 'hi\%[light] \+\%(link\|clear\)\@!\w\+\>'
call search(pat, 'cW') " Look for the first hi def, skipping `hi link` and `hi clear`
if getline('.') !~# '\m\<Normal\>'
let err['highlight']['Normal'] = 'Should be defined first'
elseif getline('.') =~# '\m\%(=\%(fg\|bg\)\)'
let err['highlight']['Normal'] = "Should not use 'fg' or 'bg'"
elseif getline('.') =~# '\m=\%(inv\|rev\)erse'
let err['highlight']['Normal'] = 'Should not use reverse mode'
endif

call winrestview(l:savedview)
let g:err = err

" print Result
call Result(err)
endfu

fu! Result(err)
let do_roups = 0
let do_groups = 0
echohl Title|echomsg "---------------"|echohl Normal
for key in sort(keys(a:err))
if key is# 'highlight'
let do_groups = 1
let do_groups = !empty(a:err[key])
continue
else
if a:err[key] !~ 'OK'
Expand Down
7 changes: 5 additions & 2 deletions runtime/doc/channel.txt
@@ -1,4 +1,4 @@
*channel.txt* For Vim version 8.1. Last change: 2019 May 05
*channel.txt* For Vim version 8.1. Last change: 2019 May 12


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -155,7 +155,10 @@ Use |ch_status()| to see if the channel could be opened.
func MyCloseHandler(channel)
< Vim will invoke callbacks that handle data before invoking
close_cb, thus when this function is called no more data will
be passed to the callbacks.
be passed to the callbacks. However, if a callback causes Vim
to check for messages, the close_cb may be invoked while still
in the callback. The plugin must handle this somehow, it can
be useful to know that no more data is coming.
*channel-drop*
"drop" Specifies when to drop messages:
"auto" When there is no callback to handle a message.
Expand Down
5 changes: 3 additions & 2 deletions runtime/doc/debugger.txt
@@ -1,4 +1,4 @@
*debugger.txt* For Vim version 8.1. Last change: 2019 May 05
*debugger.txt* For Vim version 8.1. Last change: 2019 May 12


VIM REFERENCE MANUAL by Gordon Prieur
Expand Down Expand Up @@ -87,7 +87,8 @@ This feature allows a debugger, or other external tool, to display dynamic
information based on where the mouse is pointing. The purpose of this feature
was to allow Sun's Visual WorkShop debugger to display expression evaluations.
However, the feature was implemented in as general a manner as possible and
could be used for displaying other information as well.
could be used for displaying other information as well. The functionality is
limited though, for advanced popups see |popup-window|.

The Balloon Evaluation has some settable parameters too. For Motif the font
list and colors can be set via X resources (XmNballoonEvalFontList,
Expand Down
5 changes: 3 additions & 2 deletions runtime/doc/doctags.c
@@ -1,7 +1,8 @@
/* vim:set ts=4 sw=4:
* this program makes a tags file for vim_ref.txt
*
* Usage: doctags vim_ref.txt vim_win.txt ... >tags
* This program makes a tags file for help text.
*
* Usage: doctags *.txt ... >tags
*
* A tag in this context is an identifier between stars, e.g. *c_files*
*/
Expand Down
28 changes: 16 additions & 12 deletions runtime/doc/eval.txt
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 8.1. Last change: 2019 May 09
*eval.txt* For Vim version 8.1. Last change: 2019 May 25


VIM REFERENCE MANUAL by Bram Moolenaar
Expand Down Expand Up @@ -1190,8 +1190,9 @@ There must not be white space before or after the dot.

Examples: >
:let dict = {"one": 1, 2: "two"}
:echo dict.one
:echo dict .2
:echo dict.one " shows "1"
:echo dict.2 " shows "two"
:echo dict .2 " error because of space before the dot
Note that the dot is also used for String concatenation. To avoid confusion
always put spaces around the dot for String concatenation.
Expand Down Expand Up @@ -3507,7 +3508,7 @@ chdir({dir}) *chdir()*

Example: >
let save_dir = chdir(newdir)
if save_dir
if save_dir != ""
" ... do some work
call chdir(save_dir)
endif
Expand Down Expand Up @@ -5126,7 +5127,7 @@ getloclist({nr} [, {what}]) *getloclist()*
In addition to the items supported by |getqflist()| in {what},
the following item is supported by |getloclist()|:

filewinid id of the window used to display files
filewinid id of the window used to display files
from the location list. This field is
applicable only when called from a
location list window. See
Expand Down Expand Up @@ -6349,7 +6350,7 @@ listener_add({callback} [, {buf}]) *listener_add()*
was affected; this is a byte index, first
character has a value of one.
When lines are inserted the values are:
lnum line below which the new line is added
lnum line above which the new line is added
end equal to "lnum"
added number of lines inserted
col 1
Expand Down Expand Up @@ -7336,6 +7337,8 @@ prop_remove({props} [, {lnum} [, {lnum-end}]])
all when TRUE remove all matching text properties,
not just the first one
A property matches when either "id" or "type" matches.
If buffer "bufnr" does not exist you get an error message.
If buffer 'bufnr" is not loaded then nothing happens.

Returns the number of properties that were removed.

Expand Down Expand Up @@ -10074,6 +10077,7 @@ timer_start({time}, {callback} [, {options}])
< This will invoke MyHandler() three times at 500 msec
intervals.

Not available in the |sandbox|.
{only available when compiled with the |+timers| feature}

timer_stop({timer}) *timer_stop()*
Expand Down Expand Up @@ -11019,7 +11023,7 @@ It is allowed to define another function inside a function body.
You can provide default values for positional named arguments. This makes
them optional for function calls. When a positional argument is not
specified at a call, the default expression is used to initialize it.
This only works for functions declared with |function|, not for lambda
This only works for functions declared with `:function`, not for lambda
expressions |expr-lambda|.

Example: >
Expand All @@ -11031,7 +11035,7 @@ Example: >
The argument default expressions are evaluated at the time of the function
call, not definition. Thus it is possible to use an expression which is
invalid the moment the function is defined. The expressions are are also only
invalid the moment the function is defined. The expressions are also only
evaluated when arguments are not specified during a call.

You can pass |v:none| to use the default expression. Note that this means you
Expand Down Expand Up @@ -11098,7 +11102,7 @@ This function can then be called with: >
*:cal* *:call* *E107* *E117*
:[range]cal[l] {name}([arguments])
Call a function. The name of the function and its arguments
are as specified with |:function|. Up to 20 arguments can be
are as specified with `:function`. Up to 20 arguments can be
used. The returned value is discarded.
Without a range and for functions that accept a range, the
function is called once. When a range is given the cursor is
Expand Down Expand Up @@ -11152,9 +11156,9 @@ Using an autocommand ~
This is introduced in the user manual, section |41.14|.

The autocommand is useful if you have a plugin that is a long Vim script file.
You can define the autocommand and quickly quit the script with |:finish|.
You can define the autocommand and quickly quit the script with `:finish`.
That makes Vim startup faster. The autocommand should then load the same file
again, setting a variable to skip the |:finish| command.
again, setting a variable to skip the `:finish` command.

Use the FuncUndefined autocommand event with a pattern that matches the
function(s) to be defined. Example: >
Expand Down Expand Up @@ -13001,7 +13005,7 @@ instead of failing in mysterious ways. >
has('vimscript-1')
:scriptversion 2
< String concatenation with "." is not supported, use ".." instead.
< String concatenation with "." is not supported, use ".." instead.
This avoids the ambiguity using "." for Dict member access and
floating point numbers. Now ".5" means the number 0.5.
>
Expand Down

0 comments on commit 68e6560

Please sign in to comment.