vim-patch:f0b03c4e98f8

Update runtime files
f0b03c4e98

Note: haskell changes were included in 942f3587c3
This commit is contained in:
Justin M. Keyes
2018-10-28 13:51:36 +01:00
parent b9a6df58cc
commit dae1213e57
13 changed files with 213 additions and 124 deletions

View File

@@ -1,7 +1,7 @@
" Vim functions for file type detection " Vim functions for file type detection
" "
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2017 Nov 11 " Last Change: 2017 Dec 05
" These functions are moved here from runtime/filetype.vim to make startup " These functions are moved here from runtime/filetype.vim to make startup
" faster. " faster.
@@ -618,7 +618,11 @@ func dist#ft#FTperl()
setf perl setf perl
return 1 return 1
endif endif
if search('^use\s\s*\k', 'nc', 30) let save_cursor = getpos('.')
call cursor(1,1)
let has_use = search('^use\s\s*\k', 'c', 30)
call setpos('.', save_cursor)
if has_use
setf perl setf perl
return 1 return 1
endif endif

View File

@@ -2194,6 +2194,8 @@ msgpackdump({list}) List dump a list of objects to msgpack
msgpackparse({list}) List parse msgpack to a list of objects msgpackparse({list}) List parse msgpack to a list of objects
nextnonblank({lnum}) Number line nr of non-blank line >= {lnum} nextnonblank({lnum}) Number line nr of non-blank line >= {lnum}
nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr}
option_restore({list}) none restore options saved by option_save()
option_save({list}) List save options values
nvim_...({args}...) any call nvim |api| functions nvim_...({args}...) any call nvim |api| functions
or({expr}, {expr}) Number bitwise OR or({expr}, {expr}) Number bitwise OR
pathshorten({expr}) String shorten directory names in a path pathshorten({expr}) String shorten directory names in a path
@@ -5882,6 +5884,31 @@ nvim_...({...}) *nvim_...()* *eval-api*
also take the numerical value 0 to indicate the current also take the numerical value 0 to indicate the current
(focused) object. (focused) object.
option_restore({list}) *option_restore()*
Restore options previously saved by option_save().
When buffer-local options have been saved, this function must
be called when the same buffer is the current buffer.
When window-local options have been saved, this function must
be called when the same window is the current window.
When in the wrong buffer and/or window an error is given and
the local options won't be restored.
NOT IMPLEMENTED YET!
option_save({list}) *option_save()*
Saves the options named in {list}. The returned value can be
passed to option_restore(). Example: >
let s:saved_options = option_save([
\ 'ignorecase',
\ 'iskeyword',
\ ])
au <buffer> BufLeave *
\ call option_restore(s:saved_options)
< The advantage over using `:let` is that global and local
values are handled and the script ID is restored, so that
`:verbose set` will show where the option was originally set,
not where it was restored.
NOT IMPLEMENTED YET!
or({expr}, {expr}) *or()* or({expr}, {expr}) *or()*
Bitwise OR on the two arguments. The arguments are converted Bitwise OR on the two arguments. The arguments are converted
to a number. A List, Dict or Float argument causes an error. to a number. A List, Dict or Float argument causes an error.

View File

@@ -750,4 +750,23 @@ You can change the default by defining the variable g:tex_flavor to the format
Currently no other formats are recognized. Currently no other formats are recognized.
VIM *ft-vim-plugin*
The Vim filetype plugin defines mappings to move to the start and end of
functions with [[ and ]]. Move around comments with ]" and [".
The mappings can be disabled with: >
let g:no_vim_maps = 1
ZIMBU *ft-zimbu-plugin*
The Zimbu filetype plugin defines mappings to move to the start and end of
functions with [[ and ]].
The mappings can be disabled with: >
let g:no_zimbu_maps = 1
<
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:

View File

@@ -226,6 +226,10 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
If the directory pack/*/opt/{name}/after exists it is If the directory pack/*/opt/{name}/after exists it is
added at the end of 'runtimepath'. added at the end of 'runtimepath'.
If loading packages from "pack/*/start" was skipped,
then this directory is searched first:
pack/*/start/{name} ~
Note that {name} is the directory name, not the name Note that {name} is the directory name, not the name
of the .vim file. All the files matching the pattern of the .vim file. All the files matching the pattern
pack/*/opt/{name}/plugin/**/*.vim ~ pack/*/opt/{name}/plugin/**/*.vim ~

View File

@@ -901,6 +901,7 @@ Vim server: *server-functions*
Window size and position: *window-size-functions* Window size and position: *window-size-functions*
winheight() get height of a specific window winheight() get height of a specific window
winwidth() get width of a specific window winwidth() get width of a specific window
win_screenpos() get screen position of a window
winrestcmd() return command to restore window sizes winrestcmd() return command to restore window sizes
winsaveview() get view of current window winsaveview() get view of current window
winrestview() restore saved view of current window winrestview() restore saved view of current window

View File

@@ -1924,6 +1924,9 @@ au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif
" Most of these should call s:StarSetf() to avoid names ending in .gz and the " Most of these should call s:StarSetf() to avoid names ending in .gz and the
" like are used. " like are used.
" More Apache style config files
au BufNewFile,BufRead */etc/proftpd/*.conf*,*/etc/proftpd/conf.*/* call s:StarSetf('apachestyle')
" More Apache config files " More Apache config files
au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache') au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache')
au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.d/*.conf* call s:StarSetf('apache') au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.d/*.conf* call s:StarSetf('apache')

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin " Vim filetype plugin
" Language: Vim " Language: Vim
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2017 Nov 06 " Last Change: 2017 Dec 05
" Only do this when not done yet for this buffer " Only do this when not done yet for this buffer
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
@@ -42,21 +42,23 @@ setlocal commentstring=\"%s
" Prefer Vim help instead of manpages. " Prefer Vim help instead of manpages.
setlocal keywordprg=:help setlocal keywordprg=:help
" Move around functions. if !exists("no_plugin_maps") && !exists("no_vim_maps")
nnoremap <silent><buffer> [[ m':call search('^\s*fu\%[nction]\>', "bW")<CR> " Move around functions.
vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "bW")<CR> nnoremap <silent><buffer> [[ m':call search('^\s*fu\%[nction]\>', "bW")<CR>
nnoremap <silent><buffer> ]] m':call search('^\s*fu\%[nction]\>', "W")<CR> vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "bW")<CR>
vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "W")<CR> nnoremap <silent><buffer> ]] m':call search('^\s*fu\%[nction]\>', "W")<CR>
nnoremap <silent><buffer> [] m':call search('^\s*endf*\%[unction]\>', "bW")<CR> vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*fu\%[nction]\>', "W")<CR>
vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "bW")<CR> nnoremap <silent><buffer> [] m':call search('^\s*endf*\%[unction]\>', "bW")<CR>
nnoremap <silent><buffer> ][ m':call search('^\s*endf*\%[unction]\>', "W")<CR> vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "bW")<CR>
vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "W")<CR> nnoremap <silent><buffer> ][ m':call search('^\s*endf*\%[unction]\>', "W")<CR>
vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*endf*\%[unction]\>', "W")<CR>
" Move around comments " Move around comments
nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
endif
" Let the matchit plugin know what items can be matched. " Let the matchit plugin know what items can be matched.
if exists("loaded_matchit") if exists("loaded_matchit")

View File

@@ -1,7 +1,7 @@
" Vim filetype plugin file " Vim filetype plugin file
" Language: Zimbu " Language: Zimbu
" Maintainer: Bram Moolenaar <Bram@vim.org> " Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2012 Sep 08 " Last Change: 2017 Dec 05
" Only do this when not done yet for this buffer " Only do this when not done yet for this buffer
if exists("b:did_ftplugin") if exists("b:did_ftplugin")
@@ -135,8 +135,10 @@ iabbr <buffer> <expr> until GCUpperSpace("until")
iabbr <buffer> <expr> while GCUpperSpace("while") iabbr <buffer> <expr> while GCUpperSpace("while")
iabbr <buffer> <expr> repeat GCUpper("repeat") iabbr <buffer> <expr> repeat GCUpper("repeat")
nnoremap <silent> <buffer> [[ m`:call ZimbuGoStartBlock()<CR> if !exists("no_plugin_maps") && !exists("no_zimbu_maps")
nnoremap <silent> <buffer> ]] m`:call ZimbuGoEndBlock()<CR> nnoremap <silent> <buffer> [[ m`:call ZimbuGoStartBlock()<CR>
nnoremap <silent> <buffer> ]] m`:call ZimbuGoEndBlock()<CR>
endif
" Using a function makes sure the search pattern is restored " Using a function makes sure the search pattern is restored
func! ZimbuGoStartBlock() func! ZimbuGoStartBlock()

View File

@@ -2,7 +2,7 @@
" Language: Javascript " Language: Javascript
" Maintainer: Chris Paul ( https://github.com/bounceme ) " Maintainer: Chris Paul ( https://github.com/bounceme )
" URL: https://github.com/pangloss/vim-javascript " URL: https://github.com/pangloss/vim-javascript
" Last Change: September 18, 2017 " Last Change: December 4, 2017
" Only load this indent file when no other was loaded. " Only load this indent file when no other was loaded.
if exists('b:did_indent') if exists('b:did_indent')
@@ -10,10 +10,6 @@ if exists('b:did_indent')
endif endif
let b:did_indent = 1 let b:did_indent = 1
" indent correctly if inside <script>
" vim/vim@690afe1 for the switch from cindent
let b:html_indent_script1 = 'inc'
" Now, set up our indentation expression and keys that trigger it. " Now, set up our indentation expression and keys that trigger it.
setlocal indentexpr=GetJavascriptIndent() setlocal indentexpr=GetJavascriptIndent()
setlocal autoindent nolisp nosmartindent setlocal autoindent nolisp nosmartindent
@@ -25,13 +21,6 @@ setlocal indentkeys+=0],0)
let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<' let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<'
" Regex of syntax group names that are or delimit string or are comments.
let b:syng_strcom = get(b:,'syng_strcom','string\|comment\|regex\|special\|doc\|template\%(braces\)\@!')
let b:syng_str = get(b:,'syng_str','string\|template\|special')
" template strings may want to be excluded when editing graphql:
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
" Only define the function once. " Only define the function once.
if exists('*GetJavascriptIndent') if exists('*GetJavascriptIndent')
finish finish
@@ -40,6 +29,23 @@ endif
let s:cpo_save = &cpo let s:cpo_save = &cpo
set cpo&vim set cpo&vim
" indent correctly if inside <script>
" vim/vim@690afe1 for the switch from cindent
" overridden with b:html_indent_script1
call extend(g:,{'html_indent_script1': 'inc'},'keep')
" Regex of syntax group names that are or delimit string or are comments.
let s:bvars = {
\ 'syng_strcom': 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!',
\ 'syng_str': 'string\|template\|special' }
" template strings may want to be excluded when editing graphql:
" au! Filetype javascript let b:syng_str = '^\%(.*template\)\@!.*string\|special'
" au! Filetype javascript let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
function s:GetVars()
call extend(b:,extend(s:bvars,{'js_cache': [0,0,0]}),'keep')
endfunction
" Get shiftwidth value " Get shiftwidth value
if exists('*shiftwidth') if exists('*shiftwidth')
function s:sw() function s:sw()
@@ -104,22 +110,23 @@ endfunction
function s:SkipFunc() function s:SkipFunc()
if s:top_col == 1 if s:top_col == 1
throw 'out of bounds' throw 'out of bounds'
endif elseif s:check_in
let s:top_col = 0
if s:check_in
if eval(s:skip_expr) if eval(s:skip_expr)
return 1 return 1
endif endif
let s:check_in = 0 let s:check_in = 0
elseif getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$' elseif getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$'
if eval(s:skip_expr) if eval(s:skip_expr)
let s:looksyn = a:firstline
return 1 return 1
endif endif
elseif search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn) && eval(s:skip_expr) elseif search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn)
if eval(s:skip_expr)
let s:check_in = 1 let s:check_in = 1
return 1 return 1
endif endif
else
let s:synid_cache[:] += [[line2byte('.') + col('.') - 1], ['']]
endif
let [s:looksyn, s:top_col] = getpos('.')[1:2] let [s:looksyn, s:top_col] = getpos('.')[1:2]
endfunction endfunction
@@ -159,19 +166,29 @@ function s:Token()
return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt() return s:LookingAt() =~ '\k' ? expand('<cword>') : s:LookingAt()
endfunction endfunction
function s:PreviousToken() function s:PreviousToken(...)
let l:col = col('.') let [l:pos, tok] = [getpos('.'), '']
if search('\m\k\{1,}\|\S','ebW') if search('\m\k\{1,}\|\S','ebW')
if search('\m\*\%#\/\|\/\/\%<'.a:firstline.'l','nbW',line('.')) && eval(s:in_comm) if getline('.')[col('.')-2:col('.')-1] == '*/'
if s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm) if eval(s:in_comm) && !s:SearchLoop('\S\ze\_s*\/[/*]','bW',s:in_comm)
return s:Token() call setpos('.',l:pos)
endif
call cursor(a:firstline, l:col)
else else
return s:Token() let tok = s:Token()
endif
else
let two = a:0 || line('.') != l:pos[1] ? strridx(getline('.')[:col('.')],'//') + 1 : 0
if two && eval(s:in_comm)
call cursor(0,two)
let tok = s:PreviousToken(1)
if tok is ''
call setpos('.',l:pos)
endif
else
let tok = s:Token()
endif endif
endif endif
return '' endif
return tok
endfunction endfunction
function s:Pure(f,...) function s:Pure(f,...)
@@ -183,23 +200,30 @@ function s:SearchLoop(pat,flags,expr)
endfunction endfunction
function s:ExprCol() function s:ExprCol()
if getline('.')[col('.')-2] == ':'
return 1
endif
let bal = 0 let bal = 0
while s:SearchLoop('[{}?]\|\_[^:]\zs::\@!','bW',s:skip_expr) while s:SearchLoop('[{}?:]','bW',s:skip_expr)
if s:LookingAt() == ':' if s:LookingAt() == ':'
if getline('.')[col('.')-2] == ':'
call cursor(0,col('.')-1)
continue
endif
let bal -= 1 let bal -= 1
elseif s:LookingAt() == '?' elseif s:LookingAt() == '?'
let bal += 1 if getline('.')[col('.'):col('.')+1] =~ '^\.\d\@!'
if bal == 1 continue
break elseif !bal
return 1
endif endif
let bal += 1
elseif s:LookingAt() == '{' elseif s:LookingAt() == '{'
let bal = !s:IsBlock() return !s:IsBlock()
break
elseif !s:GetPair('{','}','bW',s:skip_expr) elseif !s:GetPair('{','}','bW',s:skip_expr)
break break
endif endif
endwhile endwhile
return s:Nat(bal)
endfunction endfunction
" configurable regexes that define continuation lines, not including (, {, or [. " configurable regexes that define continuation lines, not including (, {, or [.
@@ -208,30 +232,29 @@ let s:opfirst = '^' . get(g:,'javascript_opfirst',
let s:continuation = get(g:,'javascript_continuation', let s:continuation = get(g:,'javascript_continuation',
\ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$' \ '\C\%([<=,.~!?/*^%|&:]\|+\@<!+\|-\@<!-\|=\@<!>\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$'
function s:Continues(ln,con) function s:Continues()
let tok = matchstr(a:con[-15:],s:continuation) let tok = matchstr(strpart(getline('.'),col('.')-15,15),s:continuation)
if tok =~ '[a-z:]' if tok =~ '[a-z:]'
call cursor(a:ln, len(a:con))
return tok == ':' ? s:ExprCol() : s:PreviousToken() != '.' return tok == ':' ? s:ExprCol() : s:PreviousToken() != '.'
elseif tok !~ '[/>]' elseif tok !~ '[/>]'
return tok isnot '' return tok isnot ''
endif endif
return s:SynAt(a:ln, len(a:con)) !~? (tok == '>' ? 'jsflow\|^html' : 'regex') return s:SynAt(line('.'),col('.')) !~? (tok == '>' ? 'jsflow\|^html' : 'regex')
endfunction endfunction
" Check if line 'lnum' has a balanced amount of parentheses. " Check if line 'lnum' has a balanced amount of parentheses.
function s:Balanced(lnum) function s:Balanced(lnum,line)
let [l:open, l:line] = [0, getline(a:lnum)] let l:open = 0
let pos = match(l:line, '[][(){}]') let pos = match(a:line, '[][(){}]')
while pos != -1 while pos != -1
if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom if s:SynAt(a:lnum,pos + 1) !~? b:syng_strcom
let l:open += match(' ' . l:line[pos],'[[({]') let l:open += match(' ' . a:line[pos],'[[({]')
if l:open < 0 if l:open < 0
return return
endif endif
endif endif
let pos = match(l:line, !l:open ? '[][(){}]' : '()' =~ l:line[pos] ? let pos = match(a:line, !l:open ? '[][(){}]' : '()' =~ a:line[pos] ?
\ '[()]' : '{}' =~ l:line[pos] ? '[{}]' : '[][]', pos + 1) \ '[()]' : '{}' =~ a:line[pos] ? '[{}]' : '[][]', pos + 1)
endwhile endwhile
return !l:open return !l:open
endfunction endfunction
@@ -244,27 +267,38 @@ function s:OneScope()
\ s:Pure('s:PreviousToken') != '.' && !(tok == 'while' && s:DoWhile()) \ s:Pure('s:PreviousToken') != '.' && !(tok == 'while' && s:DoWhile())
elseif s:Token() =~# '^else$\|^do$' elseif s:Token() =~# '^else$\|^do$'
return s:Pure('s:PreviousToken') != '.' return s:Pure('s:PreviousToken') != '.'
elseif strpart(getline('.'),col('.')-2,2) == '=>'
call cursor(0,col('.')-1)
if s:PreviousToken() == ')'
return s:GetPair('(', ')', 'bW', s:skip_expr)
endif
return 1
endif endif
return strpart(getline('.'),col('.')-2,2) == '=>'
endfunction endfunction
function s:DoWhile() function s:DoWhile()
let cpos = searchpos('\m\<','cbW') let cpos = searchpos('\m\<','cbW')
if s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr) while s:SearchLoop('\C[{}]\|\<\%(do\|while\)\>','bW',s:skip_expr)
if s:{s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) ? if s:LookingAt() =~ '\a'
\ 'Previous' : ''}Token() ==# 'do' && s:IsBlock() if s:Pure('s:IsBlock')
if s:LookingAt() ==# 'd'
return 1 return 1
endif endif
call call('cursor',cpos) break
endif endif
elseif s:LookingAt() != '}' || !s:GetPair('{','}','bW',s:skip_expr)
break
endif
endwhile
call call('cursor',cpos)
endfunction endfunction
" returns total offset from braceless contexts. 'num' is the lineNr which " returns total offset from braceless contexts. 'num' is the lineNr which
" encloses the entire context, 'cont' if whether a:firstline is a continued " encloses the entire context, 'cont' if whether a:firstline is a continued
" expression, which could have started in a braceless context " expression, which could have started in a braceless context
function s:IsContOne(num,cont) function s:IsContOne(cont)
let [l:num, b_l] = [a:num + !a:num, 0] let [l:num, b_l] = [b:js_cache[1] + !b:js_cache[1], 0]
let pind = a:num ? indent(a:num) + s:sw() : 0 let pind = b:js_cache[1] ? indent(b:js_cache[1]) + s:sw() : 0
let ind = indent('.') + !a:cont let ind = indent('.') + !a:cont
while line('.') > l:num && ind > pind || line('.') == l:num while line('.') > l:num && ind > pind || line('.') == l:num
if indent('.') < ind && s:OneScope() if indent('.') < ind && s:OneScope()
@@ -282,20 +316,16 @@ function s:IsContOne(num,cont)
return b_l return b_l
endfunction endfunction
function s:Class()
return (s:Token() ==# 'class' || s:PreviousToken() =~# '^class$\|^extends$') &&
\ s:PreviousToken() != '.'
endfunction
function s:IsSwitch() function s:IsSwitch()
return s:PreviousToken() !~ '[.*]' && call call('cursor',b:js_cache[1:])
\ (!s:GetPair('{','}','cbW',s:skip_expr) || s:IsBlock() && !s:Class()) return search('\m\C\%#.\_s*\%(\%(\/\/.*\_$\|\/\*\_.\{-}\*\/\)\@>\_s*\)*\%(case\|default\)\>','nWc'.s:z)
endfunction endfunction
" https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader " https://github.com/sweet-js/sweet.js/wiki/design#give-lookbehind-to-the-reader
function s:IsBlock() function s:IsBlock()
let tok = s:PreviousToken() let tok = s:PreviousToken()
if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx' if join(s:stack) =~? 'xml\|jsx' && s:SynAt(line('.'),col('.')-1) =~? 'xml\|jsx'
let s:in_jsx = 1
return tok != '{' return tok != '{'
elseif tok =~ '\k' elseif tok =~ '\k'
if tok ==# 'type' if tok ==# 'type'
@@ -320,7 +350,7 @@ function s:IsBlock()
endfunction endfunction
function GetJavascriptIndent() function GetJavascriptIndent()
let b:js_cache = get(b:,'js_cache',[0,0,0]) call s:GetVars()
let s:synid_cache = [[],[]] let s:synid_cache = [[],[]]
let l:line = getline(v:lnum) let l:line = getline(v:lnum)
" use synstack as it validates syn state and works in an empty line " use synstack as it validates syn state and works in an empty line
@@ -334,7 +364,7 @@ function GetJavascriptIndent()
return -1 return -1
endif endif
elseif s:stack[-1] =~? b:syng_str elseif s:stack[-1] =~? b:syng_str
if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1) if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1,getline(v:lnum-1))
let b:js_cache[0] = v:lnum let b:js_cache[0] = v:lnum
endif endif
return -1 return -1
@@ -361,7 +391,7 @@ function GetJavascriptIndent()
call cursor(v:lnum,1) call cursor(v:lnum,1)
let idx = index([']',')','}'],l:line[0]) let idx = index([']',')','}'],l:line[0])
if b:js_cache[0] > l:lnum && b:js_cache[0] < v:lnum || if b:js_cache[0] > l:lnum && b:js_cache[0] < v:lnum ||
\ b:js_cache[0] == l:lnum && s:Balanced(l:lnum) \ b:js_cache[0] == l:lnum && s:Balanced(l:lnum,pline)
call call('cursor',b:js_cache[1:]) call call('cursor',b:js_cache[1:])
else else
let [s:looksyn, s:top_col, s:check_in, s:l1] = [v:lnum - 1,0,0, let [s:looksyn, s:top_col, s:check_in, s:l1] = [v:lnum - 1,0,0,
@@ -382,10 +412,10 @@ function GetJavascriptIndent()
let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]] let [b:js_cache[0], num] = [v:lnum, b:js_cache[1]]
let [num_ind, is_op, b_l, l:switch_offset] = [s:Nat(indent(num)),0,0,0] let [num_ind, is_op, b_l, l:switch_offset, s:in_jsx] = [s:Nat(indent(num)),0,0,0,0]
if !num || s:LookingAt() == '{' && s:IsBlock() if !num || s:LookingAt() == '{' && s:IsBlock()
let ilnum = line('.') let ilnum = line('.')
if num && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr) if num && !s:in_jsx && s:LookingAt() == ')' && s:GetPair('(',')','bW',s:skip_expr)
if ilnum == num if ilnum == num
let [num, num_ind] = [line('.'), indent('.')] let [num, num_ind] = [line('.'), indent('.')]
endif endif
@@ -399,23 +429,24 @@ function GetJavascriptIndent()
endif endif
endif endif
if idx == -1 && pline[-1:] !~ '[{;]' if idx == -1 && pline[-1:] !~ '[{;]'
call cursor(l:lnum, len(pline))
let sol = matchstr(l:line,s:opfirst) let sol = matchstr(l:line,s:opfirst)
if sol is '' || sol == '/' && s:SynAt(v:lnum, if sol is '' || sol == '/' && s:SynAt(v:lnum,
\ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex' \ 1 + len(getline(v:lnum)) - len(l:line)) =~? 'regex'
if s:Continues(l:lnum,pline) if s:Continues()
let is_op = s:sw() let is_op = s:sw()
endif endif
elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$' elseif num && sol =~# '^\%(in\%(stanceof\)\=\|\*\)$' &&
call call('cursor',b:js_cache[1:]) \ s:LookingAt() == '}' && s:GetPair('{','}','bW',s:skip_expr) &&
if s:PreviousToken() =~ '\k' && s:Class() \ s:PreviousToken() == ')' && s:GetPair('(',')','bW',s:skip_expr) &&
\ (s:PreviousToken() == ']' || s:LookingAt() =~ '\k' &&
\ s:{s:PreviousToken() == '*' ? 'Previous' : ''}Token() !=# 'function')
return num_ind + s:sw() return num_ind + s:sw()
endif
let is_op = s:sw()
else else
let is_op = s:sw() let is_op = s:sw()
endif endif
call cursor(l:lnum, len(pline)) call cursor(l:lnum, len(pline))
let b_l = s:Nat(s:IsContOne(b:js_cache[1],is_op) - (!is_op && l:line =~ '^{')) * s:sw() let b_l = s:Nat(s:IsContOne(is_op) - (!is_op && l:line =~ '^{')) * s:sw()
endif endif
elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U')) elseif idx.s:LookingAt().&cino =~ '^-1(.*(' && (search('\m\S','nbW',num) || s:ParseCino('U'))
let pval = s:ParseCino('(') let pval = s:ParseCino('(')
@@ -431,10 +462,10 @@ function GetJavascriptIndent()
" main return " main return
if l:line =~ '^[])}]\|^|}' if l:line =~ '^[])}]\|^|}'
if l:line_raw[0] == ')' && getline(num)[b:js_cache[2]-1] == '(' if l:line_raw[0] == ')'
if s:ParseCino('M') if s:ParseCino('M')
return indent(l:lnum) return indent(l:lnum)
elseif &cino =~# 'm' && !s:ParseCino('m') elseif num && &cino =~# 'm' && !s:ParseCino('m')
return virtcol('.') - 1 return virtcol('.') - 1
endif endif
endif endif

View File

@@ -1,8 +1,10 @@
" Vim syntax file " Vim syntax file
" Language: Apache-Style configuration files (proftpd.conf/apache.conf/..) " Language: Apache-Style configuration files (proftpd.conf/apache.conf/..)
" Maintainer: Christian Hammers <ch@westend.com> " Maintainer: Ben RUBSON <ben.rubson@gmail.com>
" URL: none " Former Maintainer: Christian Hammers <ch@westend.com>
" ChangeLog: " ChangeLog:
" 2017-12-17,ch
" correctly detect comments
" 2001-05-04,ch " 2001-05-04,ch
" adopted Vim 6.0 syntax style " adopted Vim 6.0 syntax style
" 1999-10-28,ch " 1999-10-28,ch
@@ -27,8 +29,8 @@ endif
syn case ignore syn case ignore
syn match apComment /^\s*#.*$/
syn match apOption /^\s*[^ \t#<=]*/ syn match apOption /^\s*[^ \t#<=]*/
syn match apComment /^\s*#.*$/
"syn match apLastValue /[^ \t<=#]*$/ contains=apComment ugly "syn match apLastValue /[^ \t<=#]*$/ contains=apComment ugly
" tags " tags

View File

@@ -3,8 +3,8 @@
" Maintainer: Jorge Maldonado Ventura <jorgesumle@freakspot.net> " Maintainer: Jorge Maldonado Ventura <jorgesumle@freakspot.net>
" Previous Maintainer: Claudio Fleiner <claudio@fleiner.com> " Previous Maintainer: Claudio Fleiner <claudio@fleiner.com>
" Repository: https://notabug.org/jorgesumle/vim-html-syntax " Repository: https://notabug.org/jorgesumle/vim-html-syntax
" Last Change: 2017 Sep 30 " Last Change: 2017 Dec 16
" included patch from Christian Brabandt to make use of the strikethrough attributes " Included patch from Jorge Maldonado Ventura to add the dialog element
" "
" Please check :help html.vim for some comments and a description of the options " Please check :help html.vim for some comments and a description of the options
@@ -100,11 +100,11 @@ syn keyword htmlArg contained summary tabindex valuetype version
" html 5 arg names " html 5 arg names
syn keyword htmlArg contained allowfullscreen async autocomplete autofocus syn keyword htmlArg contained allowfullscreen async autocomplete autofocus
syn keyword htmlArg contained autoplay challenge contenteditable contextmenu syn keyword htmlArg contained autoplay challenge contenteditable contextmenu
syn keyword htmlArg contained controls crossorigin default dirname download syn keyword htmlArg contained controls crossorigin default dialog dirname
syn keyword htmlArg contained draggable dropzone form formaction formenctype syn keyword htmlArg contained download draggable dropzone form formaction
syn keyword htmlArg contained formmethod formnovalidate formtarget hidden syn keyword htmlArg contained formenctype formmethod formnovalidate formtarget
syn keyword htmlArg contained high icon inputmode keytype kind list loop low syn keyword htmlArg contained hidden high icon inputmode keytype kind list loop
syn keyword htmlArg contained max min minlength muted nonce novalidate open syn keyword htmlArg contained low max min minlength muted nonce novalidate open
syn keyword htmlArg contained optimum pattern placeholder poster preload syn keyword htmlArg contained optimum pattern placeholder poster preload
syn keyword htmlArg contained radiogroup required reversed sandbox spellcheck syn keyword htmlArg contained radiogroup required reversed sandbox spellcheck
syn keyword htmlArg contained sizes srcset srcdoc srclang step title translate syn keyword htmlArg contained sizes srcset srcdoc srclang step title translate

View File

@@ -1,8 +1,8 @@
" Vim syntax file " Vim syntax file
" Language: TeX " Language: TeX
" Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> " Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM>
" Last Change: Oct 12, 2017 " Last Change: Dec 11, 2017
" Version: 105 " Version: 107
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
" "
" Notes: {{{1 " Notes: {{{1
@@ -396,8 +396,8 @@ endif
" Bad Math (mismatched): {{{1 " Bad Math (mismatched): {{{1
if !exists("g:tex_no_math") && !s:tex_no_error if !exists("g:tex_no_math") && !s:tex_no_error
syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}" syn match texBadMath "\\end\s*{\s*\(array\|bBpvV]matrix\|split\|smallmatrix\)\s*}"
syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}" syn match texBadMath "\\end\s*{\s*\(displaymath\|equation\|eqnarray\|math\)\*\=\s*}"
syn match texBadMath "\\[\])]" syn match texBadMath "\\[\])]"
endif endif
@@ -436,17 +436,10 @@ if !exists("g:tex_no_math")
endfun endfun
" Standard Math Zones: {{{2 " Standard Math Zones: {{{2
call TexNewMathZone("A","align",1) call TexNewMathZone("A","displaymath",1)
call TexNewMathZone("B","alignat",1) call TexNewMathZone("B","eqnarray",1)
call TexNewMathZone("C","displaymath",1) call TexNewMathZone("C","equation",1)
call TexNewMathZone("D","eqnarray",1) call TexNewMathZone("D","math",1)
call TexNewMathZone("E","equation",1)
call TexNewMathZone("F","flalign",1)
call TexNewMathZone("G","gather",1)
call TexNewMathZone("H","math",1)
call TexNewMathZone("I","multline",1)
call TexNewMathZone("J","xalignat",1)
call TexNewMathZone("K","xxalignat",0)
" Inline Math Zones: {{{2 " Inline Math Zones: {{{2
if s:tex_fast =~# 'M' if s:tex_fast =~# 'M'

View File

@@ -175,7 +175,7 @@ syn keyword vimFTOption contained detect indent off on plugin
" Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2 " Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2
" ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking. " ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking.
syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue,vimSetEqual,vimOption
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a' if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a'
syn region vimAugroup fold matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList syn region vimAugroup fold matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList
else else
@@ -191,6 +191,7 @@ syn keyword vimAugroupKey contained aug[roup]
" ========= " =========
syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,vimContinue syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,vimContinue
syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "\(\<is\>\|\<isnot\>\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile
syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup
syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar
@@ -537,7 +538,7 @@ syn match vimHiBang contained "!" skipwhite nextgroup=@vimHighlightCluster
syn match vimHiGroup contained "\i\+" syn match vimHiGroup contained "\i\+"
syn case ignore syn case ignore
syn keyword vimHiAttrib contained none bold inverse italic reverse standout underline undercurl syn keyword vimHiAttrib contained none bold inverse italic nocombine reverse standout strikethrough underline undercurl
syn keyword vimFgBgAttrib contained none bg background fg foreground syn keyword vimFgBgAttrib contained none bg background fg foreground
syn case match syn case match
syn match vimHiAttribList contained "\i\+" contains=vimHiAttrib syn match vimHiAttribList contained "\i\+" contains=vimHiAttrib