From 0312fc2ddb4144a2fd0d323d742c41f625405420 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 00:46:08 +0100 Subject: [PATCH 01/11] vim-patch:3c2881dc1195 Update runtime files. Add Rust support. https://github.com/vim/vim/commit/3c2881dc1195f53ebafc387378399ddd6cb677a7 --- runtime/autoload/rust.vim | 415 ++++++++++++++++++++++++++++++++++ runtime/autoload/rustfmt.vim | 107 +++++++++ runtime/compiler/cargo.vim | 35 +++ runtime/compiler/rustc.vim | 46 ++++ runtime/doc/eval.txt | 5 +- runtime/doc/filetype.txt | 6 + runtime/doc/fold.txt | 4 +- runtime/doc/ft_rust.txt | 237 +++++++++++++++++++ runtime/doc/helphelp.txt | 3 +- runtime/doc/remote.txt | 1 + runtime/doc/usr_41.txt | 1 + runtime/ftplugin/hamster.vim | 3 +- runtime/ftplugin/rust.vim | 197 ++++++++++++++++ runtime/indent/javascript.vim | 243 ++++++++++---------- runtime/indent/rust.vim | 213 +++++++++++++++++ runtime/syntax/rust.vim | 295 ++++++++++++++++++++++++ 16 files changed, 1689 insertions(+), 122 deletions(-) create mode 100644 runtime/autoload/rust.vim create mode 100644 runtime/autoload/rustfmt.vim create mode 100644 runtime/compiler/cargo.vim create mode 100644 runtime/compiler/rustc.vim create mode 100644 runtime/doc/ft_rust.txt create mode 100644 runtime/ftplugin/rust.vim create mode 100644 runtime/indent/rust.vim create mode 100644 runtime/syntax/rust.vim diff --git a/runtime/autoload/rust.vim b/runtime/autoload/rust.vim new file mode 100644 index 0000000000..34a3b41773 --- /dev/null +++ b/runtime/autoload/rust.vim @@ -0,0 +1,415 @@ +" Author: Kevin Ballard +" Description: Helper functions for Rust commands/mappings +" Last Modified: May 27, 2014 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +" Jump {{{1 + +function! rust#Jump(mode, function) range + let cnt = v:count1 + normal! m' + if a:mode ==# 'v' + norm! gv + endif + let foldenable = &foldenable + set nofoldenable + while cnt > 0 + execute "call Jump_" . a:function . "()" + let cnt = cnt - 1 + endwhile + let &foldenable = foldenable +endfunction + +function! s:Jump_Back() + call search('{', 'b') + keepjumps normal! w99[{ +endfunction + +function! s:Jump_Forward() + normal! j0 + call search('{', 'b') + keepjumps normal! w99[{% + call search('{') +endfunction + +" Run {{{1 + +function! rust#Run(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang + let idx = index(l:args, '--') + if idx != -1 + let rustc_args = idx == 0 ? [] : l:args[:idx-1] + let args = l:args[idx+1:] + else + let rustc_args = l:args + let args = [] + endif + else + let rustc_args = [] + endif + + let b:rust_last_rustc_args = l:rustc_args + let b:rust_last_args = l:args + + call s:WithPath(function("s:Run"), rustc_args, args) +endfunction + +function! s:Run(dict, rustc_args, args) + let exepath = a:dict.tmpdir.'/'.fnamemodify(a:dict.path, ':t:r') + if has('win32') + let exepath .= '.exe' + endif + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let rustc_args = [relpath, '-o', exepath] + a:rustc_args + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(rustc_args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + exe '!' . shellescape(exepath) . " " . join(map(a:args, 'shellescape(v:val)')) + endif +endfunction + +" Expand {{{1 + +function! rust#Expand(bang, args) + let args = s:ShellTokenize(a:args) + if a:bang && !empty(l:args) + let pretty = remove(l:args, 0) + else + let pretty = "expanded" + endif + call s:WithPath(function("s:Expand"), pretty, args) +endfunction + +function! s:Expand(dict, pretty, args) + try + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + if a:pretty =~? '^\%(everybody_loops$\|flowgraph=\)' + let flag = '--xpretty' + else + let flag = '--pretty' + endif + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '-Z', 'unstable-options', l:flag, a:pretty] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if v:shell_error + echohl WarningMsg + echo output + echohl None + else + new + silent put =output + 1 + d + setl filetype=rust + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.pretty.rs' + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endtry +endfunction + +function! rust#CompleteExpand(lead, line, pos) + if a:line[: a:pos-1] =~ '^RustExpand!\s*\S*$' + " first argument and it has a ! + let list = ["normal", "expanded", "typed", "expanded,identified", "flowgraph=", "everybody_loops"] + if !empty(a:lead) + call filter(list, "v:val[:len(a:lead)-1] == a:lead") + endif + return list + endif + + return glob(escape(a:lead, "*?[") . '*', 0, 1) +endfunction + +" Emit {{{1 + +function! rust#Emit(type, args) + let args = s:ShellTokenize(a:args) + call s:WithPath(function("s:Emit"), a:type, args) +endfunction + +function! s:Emit(dict, type, args) + try + let output_path = a:dict.tmpdir.'/output' + + let rustc = exists("g:rustc_path") ? g:rustc_path : "rustc" + + let relpath = get(a:dict, 'tmpdir_relpath', a:dict.path) + let args = [relpath, '--emit', a:type, '-o', output_path] + a:args + let pwd = a:dict.istemp ? a:dict.tmpdir : '' + let output = s:system(pwd, shellescape(rustc) . " " . join(map(args, 'shellescape(v:val)'))) + if output != '' + echohl WarningMsg + echo output + echohl None + endif + if !v:shell_error + new + exe 'silent keepalt read' fnameescape(output_path) + 1 + d + if a:type == "llvm-ir" + setl filetype=llvm + let extension = 'll' + elseif a:type == "asm" + setl filetype=asm + let extension = 's' + endif + setl buftype=nofile + setl bufhidden=hide + setl noswapfile + if exists('l:extension') + " give the buffer a nice name + let suffix = 1 + let basename = fnamemodify(a:dict.path, ':t:r') + while 1 + let bufname = basename + if suffix > 1 | let bufname .= ' ('.suffix.')' | endif + let bufname .= '.'.extension + if bufexists(bufname) + let suffix += 1 + continue + endif + exe 'silent noautocmd keepalt file' fnameescape(bufname) + break + endwhile + endif + endif + endtry +endfunction + +" Utility functions {{{1 + +" Invokes func(dict, ...) +" Where {dict} is a dictionary with the following keys: +" 'path' - The path to the file +" 'tmpdir' - The path to a temporary directory that will be deleted when the +" function returns. +" 'istemp' - 1 if the path is a file inside of {dict.tmpdir} or 0 otherwise. +" If {istemp} is 1 then an additional key is provided: +" 'tmpdir_relpath' - The {path} relative to the {tmpdir}. +" +" {dict.path} may be a path to a file inside of {dict.tmpdir} or it may be the +" existing path of the current buffer. If the path is inside of {dict.tmpdir} +" then it is guaranteed to have a '.rs' extension. +function! s:WithPath(func, ...) + let buf = bufnr('') + let saved = {} + let dict = {} + try + let saved.write = &write + set write + let dict.path = expand('%') + let pathisempty = empty(dict.path) + + " Always create a tmpdir in case the wrapped command wants it + let dict.tmpdir = tempname() + call mkdir(dict.tmpdir) + + if pathisempty || !saved.write + let dict.istemp = 1 + " if we're doing this because of nowrite, preserve the filename + if !pathisempty + let filename = expand('%:t:r').".rs" + else + let filename = 'unnamed.rs' + endif + let dict.tmpdir_relpath = filename + let dict.path = dict.tmpdir.'/'.filename + + let saved.mod = &mod + set nomod + + silent exe 'keepalt write! ' . fnameescape(dict.path) + if pathisempty + silent keepalt 0file + endif + else + let dict.istemp = 0 + update + endif + + call call(a:func, [dict] + a:000) + finally + if bufexists(buf) + for [opt, value] in items(saved) + silent call setbufvar(buf, '&'.opt, value) + unlet value " avoid variable type mismatches + endfor + endif + if has_key(dict, 'tmpdir') | silent call s:RmDir(dict.tmpdir) | endif + endtry +endfunction + +function! rust#AppendCmdLine(text) + call setcmdpos(getcmdpos()) + let cmd = getcmdline() . a:text + return cmd +endfunction + +" Tokenize the string according to sh parsing rules +function! s:ShellTokenize(text) + " states: + " 0: start of word + " 1: unquoted + " 2: unquoted backslash + " 3: double-quote + " 4: double-quoted backslash + " 5: single-quote + let l:state = 0 + let l:current = '' + let l:args = [] + for c in split(a:text, '\zs') + if l:state == 0 || l:state == 1 " unquoted + if l:c ==# ' ' + if l:state == 0 | continue | endif + call add(l:args, l:current) + let l:current = '' + let l:state = 0 + elseif l:c ==# '\' + let l:state = 2 + elseif l:c ==# '"' + let l:state = 3 + elseif l:c ==# "'" + let l:state = 5 + else + let l:current .= l:c + let l:state = 1 + endif + elseif l:state == 2 " unquoted backslash + if l:c !=# "\n" " can it even be \n? + let l:current .= l:c + endif + let l:state = 1 + elseif l:state == 3 " double-quote + if l:c ==# '\' + let l:state = 4 + elseif l:c ==# '"' + let l:state = 1 + else + let l:current .= l:c + endif + elseif l:state == 4 " double-quoted backslash + if stridx('$`"\', l:c) >= 0 + let l:current .= l:c + elseif l:c ==# "\n" " is this even possible? + " skip it + else + let l:current .= '\'.l:c + endif + let l:state = 3 + elseif l:state == 5 " single-quoted + if l:c == "'" + let l:state = 1 + else + let l:current .= l:c + endif + endif + endfor + if l:state != 0 + call add(l:args, l:current) + endif + return l:args +endfunction + +function! s:RmDir(path) + " sanity check; make sure it's not empty, /, or $HOME + if empty(a:path) + echoerr 'Attempted to delete empty path' + return 0 + elseif a:path == '/' || a:path == $HOME + echoerr 'Attempted to delete protected path: ' . a:path + return 0 + endif + return system("rm -rf " . shellescape(a:path)) +endfunction + +" Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd. +" If {pwd} is the empty string then it doesn't change the cwd. +function! s:system(pwd, cmd) + let cmd = a:cmd + if !empty(a:pwd) + let cmd = 'cd ' . shellescape(a:pwd) . ' && ' . cmd + endif + return system(cmd) +endfunction + +" Playpen Support {{{1 +" Parts of gist.vim by Yasuhiro Matsumoto reused +" gist.vim available under the BSD license, available at +" http://github.com/mattn/gist-vim +function! s:has_webapi() + if !exists("*webapi#http#post") + try + call webapi#http#post() + catch + endtry + endif + return exists("*webapi#http#post") +endfunction + +function! rust#Play(count, line1, line2, ...) abort + redraw + + let l:rust_playpen_url = get(g:, 'rust_playpen_url', 'https://play.rust-lang.org/') + let l:rust_shortener_url = get(g:, 'rust_shortener_url', 'https://is.gd/') + + if !s:has_webapi() + echohl ErrorMsg | echomsg ':RustPlay depends on webapi.vim (https://github.com/mattn/webapi-vim)' | echohl None + return + endif + + let bufname = bufname('%') + if a:count < 1 + let content = join(getline(a:line1, a:line2), "\n") + else + let save_regcont = @" + let save_regtype = getregtype('"') + silent! normal! gvy + let content = @" + call setreg('"', save_regcont, save_regtype) + endif + + let body = l:rust_playpen_url."?code=".webapi#http#encodeURI(content) + + if strlen(body) > 5000 + echohl ErrorMsg | echomsg 'Buffer too large, max 5000 encoded characters ('.strlen(body).')' | echohl None + return + endif + + let payload = "format=simple&url=".webapi#http#encodeURI(body) + let res = webapi#http#post(l:rust_shortener_url.'create.php', payload, {}) + let url = res.content + + redraw | echomsg 'Done: '.url +endfunction + +" }}}1 + +" vim: set noet sw=8 ts=8: diff --git a/runtime/autoload/rustfmt.vim b/runtime/autoload/rustfmt.vim new file mode 100644 index 0000000000..a689b5e00d --- /dev/null +++ b/runtime/autoload/rustfmt.vim @@ -0,0 +1,107 @@ +" Author: Stephen Sugden +" +" Adapted from https://github.com/fatih/vim-go +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if !exists("g:rustfmt_autosave") + let g:rustfmt_autosave = 0 +endif + +if !exists("g:rustfmt_command") + let g:rustfmt_command = "rustfmt" +endif + +if !exists("g:rustfmt_options") + let g:rustfmt_options = "" +endif + +if !exists("g:rustfmt_fail_silently") + let g:rustfmt_fail_silently = 0 +endif + +let s:got_fmt_error = 0 + +function! s:RustfmtCommandRange(filename, line1, line2) + let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]} + return printf("%s %s --write-mode=overwrite --file-lines '[%s]'", g:rustfmt_command, g:rustfmt_options, json_encode(l:arg)) +endfunction + +function! s:RustfmtCommand(filename) + return g:rustfmt_command . " --write-mode=overwrite " . g:rustfmt_options . " " . shellescape(a:filename) +endfunction + +function! s:RunRustfmt(command, curw, tmpname) + if exists("*systemlist") + let out = systemlist(a:command) + else + let out = split(system(a:command), '\r\?\n') + endif + + if v:shell_error == 0 || v:shell_error == 3 + " remove undo point caused via BufWritePre + try | silent undojoin | catch | endtry + + " Replace current file with temp file, then reload buffer + call rename(a:tmpname, expand('%')) + silent edit! + let &syntax = &syntax + + " only clear location list if it was previously filled to prevent + " clobbering other additions + if s:got_fmt_error + let s:got_fmt_error = 0 + call setloclist(0, []) + lwindow + endif + elseif g:rustfmt_fail_silently == 0 + " otherwise get the errors and put them in the location list + let errors = [] + + for line in out + " src/lib.rs:13:5: 13:10 error: expected `,`, or `}`, found `value` + let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\):\s*\(\d\+:\d\+\s*\)\?\s*error: \(.*\)') + if !empty(tokens) + call add(errors, {"filename": @%, + \"lnum": tokens[2], + \"col": tokens[3], + \"text": tokens[5]}) + endif + endfor + + if empty(errors) + % | " Couldn't detect rustfmt error format, output errors + endif + + if !empty(errors) + call setloclist(0, errors, 'r') + echohl Error | echomsg "rustfmt returned error" | echohl None + endif + + let s:got_fmt_error = 1 + lwindow + " We didn't use the temp file, so clean up + call delete(a:tmpname) + endif + + call winrestview(a:curw) +endfunction + +function! rustfmt#FormatRange(line1, line2) + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommandRange(l:tmpname, a:line1, a:line2) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction + +function! rustfmt#Format() + let l:curw = winsaveview() + let l:tmpname = expand("%:p:h") . "/." . expand("%:p:t") . ".rustfmt" + call writefile(getline(1, '$'), l:tmpname) + + let command = s:RustfmtCommand(l:tmpname) + + call s:RunRustfmt(command, l:curw, l:tmpname) +endfunction diff --git a/runtime/compiler/cargo.vim b/runtime/compiler/cargo.vim new file mode 100644 index 0000000000..bd48666bc9 --- /dev/null +++ b/runtime/compiler/cargo.vim @@ -0,0 +1,35 @@ +" Vim compiler file +" Compiler: Cargo Compiler +" Maintainer: Damien Radtke +" Latest Revision: 2014 Sep 24 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if exists('current_compiler') + finish +endif +runtime compiler/rustc.vim +let current_compiler = "cargo" + +let s:save_cpo = &cpo +set cpo&vim + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +if exists('g:cargo_makeprg_params') + execute 'CompilerSet makeprg=cargo\ '.escape(g:cargo_makeprg_params, ' \|"').'\ $*' +else + CompilerSet makeprg=cargo\ $* +endif + +" Ignore general cargo progress messages +CompilerSet errorformat+= + \%-G%\\s%#Downloading%.%#, + \%-G%\\s%#Compiling%.%#, + \%-G%\\s%#Finished%.%#, + \%-G%\\s%#error:\ Could\ not\ compile\ %.%#, + \%-G%\\s%#To\ learn\ more\\,%.%# + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/compiler/rustc.vim b/runtime/compiler/rustc.vim new file mode 100644 index 0000000000..c27bdc9c0c --- /dev/null +++ b/runtime/compiler/rustc.vim @@ -0,0 +1,46 @@ +" Vim compiler file +" Compiler: Rust Compiler +" Maintainer: Chris Morgan +" Latest Revision: 2013 Jul 12 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if exists("current_compiler") + finish +endif +let current_compiler = "rustc" + +let s:cpo_save = &cpo +set cpo&vim + +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal +endif + +if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0 + CompilerSet makeprg=rustc +else + CompilerSet makeprg=rustc\ \% +endif + +" Old errorformat (before nightly 2016/08/10) +CompilerSet errorformat= + \%f:%l:%c:\ %t%*[^:]:\ %m, + \%f:%l:%c:\ %*\\d:%*\\d\ %t%*[^:]:\ %m, + \%-G%f:%l\ %s, + \%-G%*[\ ]^, + \%-G%*[\ ]^%*[~], + \%-G%*[\ ]... + +" New errorformat (after nightly 2016/08/10) +CompilerSet errorformat+= + \%-G, + \%-Gerror:\ aborting\ %.%#, + \%-Gerror:\ Could\ not\ compile\ %.%#, + \%Eerror:\ %m, + \%Eerror[E%n]:\ %m, + \%Wwarning:\ %m, + \%Inote:\ %m, + \%C\ %#-->\ %f:%l:%c + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 7bf148a833..319ae26060 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2201,12 +2201,13 @@ readfile({fname} [, {binary} [, {max}]]) reltime([{start} [, {end}]]) List get time value reltimefloat({time}) Float turn the time value into a Float reltimestr({time}) String turn time value into a String -remote_expr({server}, {string} [, {idvar}]) +remote_expr({server}, {string} [, {idvar} [, {timeout}]]) String send expression remote_foreground({server}) Number bring Vim server to the foreground remote_peek({serverid} [, {retvar}]) Number check for reply string -remote_read({serverid}) String read reply string +remote_read({serverid} [, {timeout}]) + String read reply string remote_send({server}, {string} [, {idvar}]) String send key sequence remove({list}, {idx} [, {end}]) any remove items {idx}-{end} from {list} diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 7f1e98fed4..ed223e57db 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -724,6 +724,12 @@ Format description: not recognized here as well. +RUST *ft-rust* + +Since the text for this plugin is rather long it has been put in a separate +file: |ft_rust.txt|. + + SQL *ft-sql* Since the text for this plugin is rather long it has been put in a separate diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index fc8484b741..c644d63280 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -73,7 +73,7 @@ This will call a function to compute the fold level: > :set foldexpr=MyFoldLevel(v:lnum) This will make a fold out of paragraphs separated by blank lines: > :set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1 -this does the same: > +This does the same: > :set foldexpr=getline(v:lnum-1)=~'^\\s*$'&&getline(v:lnum)=~'\\S'?'>1':1 Note that backslashes must be used to escape characters that ":set" handles @@ -197,7 +197,7 @@ and the level given by the marker: 1. If a marker with the same fold level is encountered, the previous fold ends and another fold with the same level starts. 2. If a marker with a higher fold level is found, a nested fold is started. -3. if a marker with a lower fold level is found, all folds up to and including +3. If a marker with a lower fold level is found, all folds up to and including this level end and a fold with the specified level starts. The number indicates the fold level. A zero cannot be used (a marker with diff --git a/runtime/doc/ft_rust.txt b/runtime/doc/ft_rust.txt new file mode 100644 index 0000000000..b6e974e371 --- /dev/null +++ b/runtime/doc/ft_rust.txt @@ -0,0 +1,237 @@ +*ft_rust.txt* Filetype plugin for Rust + +============================================================================== +CONTENTS *rust* *ft-rust* + +1. Introduction |rust-intro| +2. Settings |rust-settings| +3. Commands |rust-commands| +4. Mappings |rust-mappings| + +============================================================================== +INTRODUCTION *rust-intro* + +This plugin provides syntax and supporting functionality for the Rust +filetype. + +============================================================================== +SETTINGS *rust-settings* + +This plugin has a few variables you can define in your vimrc that change the +behavior of the plugin. + + *g:rustc_path* +g:rustc_path~ + Set this option to the path to rustc for use in the |:RustRun| and + |:RustExpand| commands. If unset, "rustc" will be located in $PATH: > + let g:rustc_path = $HOME."/bin/rustc" +< + + *g:rustc_makeprg_no_percent* +g:rustc_makeprg_no_percent~ + Set this option to 1 to have 'makeprg' default to "rustc" instead of + "rustc %": > + let g:rustc_makeprg_no_percent = 1 +< + + *g:rust_conceal* +g:rust_conceal~ + Set this option to turn on the basic |conceal| support: > + let g:rust_conceal = 1 +< + + *g:rust_conceal_mod_path* +g:rust_conceal_mod_path~ + Set this option to turn on |conceal| for the path connecting token + "::": > + let g:rust_conceal_mod_path = 1 +< + + *g:rust_conceal_pub* +g:rust_conceal_pub~ + Set this option to turn on |conceal| for the "pub" token: > + let g:rust_conceal_pub = 1 +< + + *g:rust_recommended_style* +g:rust_recommended_style~ + Set this option to enable vim indentation and textwidth settings to + conform to style conventions of the rust standard library (i.e. use 4 + spaces for indents and sets 'textwidth' to 99). This option is enabled + by default. To disable it: > + let g:rust_recommended_style = 0 +< + + *g:rust_fold* +g:rust_fold~ + Set this option to turn on |folding|: > + let g:rust_fold = 1 +< + Value Effect ~ + 0 No folding + 1 Braced blocks are folded. All folds are open by + default. + 2 Braced blocks are folded. 'foldlevel' is left at the + global value (all folds are closed by default). + + *g:rust_bang_comment_leader* +g:rust_bang_comment_leader~ + Set this option to 1 to preserve the leader on multi-line doc comments + using the /*! syntax: > + let g:rust_bang_comment_leader = 1 +< + + *g:ftplugin_rust_source_path* +g:ftplugin_rust_source_path~ + Set this option to a path that should be prepended to 'path' for Rust + source files: > + let g:ftplugin_rust_source_path = $HOME.'/dev/rust' +< + + *g:rustfmt_command* +g:rustfmt_command~ + Set this option to the name of the 'rustfmt' executable in your $PATH. If + not specified it defaults to 'rustfmt' : > + let g:rustfmt_command = 'rustfmt' +< + *g:rustfmt_autosave* +g:rustfmt_autosave~ + Set this option to 1 to run |:RustFmt| automatically when saving a + buffer. If not specified it defaults to 0 : > + let g:rustfmt_autosave = 0 +< + *g:rustfmt_fail_silently* +g:rustfmt_fail_silently~ + Set this option to 1 to prevent 'rustfmt' from populating the + |location-list| with errors. If not specified it defaults to 0: > + let g:rustfmt_fail_silently = 0 +< + *g:rustfmt_options* +g:rustfmt_options~ + Set this option to a string of options to pass to 'rustfmt'. The + write-mode is already set to 'overwrite'. If not specified it + defaults to '' : > + let g:rustfmt_options = '' +< + + *g:rust_playpen_url* +g:rust_playpen_url~ + Set this option to override the url for the playpen to use: > + let g:rust_playpen_url = 'https://play.rust-lang.org/' +< + + *g:rust_shortener_url* +g:rust_shortener_url~ + Set this option to override the url for the url shortener: > + let g:rust_shortener_url = 'https://is.gd/' +< + + +============================================================================== +COMMANDS *rust-commands* + +:RustRun [args] *:RustRun* +:RustRun! [rustc-args] [--] [args] + Compiles and runs the current file. If it has unsaved changes, + it will be saved first using |:update|. If the current file is + an unnamed buffer, it will be written to a temporary file + first. The compiled binary is always placed in a temporary + directory, but is run from the current directory. + + The arguments given to |:RustRun| will be passed to the + compiled binary. + + If ! is specified, the arguments are passed to rustc instead. + A "--" argument will separate the rustc arguments from the + arguments passed to the binary. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustExpand [args] *:RustExpand* +:RustExpand! [TYPE] [args] + Expands the current file using --pretty and displays the + results in a new split. If the current file has unsaved + changes, it will be saved first using |:update|. If the + current file is an unnamed buffer, it will be written to a + temporary file first. + + The arguments given to |:RustExpand| will be passed to rustc. + This is largely intended for specifying various --cfg + configurations. + + If ! is specified, the first argument is the expansion type to + pass to rustc --pretty. Otherwise it will default to + "expanded". + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustEmitIr [args] *:RustEmitIr* + Compiles the current file to LLVM IR and displays the results + in a new split. If the current file has unsaved changes, it + will be saved first using |:update|. If the current file is an + unnamed buffer, it will be written to a temporary file first. + + The arguments given to |:RustEmitIr| will be passed to rustc. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustEmitAsm [args] *:RustEmitAsm* + Compiles the current file to assembly and displays the results + in a new split. If the current file has unsaved changes, it + will be saved first using |:update|. If the current file is an + unnamed buffer, it will be written to a temporary file first. + + The arguments given to |:RustEmitAsm| will be passed to rustc. + + If |g:rustc_path| is defined, it is used as the path to rustc. + Otherwise it is assumed rustc can be found in $PATH. + +:RustPlay *:RustPlay* + This command will only work if you have web-api.vim installed + (available at https://github.com/mattn/webapi-vim). It sends the + current selection, or if nothing is selected, the entirety of the + current buffer to the Rust playpen, and emits a message with the + shortened URL to the playpen. + + |g:rust_playpen_url| is the base URL to the playpen, by default + "https://play.rust-lang.org/". + + |g:rust_shortener_url| is the base url for the shorterner, by + default "https://is.gd/" + +:RustFmt *:RustFmt* + Runs |g:rustfmt_command| on the current buffer. If + |g:rustfmt_options| is set then those will be passed to the + executable. + + If |g:rustfmt_fail_silently| is 0 (the default) then it + will populate the |location-list| with the errors from + |g:rustfmt_command|. If |g:rustfmt_fail_silently| is set to 1 + then it will not populate the |location-list|. + +:RustFmtRange *:RustFmtRange* + Runs |g:rustfmt_command| with selected range. See + |:RustFmt| for any other information. + +============================================================================== +MAPPINGS *rust-mappings* + +This plugin defines mappings for |[[| and |]]| to support hanging indents. + +It also has a few other mappings: + + *rust_* + Executes |:RustRun| with no arguments. + Note: This binding is only available in MacVim. + + *rust_* + Populates the command line with |:RustRun|! using the + arguments given to the last invocation, but does not + execute it. + Note: This binding is only available in MacVim. + +============================================================================== + vim:tw=78:sw=4:noet:ts=8:ft=help:norl: diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index f8164a6982..adc72d1835 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -140,7 +140,8 @@ Help on help files *helphelp* already opened, then the location list for that window is used. Otherwise, a new help window is opened and the location list for that window is set. The - location list for the current window is not changed. + location list for the current window is not changed + then. *:exu* *:exusage* :exu[sage] Show help on Ex commands. Added to simulate the Nvi diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt index 67bfb0b48e..963d5f1972 100644 --- a/runtime/doc/remote.txt +++ b/runtime/doc/remote.txt @@ -137,6 +137,7 @@ the description in |eval.txt| or use CTRL-] on the function name to jump to the full explanation. synopsis explanation ~ + remote_startserver( name) run a server remote_expr( server, string, idvar) send expression remote_send( server, string, idvar) send key sequence serverlist() get a list of available servers diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 4f6a5aa5ab..0f4e2767ab 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -888,6 +888,7 @@ GUI: *gui-functions* Vim server: *server-functions* serverlist() return the list of server names + remote_startserve() run a server remote_send() send command characters to a Vim server remote_expr() evaluate an expression in a Vim server server2client() send a reply to a client of a Vim server diff --git a/runtime/ftplugin/hamster.vim b/runtime/ftplugin/hamster.vim index 29711fb093..6c0630fe04 100644 --- a/runtime/ftplugin/hamster.vim +++ b/runtime/ftplugin/hamster.vim @@ -2,7 +2,7 @@ " Language: Hamster Script " Version: 2.0.6.0 " Maintainer: David Fishburn -" Last Change: 2017 Mar 07 +" Last Change: 2017 Mar 18 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -14,7 +14,6 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -set cpo-=C let b:undo_ftplugin = "setl fo< com< tw< commentstring<" \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" diff --git a/runtime/ftplugin/rust.vim b/runtime/ftplugin/rust.vim new file mode 100644 index 0000000000..7efca5985b --- /dev/null +++ b/runtime/ftplugin/rust.vim @@ -0,0 +1,197 @@ +" Language: Rust +" Description: Vim ftplugin for Rust +" Maintainer: Chris Morgan +" Maintainer: Kevin Ballard +" Last Change: June 08, 2016 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim + +augroup rust.vim +autocmd! + +" Variables {{{1 + +" The rust source code at present seems to typically omit a leader on /*! +" comments, so we'll use that as our default, but make it easy to switch. +" This does not affect indentation at all (I tested it with and without +" leader), merely whether a leader is inserted by default or not. +if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader != 0 + " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, + " but without it, */ gets indented one space even if there were no + " leaders. I'm fairly sure that's a Vim bug. + setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,:// +else + setlocal comments=s0:/*!,m:\ ,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,:// +endif +setlocal commentstring=//%s +setlocal formatoptions-=t formatoptions+=croqnl +" j was only added in 7.3.541, so stop complaints about its nonexistence +silent! setlocal formatoptions+=j + +" smartindent will be overridden by indentexpr if filetype indent is on, but +" otherwise it's better than nothing. +setlocal smartindent nocindent + +if !exists("g:rust_recommended_style") || g:rust_recommended_style != 0 + setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab + setlocal textwidth=99 +endif + +" This includeexpr isn't perfect, but it's a good start +setlocal includeexpr=substitute(v:fname,'::','/','g') + +setlocal suffixesadd=.rs + +if exists("g:ftplugin_rust_source_path") + let &l:path=g:ftplugin_rust_source_path . ',' . &l:path +endif + +if exists("g:loaded_delimitMate") + if exists("b:delimitMate_excluded_regions") + let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions + endif + + let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate' + + " For this buffer, when delimitMate issues the `User delimitMate_map` + " event in the autocommand system, add the above-defined extra excluded + " regions to delimitMate's state, if they have not already been added. + autocmd User + \ if expand('') ==# 'delimitMate_map' && match( + \ delimitMate#Get("excluded_regions"), + \ s:delimitMate_extra_excluded_regions) == -1 + \| let b:delimitMate_excluded_regions = + \ delimitMate#Get("excluded_regions") + \ . s:delimitMate_extra_excluded_regions + \|endif + + " For this buffer, when delimitMate issues the `User delimitMate_unmap` + " event in the autocommand system, delete the above-defined extra excluded + " regions from delimitMate's state (the deletion being idempotent and + " having no effect if the extra excluded regions are not present in the + " targeted part of delimitMate's state). + autocmd User + \ if expand('') ==# 'delimitMate_unmap' + \| let b:delimitMate_excluded_regions = substitute( + \ delimitMate#Get("excluded_regions"), + \ '\C\V' . s:delimitMate_extra_excluded_regions, + \ '', 'g') + \|endif +endif + +if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 + let b:rust_set_foldmethod=1 + setlocal foldmethod=syntax + if g:rust_fold == 2 + setlocal foldlevel< + else + setlocal foldlevel=99 + endif +endif + +if has('conceal') && exists('g:rust_conceal') && g:rust_conceal != 0 + let b:rust_set_conceallevel=1 + setlocal conceallevel=2 +endif + +" Motion Commands {{{1 + +" Bind motion commands to support hanging indents +nnoremap [[ :call rust#Jump('n', 'Back') +nnoremap ]] :call rust#Jump('n', 'Forward') +xnoremap [[ :call rust#Jump('v', 'Back') +xnoremap ]] :call rust#Jump('v', 'Forward') +onoremap [[ :call rust#Jump('o', 'Back') +onoremap ]] :call rust#Jump('o', 'Forward') + +" Commands {{{1 + +" See |:RustRun| for docs +command! -nargs=* -complete=file -bang -buffer RustRun call rust#Run(0, ) + +" See |:RustExpand| for docs +command! -nargs=* -complete=customlist,rust#CompleteExpand -bang -buffer RustExpand call rust#Expand(0, ) + +" See |:RustEmitIr| for docs +command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", ) + +" See |:RustEmitAsm| for docs +command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", ) + +" See |:RustPlay| for docs +command! -range=% RustPlay :call rust#Play(, , , ) + +" See |:RustFmt| for docs +command! -buffer RustFmt call rustfmt#Format() + +" See |:RustFmtRange| for docs +command! -range -buffer RustFmtRange call rustfmt#FormatRange(, ) + +" Mappings {{{1 + +" Bind ⌘R in MacVim to :RustRun +nnoremap :RustRun +" Bind ⌘⇧R in MacVim to :RustRun! pre-filled with the last args +nnoremap :RustRun! =join(b:rust_last_rustc_args)erust#AppendCmdLine(' -- ' . join(b:rust_last_args)) + +if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") + let b:rust_last_rustc_args = [] + let b:rust_last_args = [] +endif + +" Cleanup {{{1 + +let b:undo_ftplugin = " + \ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< + \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< + \|if exists('b:rust_original_delimitMate_excluded_regions') + \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions + \|unlet b:rust_original_delimitMate_excluded_regions + \|else + \|unlet! b:delimitMate_excluded_regions + \|endif + \|if exists('b:rust_set_foldmethod') + \|setlocal foldmethod< foldlevel< + \|unlet b:rust_set_foldmethod + \|endif + \|if exists('b:rust_set_conceallevel') + \|setlocal conceallevel< + \|unlet b:rust_set_conceallevel + \|endif + \|unlet! b:rust_last_rustc_args b:rust_last_args + \|delcommand RustRun + \|delcommand RustExpand + \|delcommand RustEmitIr + \|delcommand RustEmitAsm + \|delcommand RustPlay + \|nunmap + \|nunmap + \|nunmap [[ + \|nunmap ]] + \|xunmap [[ + \|xunmap ]] + \|ounmap [[ + \|ounmap ]] + \|set matchpairs-=<:> + \" + +" }}}1 + +" Code formatting on save +if get(g:, "rustfmt_autosave", 0) + autocmd BufWritePre *.rs silent! call rustfmt#Format() +endif + +augroup END + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: set noet sw=8 ts=8: diff --git a/runtime/indent/javascript.vim b/runtime/indent/javascript.vim index a6f1e1a8f8..304c0fe24f 100644 --- a/runtime/indent/javascript.vim +++ b/runtime/indent/javascript.vim @@ -2,7 +2,7 @@ " Language: Javascript " Maintainer: Chris Paul ( https://github.com/bounceme ) " URL: https://github.com/pangloss/vim-javascript -" Last Change: December 31, 2016 +" Last Change: March 21, 2017 " Only load this indent file when no other was loaded. if exists('b:did_indent') @@ -14,6 +14,10 @@ let b:did_indent = 1 setlocal indentexpr=GetJavascriptIndent() setlocal autoindent nolisp nosmartindent setlocal indentkeys+=0],0) +" Testable with something like: +" vim -eNs "+filetype plugin indent on" "+syntax on" "+set ft=javascript" \ +" "+norm! gg=G" '+%print' '+:q!' testfile.js \ +" | diff -uBZ testfile.js - let b:undo_indent = 'setlocal indentexpr< smartindent< autoindent< indentkeys<' @@ -32,10 +36,14 @@ if exists('*shiftwidth') endfunction else function s:sw() - return &sw + return &l:shiftwidth == 0 ? &l:tabstop : &l:shiftwidth endfunction endif +" Performance for forwards search(): start search at pos rather than masking +" matches before pos. +let s:z = has('patch-7.4.984') ? 'z' : '' + " searchpair() wrapper if has('reltime') function s:GetPair(start,end,flags,skip,time,...) @@ -48,34 +56,41 @@ else endif " Regex of syntax group names that are or delimit string or are comments. -let s:syng_strcom = 'string\|comment\|regex\|special\|doc\|template' -let s:syng_str = 'string\|template' +let s:syng_strcom = 'string\|comment\|regex\|special\|doc\|template\%(braces\)\@!' +let s:syng_str = 'string\|template\|special' let s:syng_com = 'comment\|doc' " Expression used to check whether we should skip a match with searchpair(). let s:skip_expr = "synIDattr(synID(line('.'),col('.'),0),'name') =~? '".s:syng_strcom."'" +function s:parse_cino(f) abort + return float2nr(eval(substitute(substitute(join(split( + \ matchstr(&cino,'.*'.a:f.'\zs[^,]*'), 's',1), '*'.s:W) + \ , '^-\=\zs\*','',''), '^-\=\zs\.','0.',''))) +endfunction + function s:skip_func() - if !s:free || search('\m`\|\*\/','nW',s:looksyn) - let s:free = !eval(s:skip_expr) - let s:looksyn = s:free ? line('.') : s:looksyn - return !s:free + if getline('.') =~ '\%<'.col('.').'c\/.\{-}\/\|\%>'.col('.').'c[''"]\|\\$' + return eval(s:skip_expr) + elseif s:checkIn || search('\m`\|\${\|\*\/','nW'.s:z,s:looksyn) + let s:checkIn = eval(s:skip_expr) endif let s:looksyn = line('.') - return (search('\m\/','nbW',s:looksyn) || search('\m[''"]\|\\$','nW',s:looksyn)) && eval(s:skip_expr) + return s:checkIn endfunction function s:alternatePair(stop) let pos = getpos('.')[1:2] - while search('\m[][(){}]','bW',a:stop) - if !s:skip_func() - let idx = stridx('])}',s:looking_at()) - if idx + 1 - if !s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,a:stop) - break - endif - else - return + let pat = '[][(){};]' + while search('\m'.pat,'bW',a:stop) + if s:skip_func() | continue | endif + let idx = stridx('])};',s:looking_at()) + if idx is 3 | let pat = '[{}()]' | continue | endif + if idx + 1 + if s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,a:stop) <= 0 + break endif + else + return endif endwhile call call('cursor',pos) @@ -100,93 +115,91 @@ function s:token() return s:looking_at() =~ '\k' ? expand('') : s:looking_at() endfunction -function s:b_token() - if s:looking_at() =~ '\k' - call search('\m\<','cbW') - endif - return search('\m\S','bW') -endfunction - function s:previous_token() - let l:n = line('.') - while s:b_token() - if (s:looking_at() == '/' || line('.') != l:n && search('\m\/\/','nbW', - \ line('.'))) && s:syn_at(line('.'),col('.')) =~? s:syng_com - call search('\m\_[^/]\zs\/[/*]','bW') + let l:pos = getpos('.')[1:2] + if search('\m\k\{1,}\zs\k\|\S','bW') + if (getline('.')[col('.')-2:col('.')-1] == '*/' || line('.') != l:pos[0] && + \ getline('.') =~ '\%<'.col('.').'c\/\/') && s:syn_at(line('.'),col('.')) =~? s:syng_com + while search('\m\S\ze\_s*\/[/*]','bW') + if s:syn_at(line('.'),col('.')) !~? s:syng_com + return s:token() + endif + endwhile else return s:token() endif - endwhile + endif + call call('cursor',l:pos) return '' endfunction -function s:others(p) - return "((line2byte(line('.')) + col('.')) <= ".(line2byte(a:p[0]) + a:p[1]).") || ".s:skip_expr -endfunction - -function s:tern_skip(p) - return s:GetPair('{','}','nbW',s:others(a:p),200,a:p[0]) > 0 -endfunction - -function s:tern_col(p) - return s:GetPair('?',':\@ 0 -endfunction - -function s:label_col() - let pos = getpos('.')[1:2] - let [s:looksyn,s:free] = pos - call s:alternatePair(0) - if s:save_pos('s:IsBlock') - let poss = getpos('.')[1:2] - return call('cursor',pos) || !s:tern_col(poss) - elseif s:looking_at() == ':' - return !s:tern_col([0,0]) +function s:expr_col() + if getline('.')[col('.')-2] == ':' + return 1 endif + let bal = 0 + while search('\m[{}?:;]','bW') + if eval(s:skip_expr) | continue | endif + " switch (looking_at()) + exe { '}': "if s:GetPair('{','}','bW',s:skip_expr,200) <= 0 | return | endif", + \ ';': "return", + \ '{': "return getpos('.')[1:2] != b:js_cache[1:] && !s:IsBlock()", + \ ':': "let bal -= getline('.')[max([col('.')-2,0]):col('.')] !~ '::'", + \ '?': "let bal += 1 | if bal > 0 | return 1 | endif" }[s:looking_at()] + endwhile endfunction " configurable regexes that define continuation lines, not including (, {, or [. let s:opfirst = '^' . get(g:,'javascript_opfirst', - \ '\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)') + \ '\C\%([<>=,?^%|*/&]\|\([-.:+]\)\1\@!\|!=\|in\%(stanceof\)\=\>\)') let s:continuation = get(g:,'javascript_continuation', - \ '\%([<=,.~!?/*^%|&:]\|+\@\|\<\%(typeof\|delete\|void\|in\|instanceof\)\)') . '$' + \ '\C\%([-+<>=,.~!?/*^%|&:]\|\<\%(typeof\|new\|delete\|void\|in\|instanceof\|await\)\)') . '$' function s:continues(ln,con) - return !cursor(a:ln, match(' '.a:con,s:continuation)) && - \ eval((['s:syn_at(line("."),col(".")) !~? "regex"'] + - \ repeat(['s:previous_token() != "."'],5) + [1])[ - \ index(split('/ typeof in instanceof void delete'),s:token())]) + if !cursor(a:ln, match(' '.a:con,s:continuation)) + let teol = s:looking_at() + if teol == '/' + return s:syn_at(line('.'),col('.')) !~? 'regex' + elseif teol =~ '[-+>]' + return getline('.')[col('.')-2] != tr(teol,'>','=') + elseif teol =~ '\l' + return s:previous_token() != '.' + elseif teol == ':' + return s:expr_col() + endif + return 1 + endif endfunction " get the line of code stripped of comments and move cursor to the last " non-comment char. function s:Trim(ln) let pline = substitute(getline(a:ln),'\s*$','','') - let l:max = max([match(pline,'.*[^/]\zs\/[/*]'),0]) - while l:max && s:syn_at(a:ln, strlen(pline)) =~? s:syng_com - let pline = substitute(strpart(pline, 0, l:max),'\s*$','','') - let l:max = max([match(pline,'.*[^/]\zs\/[/*]'),0]) + let l:max = max([strridx(pline,'//'), strridx(pline,'/*')]) + while l:max != -1 && s:syn_at(a:ln, strlen(pline)) =~? s:syng_com + let pline = pline[: l:max] + let l:max = max([strridx(pline,'//'), strridx(pline,'/*')]) + let pline = substitute(pline[:-2],'\s*$','','') endwhile - return cursor(a:ln,strlen(pline)) ? pline : pline + return pline is '' || cursor(a:ln,strlen(pline)) ? pline : pline endfunction " Find line above 'lnum' that isn't empty or in a comment function s:PrevCodeLine(lnum) - let l:n = prevnonblank(a:lnum) + let [l:pos, l:n] = [getpos('.')[1:2], prevnonblank(a:lnum)] while l:n if getline(l:n) =~ '^\s*\/[/*]' - if (stridx(getline(l:n),'`') > 0 || getline(l:n-1)[-1:] == '\') && - \ s:syn_at(l:n,1) =~? s:syng_str - return l:n - endif let l:n = prevnonblank(l:n-1) - elseif s:syn_at(l:n,1) =~? s:syng_com - let l:n = s:save_pos('eval', - \ 'cursor('.l:n.',1) + search(''\m\/\*'',"bW")') + elseif stridx(getline(l:n), '*/') + 1 && s:syn_at(l:n,1) =~? s:syng_com + call cursor(l:n,1) + keepjumps norm! [* + let l:n = search('\m\S','nbW') else - return l:n + break endif endwhile + call call('cursor',l:pos) + return l:n endfunction " Check if line 'lnum' has a balanced amount of parentheses. @@ -201,7 +214,9 @@ function s:Balanced(lnum) return endif endif - let pos = match(l:line, '[][(){}]', pos + 1) + let pos = match(l:line, (l:open ? + \ '['.escape(tr(l:line[pos],'({[]})',')}][{(').l:line[pos],']').']' : + \ '[][(){}]'), pos + 1) endwhile return !l:open endfunction @@ -210,11 +225,11 @@ function s:OneScope(lnum) let pline = s:Trim(a:lnum) let kw = 'else do' if pline[-1:] == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0 - call s:previous_token() - let kw = 'for if let while with' - if index(split('await each'),s:token()) + 1 + if s:previous_token() =~# '^\%(await\|each\)$' call s:previous_token() let kw = 'for' + else + let kw = 'for if let while with' endif endif return pline[-2:] == '=>' || index(split(kw),s:token()) + 1 && @@ -246,18 +261,23 @@ function s:IsBlock() if s:looking_at() == '{' let l:n = line('.') let char = s:previous_token() - let syn = char =~ '[{>/]' ? s:syn_at(line('.'),col('.')-(char == '{')) : '' - if syn =~? 'xml\|jsx' + if match(s:stack,'\cxml\|jsx') + 1 && s:syn_at(line('.'),col('.')-1) =~? 'xml\|jsx' return char != '{' elseif char =~ '\k' - return index(split('return const let import export yield default delete var await void typeof throw case new in instanceof') - \ ,char) < (line('.') != l:n) || s:previous_token() == '.' + if char ==# 'type' + return s:previous_token() !~# '^\%(im\|ex\)port$' + endif + return index(split('return const let import export extends yield default delete var await void typeof throw case new of in instanceof') + \ ,char) < (line('.') != l:n) || s:save_pos('s:previous_token') == '.' elseif char == '>' - return getline('.')[col('.')-2] == '=' || syn =~? '^jsflow' + return getline('.')[col('.')-2] == '=' || s:syn_at(line('.'),col('.')) =~? '^jsflow' elseif char == ':' - return getline('.')[col('.')-2] != ':' && s:label_col() + return !s:save_pos('s:expr_col') + elseif char == '/' + return s:syn_at(line('.'),col('.')) =~? 'regex' endif - return syn =~? 'regex' || char !~ '[-=~!<*+,/?^%|&([]' + return char !~ '[=~!<*,?^%|&([]' && + \ (char !~ '[-+]' || l:n != line('.') && getline('.')[col('.')-2] == char) endif endfunction @@ -266,7 +286,9 @@ function GetJavascriptIndent() " Get the current line. call cursor(v:lnum,1) let l:line = getline('.') - let syns = s:syn_at(v:lnum, 1) + " use synstack as it validates syn state and works in an empty line + let s:stack = map(synstack(v:lnum,1),"synIDattr(v:val,'name')") + let syns = get(s:stack,-1,'') " start with strings,comments,etc. if syns =~? s:syng_com @@ -275,7 +297,7 @@ function GetJavascriptIndent() elseif l:line !~ '^\s*\/[/*]' return -1 endif - elseif syns =~? s:syng_str && l:line !~ '^[''"]' + elseif syns =~? s:syng_str if b:js_cache[0] == v:lnum - 1 && s:Balanced(v:lnum-1) let b:js_cache[0] = v:lnum endif @@ -295,69 +317,60 @@ function GetJavascriptIndent() endif " the containing paren, bracket, or curly. Many hacks for performance - let idx = strlen(l:line) ? stridx('])}',l:line[0]) : -1 + let idx = index([']',')','}'],l:line[0]) if b:js_cache[0] >= l:lnum && b:js_cache[0] < v:lnum && \ (b:js_cache[0] > l:lnum || s:Balanced(l:lnum)) call call('cursor',b:js_cache[1:]) else - let [s:looksyn, s:free, top] = [v:lnum - 1, 1, (!indent(l:lnum) && + let [s:looksyn, s:checkIn, top] = [v:lnum - 1, 0, (!indent(l:lnum) && \ s:syn_at(l:lnum,1) !~? s:syng_str) * l:lnum] if idx + 1 - call s:GetPair(['\[','(','{'][idx], '])}'[idx],'bW','s:skip_func()',2000,top) - elseif indent(v:lnum) && syns =~? 'block' + call s:GetPair(['\[','(','{'][idx],'])}'[idx],'bW','s:skip_func()',2000,top) + elseif getline(v:lnum) !~ '^\S' && syns =~? 'block' call s:GetPair('{','}','bW','s:skip_func()',2000,top) else call s:alternatePair(top) endif endif - if idx + 1 || l:line[:1] == '|}' - if idx == 2 && search('\m\S','bW',line('.')) && s:looking_at() == ')' - call s:GetPair('(',')','bW',s:skip_expr,200) - endif - return indent('.') - endif - let b:js_cache = [v:lnum] + (line('.') == v:lnum ? [0,0] : getpos('.')[1:2]) let num = b:js_cache[1] let [s:W, isOp, bL, switch_offset] = [s:sw(),0,0,0] if !num || s:IsBlock() + let ilnum = line('.') let pline = s:save_pos('s:Trim',l:lnum) if num && s:looking_at() == ')' && s:GetPair('(', ')', 'bW', s:skip_expr, 100) > 0 - let num = line('.') - if s:previous_token() ==# 'switch' && s:previous_token() != '.' - if &cino !~ ':' || !has('float') + let num = ilnum == num ? line('.') : num + if idx < 0 && s:previous_token() ==# 'switch' && s:previous_token() != '.' + if &cino !~ ':' let switch_offset = s:W else - let cinc = matchlist(&cino,'.*:\(-\)\=\([0-9.]*\)\(s\)\=\C') - let switch_offset = float2nr(str2float(cinc[1].(strlen(cinc[2]) ? cinc[2] : strlen(cinc[3]))) - \ * (strlen(cinc[3]) ? s:W : 1)) + let switch_offset = max([-indent(num),s:parse_cino(':')]) endif if pline[-1:] != '.' && l:line =~# '^\%(default\|case\)\>' return indent(num) + switch_offset endif endif endif - if pline[-1:] !~ '[{;]' - if pline =~# ':\@ +" Last Change: 2017 Mar 21 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal cindent +setlocal cinoptions=L0,(0,Ws,J1,j1 +setlocal cinkeys=0{,0},!^F,o,O,0[,0] +" Don't think cinwords will actually do anything at all... never mind +setlocal cinwords=for,if,else,while,loop,impl,mod,unsafe,trait,struct,enum,fn,extern + +" Some preliminary settings +setlocal nolisp " Make sure lisp indenting doesn't supersede us +setlocal autoindent " indentexpr isn't much help otherwise +" Also do indentkeys, otherwise # gets shoved to column 0 :-/ +setlocal indentkeys=0{,0},!^F,o,O,0[,0] + +setlocal indentexpr=GetRustIndent(v:lnum) + +" Only define the function once. +if exists("*GetRustIndent") + finish +endif + +let s:save_cpo = &cpo +set cpo&vim + +" Come here when loading the script the first time. + +function! s:get_line_trimmed(lnum) + " Get the line and remove a trailing comment. + " Use syntax highlighting attributes when possible. + " NOTE: this is not accurate; /* */ or a line continuation could trick it + let line = getline(a:lnum) + let line_len = strlen(line) + if has('syntax_items') + " If the last character in the line is a comment, do a binary search for + " the start of the comment. synID() is slow, a linear search would take + " too long on a long line. + if synIDattr(synID(a:lnum, line_len, 1), "name") =~ 'Comment\|Todo' + let min = 1 + let max = line_len + while min < max + let col = (min + max) / 2 + if synIDattr(synID(a:lnum, col, 1), "name") =~ 'Comment\|Todo' + let max = col + else + let min = col + 1 + endif + endwhile + let line = strpart(line, 0, min - 1) + endif + return substitute(line, "\s*$", "", "") + else + " Sorry, this is not complete, nor fully correct (e.g. string "//"). + " Such is life. + return substitute(line, "\s*//.*$", "", "") + endif +endfunction + +function! s:is_string_comment(lnum, col) + if has('syntax_items') + for id in synstack(a:lnum, a:col) + let synname = synIDattr(id, "name") + if synname == "rustString" || synname =~ "^rustComment" + return 1 + endif + endfor + else + " without syntax, let's not even try + return 0 + endif +endfunction + +function GetRustIndent(lnum) + + " Starting assumption: cindent (called at the end) will do it right + " normally. We just want to fix up a few cases. + + let line = getline(a:lnum) + + if has('syntax_items') + let synname = synIDattr(synID(a:lnum, 1, 1), "name") + if synname == "rustString" + " If the start of the line is in a string, don't change the indent + return -1 + elseif synname =~ '\(Comment\|Todo\)' + \ && line !~ '^\s*/\*' " not /* opening line + if synname =~ "CommentML" " multi-line + if line !~ '^\s*\*' && getline(a:lnum - 1) =~ '^\s*/\*' + " This is (hopefully) the line after a /*, and it has no + " leader, so the correct indentation is that of the + " previous line. + return GetRustIndent(a:lnum - 1) + endif + endif + " If it's in a comment, let cindent take care of it now. This is + " for cases like "/*" where the next line should start " * ", not + " "* " as the code below would otherwise cause for module scope + " Fun fact: " /*\n*\n*/" takes two calls to get right! + return cindent(a:lnum) + endif + endif + + " cindent gets second and subsequent match patterns/struct members wrong, + " as it treats the comma as indicating an unfinished statement:: + " + " match a { + " b => c, + " d => e, + " f => g, + " }; + + " Search backwards for the previous non-empty line. + let prevlinenum = prevnonblank(a:lnum - 1) + let prevline = s:get_line_trimmed(prevlinenum) + while prevlinenum > 1 && prevline !~ '[^[:blank:]]' + let prevlinenum = prevnonblank(prevlinenum - 1) + let prevline = s:get_line_trimmed(prevlinenum) + endwhile + + " Handle where clauses nicely: subsequent values should line up nicely. + if prevline[len(prevline) - 1] == "," + \ && prevline =~# '^\s*where\s' + return indent(prevlinenum) + 6 + endif + + if prevline[len(prevline) - 1] == "," + \ && s:get_line_trimmed(a:lnum) !~ '^\s*[\[\]{}]' + \ && prevline !~ '^\s*fn\s' + \ && prevline !~ '([^()]\+,$' + \ && s:get_line_trimmed(a:lnum) !~ '^\s*\S\+\s*=>' + " Oh ho! The previous line ended in a comma! I bet cindent will try to + " take this too far... For now, let's normally use the previous line's + " indent. + + " One case where this doesn't work out is where *this* line contains + " square or curly brackets; then we normally *do* want to be indenting + " further. + " + " Another case where we don't want to is one like a function + " definition with arguments spread over multiple lines: + " + " fn foo(baz: Baz, + " baz: Baz) // <-- cindent gets this right by itself + " + " Another case is similar to the previous, except calling a function + " instead of defining it, or any conditional expression that leaves + " an open paren: + " + " foo(baz, + " baz); + " + " if baz && (foo || + " bar) { + " + " Another case is when the current line is a new match arm. + " + " There are probably other cases where we don't want to do this as + " well. Add them as needed. + return indent(prevlinenum) + endif + + if !has("patch-7.4.355") + " cindent before 7.4.355 doesn't do the module scope well at all; e.g.:: + " + " static FOO : &'static [bool] = [ + " true, + " false, + " false, + " true, + " ]; + " + " uh oh, next statement is indented further! + + " Note that this does *not* apply the line continuation pattern properly; + " that's too hard to do correctly for my liking at present, so I'll just + " start with these two main cases (square brackets and not returning to + " column zero) + + call cursor(a:lnum, 1) + if searchpair('{\|(', '', '}\|)', 'nbW', + \ 's:is_string_comment(line("."), col("."))') == 0 + if searchpair('\[', '', '\]', 'nbW', + \ 's:is_string_comment(line("."), col("."))') == 0 + " Global scope, should be zero + return 0 + else + " At the module scope, inside square brackets only + "if getline(a:lnum)[0] == ']' || search('\[', '', '\]', 'nW') == a:lnum + if line =~ "^\\s*]" + " It's the closing line, dedent it + return 0 + else + return &shiftwidth + endif + endif + endif + endif + + " Fall back on cindent, which does it mostly right + return cindent(a:lnum) +endfunction + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/syntax/rust.vim b/runtime/syntax/rust.vim new file mode 100644 index 0000000000..57343301e0 --- /dev/null +++ b/runtime/syntax/rust.vim @@ -0,0 +1,295 @@ +" Vim syntax file +" Language: Rust +" Maintainer: Patrick Walton +" Maintainer: Ben Blum +" Maintainer: Chris Morgan +" Last Change: Feb 24, 2016 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim + +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Syntax definitions {{{1 +" Basic keywords {{{2 +syn keyword rustConditional match if else +syn keyword rustRepeat for loop while +syn keyword rustTypedef type nextgroup=rustIdentifier skipwhite skipempty +syn keyword rustStructure struct enum nextgroup=rustIdentifier skipwhite skipempty +syn keyword rustUnion union nextgroup=rustIdentifier skipwhite skipempty contained +syn match rustUnionContextual /\/ + +syn keyword rustInvalidBareKeyword crate + +syn keyword rustPubScopeCrate crate contained +syn match rustPubScopeDelim /[()]/ contained +syn match rustPubScope /([^()]*)/ contained contains=rustPubScopeDelim,rustPubScopeCrate,rustSuper,rustModPath,rustModPathSep,rustSelf transparent + +syn keyword rustExternCrate crate contained nextgroup=rustIdentifier,rustExternCrateString skipwhite skipempty +" This is to get the `bar` part of `extern crate "foo" as bar;` highlighting. +syn match rustExternCrateString /".*"\_s*as/ contained nextgroup=rustIdentifier skipwhite transparent skipempty contains=rustString,rustOperator +syn keyword rustObsoleteExternMod mod contained nextgroup=rustIdentifier skipwhite skipempty + +syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained +syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained + +syn region rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained +" Ideally we'd have syntax rules set up to match arbitrary expressions. Since +" we don't, we'll just define temporary contained rules to handle balancing +" delimiters. +syn region rustBoxPlacementBalance start="(" end=")" containedin=rustBoxPlacement transparent +syn region rustBoxPlacementBalance start="\[" end="\]" containedin=rustBoxPlacement transparent +" {} are handled by rustFoldBraces + +syn region rustMacroRepeat matchgroup=rustMacroRepeatDelimiters start="$(" end=")" contains=TOP nextgroup=rustMacroRepeatCount +syn match rustMacroRepeatCount ".\?[*+]" contained +syn match rustMacroVariable "$\w\+" + +" Reserved (but not yet used) keywords {{{2 +syn keyword rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro + +" Built-in types {{{2 +syn keyword rustType isize usize char bool u8 u16 u32 u64 u128 f32 +syn keyword rustType f64 i8 i16 i32 i64 i128 str Self + +" Things from the libstd v1 prelude (src/libstd/prelude/v1.rs) {{{2 +" This section is just straight transformation of the contents of the prelude, +" to make it easy to update. + +" Reexported core operators {{{3 +syn keyword rustTrait Copy Send Sized Sync +syn keyword rustTrait Drop Fn FnMut FnOnce + +" Reexported functions {{{3 +" There’s no point in highlighting these; when one writes drop( or drop::< it +" gets the same highlighting anyway, and if someone writes `let drop = …;` we +" don’t really want *that* drop to be highlighted. +"syn keyword rustFunction drop + +" Reexported types and traits {{{3 +syn keyword rustTrait Box +syn keyword rustTrait ToOwned +syn keyword rustTrait Clone +syn keyword rustTrait PartialEq PartialOrd Eq Ord +syn keyword rustTrait AsRef AsMut Into From +syn keyword rustTrait Default +syn keyword rustTrait Iterator Extend IntoIterator +syn keyword rustTrait DoubleEndedIterator ExactSizeIterator +syn keyword rustEnum Option +syn keyword rustEnumVariant Some None +syn keyword rustEnum Result +syn keyword rustEnumVariant Ok Err +syn keyword rustTrait SliceConcatExt +syn keyword rustTrait String ToString +syn keyword rustTrait Vec + +" Other syntax {{{2 +syn keyword rustSelf self +syn keyword rustBoolean true false + +" If foo::bar changes to foo.bar, change this ("::" to "\."). +" If foo::bar changes to Foo::bar, change this (first "\w" to "\u"). +syn match rustModPath "\w\(\w\)*::[^<]"he=e-3,me=e-3 +syn match rustModPathSep "::" + +syn match rustFuncCall "\w\(\w\)*("he=e-1,me=e-1 +syn match rustFuncCall "\w\(\w\)*::<"he=e-3,me=e-3 " foo::(); + +" This is merely a convention; note also the use of [A-Z], restricting it to +" latin identifiers rather than the full Unicode uppercase. I have not used +" [:upper:] as it depends upon 'noignorecase' +"syn match rustCapsIdent display "[A-Z]\w\(\w\)*" + +syn match rustOperator display "\%(+\|-\|/\|*\|=\|\^\|&\||\|!\|>\|<\|%\)=\?" +" This one isn't *quite* right, as we could have binary-& with a reference +syn match rustSigil display /&\s\+[&~@*][^)= \t\r\n]/he=e-1,me=e-1 +syn match rustSigil display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1 +" This isn't actually correct; a closure with no arguments can be `|| { }`. +" Last, because the & in && isn't a sigil +syn match rustOperator display "&&\|||" +" This is rustArrowCharacter rather than rustArrow for the sake of matchparen, +" so it skips the ->; see http://stackoverflow.com/a/30309949 for details. +syn match rustArrowCharacter display "->" +syn match rustQuestionMark display "?\([a-zA-Z]\+\)\@!" + +syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustPanic +syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustPanic + +syn match rustEscapeError display contained /\\./ +syn match rustEscape display contained /\\\([nrt0\\'"]\|x\x\{2}\)/ +syn match rustEscapeUnicode display contained /\\u{\x\{1,6}}/ +syn match rustStringContinuation display contained /\\\n\s*/ +syn region rustString start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeError,rustStringContinuation +syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell +syn region rustString start='b\?r\z(#*\)"' end='"\z1' contains=@Spell + +syn region rustAttribute start="#!\?\[" end="\]" contains=rustString,rustDerive,rustCommentLine,rustCommentBlock,rustCommentLineDocError,rustCommentBlockDocError +syn region rustDerive start="derive(" end=")" contained contains=rustDeriveTrait +" This list comes from src/libsyntax/ext/deriving/mod.rs +" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show). +syn keyword rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy + +" Number literals +syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" +syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" +syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" +syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(size\|8\|16\|32\|64\|128\)\)\=" + +" Special case for numbers of the form "1." which are float literals, unless followed by +" an identifier, which makes them integer literals with a method call or field access, +" or by another ".", which makes them integer literals followed by the ".." token. +" (This must go first so the others take precedence.) +syn match rustFloat display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\|\.\)\@!" +" To mark a number as a normal float, it must have at least one of the three things integral values don't have: +" a decimal point and more numbers; an exponent; and a type suffix. +syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)\=" +syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\(f32\|f64\)\=" +syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)" + +" For the benefit of delimitMate +syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u{\x\{1,6}}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime +syn region rustGenericRegion display start=/<\%('\|[^[cntrl:][:space:][:punct:]]\)\@=')\S\@=/ end=/>/ contains=rustGenericLifetimeCandidate +syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime + +"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting +syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" +syn match rustLabel display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*:" +syn match rustCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/ +" The groups negated here add up to 0-255 but nothing else (they do not seem to go beyond ASCII). +syn match rustCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/ +syn match rustCharacter /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode +syn match rustCharacter /'\([^\\]\|\\\(.\|x\x\{2}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid + +syn match rustShebang /\%^#![^[].*/ +syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell +syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell +syn region rustCommentLineDocError start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell contained +syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell +syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell +syn region rustCommentBlockDocError matchgroup=rustCommentBlockDocError start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained +syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent +syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent +syn region rustCommentBlockDocNestError matchgroup=rustCommentBlockDocError start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNestError,@Spell contained transparent +" FIXME: this is a really ugly and not fully correct implementation. Most +" importantly, a case like ``/* */*`` should have the final ``*`` not being in +" a comment, but in practice at present it leaves comments open two levels +" deep. But as long as you stay away from that particular case, I *believe* +" the highlighting is correct. Due to the way Vim's syntax engine works +" (greedy for start matches, unlike Rust's tokeniser which is searching for +" the earliest-starting match, start or end), I believe this cannot be solved. +" Oh you who would fix it, don't bother with things like duplicating the Block +" rules and putting ``\*\@ Date: Tue, 7 Nov 2017 01:05:23 +0100 Subject: [PATCH 02/11] vim-patch:e0720cbf63eb Update runtime files. https://github.com/vim/vim/commit/e0720cbf63eb3045be8d965e3182c0c392c7b5e9 --- runtime/doc/filetype.txt | 4 +- runtime/doc/ft_rust.txt | 2 +- runtime/doc/message.txt | 7 + runtime/doc/usr_41.txt | 4 +- runtime/filetype.vim | 5 +- runtime/indent/php.vim | 73 ++++-- runtime/plugin/matchit.vim | 24 +- runtime/syntax/sas.vim | 482 ++++++++++++++++++------------------- 8 files changed, 324 insertions(+), 277 deletions(-) diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index ed223e57db..377864b128 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -309,12 +309,12 @@ define yourself. There are a few ways to avoid this: You need to define your own mapping before the plugin is loaded (before editing a file of that type). The plugin will then skip installing the default mapping. - + *no_mail_maps* 3. Disable defining mappings for a specific filetype by setting a variable, which contains the name of the filetype. For the "mail" filetype this would be: > :let no_mail_maps = 1 - +< *no_plugin_maps* 4. Disable defining mappings for all filetypes by setting a variable: > :let no_plugin_maps = 1 < diff --git a/runtime/doc/ft_rust.txt b/runtime/doc/ft_rust.txt index b6e974e371..c2e21e40bb 100644 --- a/runtime/doc/ft_rust.txt +++ b/runtime/doc/ft_rust.txt @@ -1,7 +1,7 @@ *ft_rust.txt* Filetype plugin for Rust ============================================================================== -CONTENTS *rust* *ft-rust* +CONTENTS *rust* 1. Introduction |rust-intro| 2. Settings |rust-settings| diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 904b9dfce4..c381b07330 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -744,6 +744,13 @@ a user-defined command. You tried to set an option after startup that only allows changes during startup. + *E943* > + Command table needs to be updated, run 'make cmdidxs' + +This can only happen when changing the source code, when adding a command in +src/ex_cmds.h. The lookup table then needs to be updated, by running: > + make cmdidxs + ============================================================================== 3. Messages *messages* diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 0f4e2767ab..be88a35369 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -2227,8 +2227,8 @@ plugin for the mail filetype: > endif Two global variables are used: -no_plugin_maps disables mappings for all filetype plugins -no_mail_maps disables mappings for a specific filetype +|no_plugin_maps| disables mappings for all filetype plugins +|no_mail_maps| disables mappings for the "mail" filetype USER COMMANDS diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 79fbcbca00..6de4f2fbb8 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2017 Mar 13 +" Last Change: 2017 Mar 27 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -284,7 +284,8 @@ au BufNewFile,BufRead *.bib setf bib au BufNewFile,BufRead *.bst setf bst " BIND configuration -au BufNewFile,BufRead named.conf,rndc.conf setf named +" sudoedit uses namedXXXX.conf +au BufNewFile,BufRead named*.conf,rndc*.conf setf named " BIND zone au BufNewFile,BufRead named.root setf bindzone diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index 07ecd8f141..06b49f3cb6 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -3,8 +3,8 @@ " Author: John Wellesz " URL: http://www.2072productions.com/vim/indent/php.vim " Home: https://github.com/2072/PHP-Indenting-for-VIm -" Last Change: 2015 September 8th -" Version: 1.60 +" Last Change: 2017 March 12th +" Version: 1.62 " " " Type :help php-indent for available options @@ -141,11 +141,13 @@ let s:PHP_validVariable = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\)' let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|\%(}\s*\)\?else\>\|do\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)' let s:functionDecl = '\\%(\s\+'.s:PHP_validVariable.'\)\=\s*(.*' -let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' +let s:endline = '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' +let s:unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@\)'.s:endline -let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$' +let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<\s*[''"]\=\a\w*[''"]\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)' let s:PHP_startindenttag = '\)\@!\|]*>\%(.*<\/script>\)\@!' +let s:structureHead = '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline . '\|\' @@ -214,10 +216,28 @@ function! GetLastRealCodeLNum(startline) " {{{ let lnum = lnum - 1 endwhile elseif lastline =~ '^[^''"`]*[''"`][;,]'.s:endline - let tofind=substitute( lastline, '^.*\([''"`]\)[;,].*$', '^[^\1]\\+[\1]$', '') - while getline(lnum) !~? tofind && lnum > 1 - let lnum = lnum - 1 + + let tofind=substitute( lastline, '^.*\([''"`]\)[;,].*$', '^[^\1]\\+[\1]$\\|^[^\1]\\+[=([]\\s*[\1]', '') + let trylnum = lnum + while getline(trylnum) !~? tofind && trylnum > 1 + let trylnum = trylnum - 1 endwhile + + if trylnum == 1 + break + else + if lastline =~ ';'.s:endline + while getline(trylnum) !~? s:terminated && getline(trylnum) !~? '{'.s:endline && trylnum > 1 + let trylnum = prevnonblank(trylnum - 1) + endwhile + + + if trylnum == 1 + break + end + end + let lnum = trylnum + end else break endif @@ -262,7 +282,7 @@ function! FindOpenBracket(lnum, blockStarter) " {{{ while line > 1 let linec = getline(line) - if linec =~ s:terminated || linec =~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline + if linec =~ s:terminated || linec =~ s:structureHead break endif @@ -273,6 +293,20 @@ function! FindOpenBracket(lnum, blockStarter) " {{{ return line endfun " }}} +let s:blockChars = {'{':1, '[': 1, '(': 1, ')':-1, ']':-1, '}':-1} +function! BalanceDirection (str) + + let balance = 0 + + for c in split(a:str, '\zs') + if has_key(s:blockChars, c) + let balance += s:blockChars[c] + endif + endfor + + return balance +endfun + function! FindTheIfOfAnElse (lnum, StopAfterFirstPrevElse) " {{{ if getline(a:lnum) =~# '^\s*}\s*else\%(if\)\=\>' @@ -457,7 +491,7 @@ function! GetPhpIndent() if synname!="" if synname == "SpecStringEntrails" - let b:InPHPcode = -1 + let b:InPHPcode = -1 " thumb down let b:InPHPcode_tofind = "" elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter" let b:InPHPcode = 1 @@ -540,7 +574,7 @@ function! GetPhpIndent() let b:InPHPcode_and_script = 1 endif - elseif last_line =~ '^[^''"`]\+[''"`]$' + elseif last_line =~ '^[^''"`]\+[''"`]$' " a string identifier with nothing after it and no other string identifier before let b:InPHPcode = -1 let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '') elseif last_line =~? '<<<\s*[''"]\=\a\w*[''"]\=$' @@ -660,7 +694,8 @@ function! GetPhpIndent() let terminated = s:terminated - let unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@\)'.endline + let unstated = s:unstated + if ind != b:PHP_default_indenting && cline =~# '^\s*else\%(if\)\=\>' let b:PHP_CurrentIndentLevel = b:PHP_default_indenting @@ -673,7 +708,7 @@ function! GetPhpIndent() while last_line_num > 1 - if previous_line =~ terminated || previous_line =~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . endline + if previous_line =~ terminated || previous_line =~ s:structureHead let ind = indent(last_line_num) @@ -689,7 +724,7 @@ function! GetPhpIndent() endwhile elseif last_line =~# unstated && cline !~ '^\s*);\='.endline - let ind = ind + s:sw() + let ind = ind + s:sw() " we indent one level further when the preceding line is not stated return ind + addSpecial elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated @@ -699,7 +734,7 @@ function! GetPhpIndent() let isSingleLineBlock = 0 while 1 - if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline + if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline " XXX call cursor(last_line_num, 1) if previous_line !~ '^}' @@ -780,10 +815,10 @@ function! GetPhpIndent() if !LastLineClosed - if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(\[]'.endline + if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(\[]'.endline && BalanceDirection(last_line) > 0 let dontIndent = 0 - if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*)\s*{'.endline && last_line !~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline + if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*[)\]]\+\s*{'.endline && last_line !~ s:structureHead let dontIndent = 1 endif @@ -797,9 +832,9 @@ function! GetPhpIndent() return ind + addSpecial endif - elseif last_line =~ '\S\+\s*),'.endline + elseif last_line =~ '\S\+\s*),'.endline && BalanceDirection(last_line) < 0 call cursor(lnum, 1) - call search('),'.endline, 'W') + call search('),'.endline, 'W') " line never begins with ) so no need for 'c' flag let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') if openedparent != lnum let ind = indent(openedparent) @@ -809,7 +844,7 @@ function! GetPhpIndent() let ind = ind + s:sw() - elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase + elseif AntepenultimateLine =~ '{'.endline && AntepenultimateLine !~? '^\s*use\>' || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase let ind = ind + s:sw() endif diff --git a/runtime/plugin/matchit.vim b/runtime/plugin/matchit.vim index f275f7b36d..a73b063766 100644 --- a/runtime/plugin/matchit.vim +++ b/runtime/plugin/matchit.vim @@ -1,7 +1,7 @@ " matchit.vim: (global plugin) Extended "%" matching -" Last Change: 2016 Aug 21 +" Last Change: 2017 March 26 " Maintainer: Benji Fisher PhD -" Version: 1.13.2, for Vim 6.3+ +" Version: 1.13.3, for Vim 6.3+ " Fix from Tommy Allen included. " Fix from Fernando Torres included. " Improvement from Ken Takata included. @@ -90,12 +90,15 @@ let s:notslash = '\\\@ -" Last Change: 2012 Apr 20 -" Corrected bug causing some keywords to appear as strings instead -" 18 Jul 2008 by Paulo Tanimoto -" Fixed comments with * taking multiple lines. -" Fixed highlighting of macro keywords. -" Added words to cases that didn't fit anywhere. -" 02 Jun 2003 -" Added highlighting for additional keywords and such; -" Attempted to match SAS default syntax colors; -" Changed syncing so it doesn't lose colors on large blocks; -" Much thanks to Bob Heckel for knowledgeable tweaking. -" quit when a syntax file was already loaded -if exists("b:current_syntax") - finish +" Language: SAS +" Maintainer: Zhen-Huan Hu +" Original Maintainer: James Kidd +" Version: 3.0.0 +" Last Change: Mar 10, 2017 +" +" 2017 Mar 7 +" +" Upgrade version number to 3.0. Improvements include: +" - Improve sync speed +" - Largely enhance precision +" - Update keywords in the latest SAS (as of Mar 2017) +" - Add syntaxes for date/time constants +" - Add syntax for data lines +" - Add (back) syntax for TODO in comments +" +" 2017 Feb 9 +" +" Add syntax folding +" +" 2016 Oct 10 +" +" Add highlighting for functions +" +" 2016 Sep 14 +" +" Change the implementation of syntaxing +" macro function names so that macro parameters same +" as SAS keywords won't be highlighted +" (Thank Joug Raw for the suggestion) +" Add section highlighting: +" - Use /** and **/ to define a section +" - It functions the same as a comment but +" with different highlighting +" +" 2016 Jun 14 +" +" Major changes so upgrade version number to 2.0 +" Overhaul the entire script (again). Improvements include: +" - Higher precision +" - Faster synchronization +" - Separate color for control statements +" - Highlight hash and java objects +" - Highlight macro variables in double quoted strings +" - Update all syntaxes based on SAS 9.4 +" - Add complete SAS/GRAPH and SAS/STAT procedure syntaxes +" - Add Proc TEMPLATE and GTL syntaxes +" - Add complete DS2 syntaxes +" - Add basic IML syntaxes +" - Many other improvements and bug fixes +" Drop support for VIM version < 600 + +if version < 600 + syntax clear +elseif exists('b:current_syntax') + finish endif +let s:cpo_save = &cpo +set cpo&vim + syn case ignore -syn region sasString start=+"+ skip=+\\\\\|\\"+ end=+"+ -syn region sasString start=+'+ skip=+\\\\\|\\"+ end=+'+ +" Basic SAS syntaxes +syn keyword sasOperator and eq ge gt in le lt ne not of or +syn keyword sasReserved _all_ _automatic_ _char_ _character_ _data_ _infile_ _last_ _n_ _name_ _null_ _num_ _numeric_ _temporary_ _user_ _webout_ +" Strings +syn region sasString start=+'+ skip=+''+ end=+'+ contains=@Spell +syn region sasString start=+"+ skip=+""+ end=+"+ contains=sasMacroVariable,@Spell +" Constants +syn match sasNumber /\v<\d+%(\.\d+)=%(>|e[\-+]=\d+>)/ display +syn match sasDateTime /\v(['"])\d{2}%(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d{2}%(\d{2})=:\d{2}:\d{2}%(:\d{2})=%(am|pm)\1dt>/ display +syn match sasDateTime /\v(['"])\d{2}%(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d{2}%(\d{2})=\1d>/ display +syn match sasDateTime /\v(['"])\d{2}:\d{2}%(:\d{2})=%(am|pm)\1t>/ display +" Comments +syn keyword sasTodo todo tbd fixme contained +syn region sasComment start='/\*' end='\*/' contains=sasTodo +syn region sasComment start='\v%(^|;)\s*\zs\%=\*' end=';'me=s-1 contains=sasTodo +syn region sasSectLbl matchgroup=sasSectLblEnds start='/\*\*\s*' end='\s*\*\*/' concealends +" Macros +syn match sasMacroVariable '\v\&+\w+%(\.\w+)=' display +syn match sasMacroReserved '\v\%%(abort|by|copy|display|do|else|end|global|goto|if|include|input|let|list|local|macro|mend|put|return|run|symdel|syscall|sysexec|syslput|sysrput|then|to|until|window|while)>' display +syn region sasMacroFunction matchgroup=sasMacroFunctionName start='\v\%\w+\ze\(' end=')'he=s-1 contains=@sasBasicSyntax,sasMacroFunction +syn region sasMacroFunction matchgroup=sasMacroFunctionName start='\v\%q=sysfunc\ze\(' end=')'he=s-1 contains=@sasBasicSyntax,sasMacroFunction,sasDataStepFunction +" Syntax cluster for basic SAS syntaxes +syn cluster sasBasicSyntax contains=sasOperator,sasReserved,sasNumber,sasDateTime,sasString,sasComment,sasMacroReserved,sasMacroFunction,sasMacroVariable,sasSectLbl -" Want region from 'cards;' to ';' to be captured (Bob Heckel) -syn region sasCards start="^\s*CARDS.*" end="^\s*;\s*$" -syn region sasCards start="^\s*DATALINES.*" end="^\s*;\s*$" +" Formats +syn match sasFormat '\v\$\w+\.' display contained +syn match sasFormat '\v<\w+\.%(\d+>)=' display contained +syn region sasFormatContext start='.' end=';'me=s-1 contained contains=@sasBasicSyntax,sasFormat -syn match sasNumber "-\=\<\d*\.\=[0-9_]\>" +" Define global statements that can be accessed out of data step or procedures +syn keyword sasGlobalStatementKeyword catname dm endsas filename footnote footnote1 footnote2 footnote3 footnote4 footnote5 footnote6 footnote7 footnote8 footnote9 footnote10 missing libname lock ods options page quit resetline run sasfile skip sysecho title title1 title2 title3 title4 title5 title6 title7 title8 title9 title10 contained +syn keyword sasGlobalStatementODSKeyword chtml csvall docbook document escapechar epub epub2 epub3 exclude excel graphics html html3 html5 htmlcss imode listing markup output package path pcl pdf preferences phtml powerpoint printer proclabel proctitle ps results rtf select show tagsets trace usegopt verify wml contained +syn match sasGlobalStatement '\v%(^|;)\s*\zs\h\w*>' display transparent contains=sasGlobalStatementKeyword +syn match sasGlobalStatement '\v%(^|;)\s*\zsods>' display transparent contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty -" Block comment -syn region sasComment start="/\*" end="\*/" contains=sasTodo +" Data step statements, 9.4 +syn keyword sasDataStepFunctionName abs addr addrlong airy allcomb allperm anyalnum anyalpha anycntrl anydigit anyfirst anygraph anylower anyname anyprint anypunct anyspace anyupper anyxdigit arcos arcosh arsin arsinh artanh atan atan2 attrc attrn band beta betainv blackclprc blackptprc blkshclprc blkshptprc blshift bnot bor brshift bxor byte cat catq cats catt catx cdf ceil ceilz cexist char choosec choosen cinv close cmiss cnonct coalesce coalescec collate comb compare compbl compfuzz compged complev compound compress constant convx convxp cos cosh cot count countc countw csc css cumipmt cumprinc curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datdif date datejul datepart datetime day dclose dcreate depdb depdbsl depsl depsyd deptab dequote deviance dhms dif digamma dim dinfo divide dnum dopen doptname doptnum dosubl dread dropnote dsname dsncatlgd dur durp effrate envlen erf erfc euclid exist exp fact fappend fclose fcol fcopy fdelete fetch fetchobs fexist fget fileexist filename fileref finance find findc findw finfo finv fipname fipnamel fipstate first floor floorz fmtinfo fnonct fnote fopen foptname foptnum fpoint fpos fput fread frewind frlen fsep fuzz fwrite gaminv gamma garkhclprc garkhptprc gcd geodist geomean geomeanz getoption getvarc getvarn graycode harmean harmeanz hbound hms holiday holidayck holidaycount holidayname holidaynx holidayny holidaytest hour htmldecode htmlencode ibessel ifc ifn index indexc indexw input inputc inputn int intcindex intck intcycle intfit intfmt intget intindex intnx intrr intseas intshift inttest intz iorcmsg ipmt iqr irr jbessel juldate juldate7 kurtosis lag largest lbound lcm lcomb left length lengthc lengthm lengthn lexcomb lexcombi lexperk lexperm lfact lgamma libname libref log log1px log10 log2 logbeta logcdf logistic logpdf logsdf lowcase lperm lpnorm mad margrclprc margrptprc max md5 mdy mean median min minute missing mod modexist module modulec modulen modz month mopen mort msplint mvalid contained +syn keyword sasDataStepFunctionName n netpv nliteral nmiss nomrate normal notalnum notalpha notcntrl notdigit note notfirst notgraph notlower notname notprint notpunct notspace notupper notxdigit npv nvalid nwkdom open ordinal pathname pctl pdf peek peekc peekclong peeklong perm pmt point poisson ppmt probbeta probbnml probbnrm probchi probf probgam probhypr probit probmc probnegb probnorm probt propcase prxchange prxmatch prxparen prxparse prxposn ptrlongadd put putc putn pvp qtr quantile quote ranbin rancau rand ranexp rangam range rank rannor ranpoi rantbl rantri ranuni rename repeat resolve reverse rewind right rms round rounde roundz saving savings scan sdf sec second sha256 sha256hex sha256hmachex sign sin sinh skewness sleep smallest soapweb soapwebmeta soapwipservice soapwipsrs soapws soapwsmeta soundex spedis sqrt squantile std stderr stfips stname stnamel strip subpad substr substrn sum sumabs symexist symget symglobl symlocal sysexist sysget sysmsg sysparm sysprocessid sysprocessname sysprod sysrc system tan tanh time timepart timevalue tinv tnonct today translate transtrn tranwrd trigamma trim trimn trunc tso typeof tzoneid tzonename tzoneoff tzones2u tzoneu2s uniform upcase urldecode urlencode uss uuidgen var varfmt varinfmt varlabel varlen varname varnum varray varrayx vartype verify vformat vformatd vformatdx vformatn vformatnx vformatw vformatwx vformatx vinarray vinarrayx vinformat vinformatd vinformatdx vinformatn vinformatnx vinformatw vinformatwx vinformatx vlabel vlabelx vlength vlengthx vname vnamex vtype vtypex vvalue vvaluex week weekday whichc whichn wto year yieldp yrdif yyq zipcity zipcitydistance zipfips zipname zipnamel zipstate contained +syn keyword sasDataStepCallRoutineName allcomb allcombi allperm cats catt catx compcost execute graycode is8601_convert label lexcomb lexcombi lexperk lexperm logistic missing module poke pokelong prxchange prxdebug prxfree prxnext prxposn prxsubstr ranbin rancau rancomb ranexp rangam rannor ranperk ranperm ranpoi rantbl rantri ranuni scan set sleep softmax sortc sortn stdize streaminit symput symputx system tanh tso vname vnext wto contained +syn region sasDataStepFunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasDataStepFunction +syn region sasDataStepFunctionFormatContext start='(' end=')' contained contains=@sasBasicSyntax,sasDataStepFunction,sasFormat +syn match sasDataStepFunction '\v<\w+\ze\(' contained contains=sasDataStepFunctionName,sasDataStepCallRoutineName nextgroup=sasDataStepFunctionContext +syn match sasDataStepFunction '\v%(input|put)\ze\(' contained contains=sasDataStepFunctionName nextgroup=sasDataStepFunctionFormatContext +syn keyword sasDataStepHashMethodName add check clear definedata definedone definekey delete do_over equals find find_next find_prev first has_next has_prev last next output prev ref remove removedup replace replacedup reset_dup setcur sum sumdup contained +syn region sasDataStepHashMethodContext start='(' end=')' contained contains=@sasBasicSyntax,sasDataStepFunction +syn match sasDataStepHashMethod '\v\.\w+\ze\(' contained contains=sasDataStepHashMethodName nextgroup=sasDataStepHashMethodContext +syn keyword sasDataStepHashAttributeName item_size num_items contained +syn match sasDataStepHashAttribute '\v\.\w+>\ze\_[^(]' display contained contains=sasDataStepHashAttributeName +syn keyword sasDataStepControl continue do end go goto if leave link otherwise over return select to until when while contained +syn keyword sasDataStepControl else then contained nextgroup=sasDataStepStatementKeyword skipwhite skipnl skipempty +syn keyword sasDataStepHashOperator _new_ contained +syn keyword sasDataStepStatementKeyword abort array attrib by call cards cards4 datalines datalines4 dcl declare delete describe display drop error execute file format infile informat input keep label length lines lines4 list lostcard merge modify output put putlog redirect remove rename replace retain set stop update where window contained +syn keyword sasDataStepStatementHashKeyword hash hiter javaobj contained +syn match sasDataStepStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasDataStepStatementKeyword,sasGlobalStatementKeyword +syn match sasDataStepStatement '\v%(^|;)\s*\zs%(dcl|declare)>' display contained contains=sasDataStepStatementKeyword nextgroup=sasDataStepStatementHashKeyword skipwhite skipnl skipempty +syn match sasDataStepStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn match sasDataStepStatement '\v%(^|;)\s*\zs%(format|informat|input|put)>' display contained contains=sasDataStepStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn match sasDataStepStatement '\v%(^|;)\s*\zs%(cards|datalines|lines)4=\s*;' display contained contains=sasDataStepStatementKeyword nextgroup=sasDataLine skipwhite skipnl skipempty +syn region sasDataLine start='^' end='^;'me=s-1 contained +syn region sasDataStep matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsdata>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,@sasDataStepSyntax +syn cluster sasDataStepSyntax contains=sasDataStepFunction,sasDataStepHashOperator,sasDataStepHashAttribute,sasDataStepHashMethod,sasDataStepControl,sasDataStepStatement -" Ignore misleading //JCL SYNTAX... (Bob Heckel) -syn region sasComment start="[^/][^/]/\*" end="\*/" contains=sasTodo +" Procedures, base SAS, 9.4 +syn keyword sasProcStatementKeyword abort age append array attrib audit block break by calid cdfplot change checkbox class classlev column compute contents copy create datarow dbencoding define delete deletefunc deletesubr delimiter device dialog dur endcomp exact exchange exclude explore fin fmtlib fontfile fontpath format formats freq function getnames guessingrows hbar hdfs histogram holidur holifin holistart holivar id idlabel informat inset invalue item key keylabel keyword label line link listfunc listsubr mapmiss mapreduce mean menu messages meta modify opentype outargs outdur outfin output outstart pageby partial picture pie pig plot ppplot printer probplot profile prompter qqplot radiobox ranks rbreak rbutton rebuild record remove rename repair report roptions save select selection separator source star start statistics struct submenu subroutine sum sumby table tables test text trantab truetype type1 types value var vbar ways weight where with write contained +syn match sasProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasProcStatementKeyword,sasGlobalStatementKeyword +syn match sasProcStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn match sasProcStatement '\v%(^|;)\s*\zs%(format|informat)>' display contained contains=sasProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn region sasProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc%(\s+\h\w*)=>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasProcStatement +syn region sasProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(catalog|chart|datasets|document|plot)>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasProcStatement -" Previous code for comments was written by Bob Heckel -" Comments with * may take multiple lines (Paulo Tanimoto) -syn region sasComment start=";\s*\*"hs=s+1 end=";" contains=sasTodo +" Procedures, SAS/GRAPH, 9.4 +syn keyword sasGraphProcStatementKeyword add area axis bar block bubble2 byline cc ccopy cdef cdelete chart cmap choro copy delete device dial donut exclude flow format fs goptions gout grid group hbar hbar3d hbullet hslider htrafficlight id igout label legend list modify move nobyline note pattern pie pie3d plot plot2 preview prism quit rename replay select scatter speedometer star surface symbol tc tcopy tdef tdelete template tile toggle treplay vbar vbar3d vtrafficlight vbullet vslider where contained +syn match sasGraphProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasGraphProcStatementKeyword,sasGlobalStatementKeyword +syn match sasGraphProcStatement '\v%(^|;)\s*\zsformat>' display contained contains=sasGraphProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn region sasGraphProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(g3d|g3grid|ganno|gcontour|gdevice|geocode|gfont|ginside|goptions|gproject|greduce|gremove|mapimport)>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasGraphProcStatement +syn region sasGraphProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(gareabar|gbarline|gchart|gkpi|gmap|gplot|gradar|greplay|gslide|gtile)>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasGraphProcStatement -" Comments with * starting after a semicolon (Paulo Tanimoto) -syn region sasComment start="^\s*\*" end=";" contains=sasTodo +" Procedures, SAS/STAT, 14.1 +syn keyword sasAnalyticalProcStatementKeyword absorb add array assess baseline bayes beginnodata bivar bootstrap bounds by cdfplot cells class cluster code compute condition contrast control coordinates copy cosan cov covtest coxreg der design determ deviance direct directions domain effect effectplot effpart em endnodata equality estimate exact exactoptions factor factors fcs filter fitindex format freq fwdlink gender grid group grow hazardratio height hyperprior id impjoint inset insetgroup invar invlink ippplot lincon lineqs lismod lmtests location logistic loglin lpredplot lsmeans lsmestimate manova matings matrix mcmc mean means missmodel mnar model modelaverage modeleffects monotone mstruct mtest multreg name nlincon nloptions oddsratio onecorr onesamplefreq onesamplemeans onewayanova outfiles output paired pairedfreq pairedmeans parameters parent parms partial partition path pathdiagram pcov performance plot population poststrata power preddist predict predpplot priors process probmodel profile prune pvar ram random ratio reference refit refmodel renameparm repeated replicate repweights response restore restrict retain reweight ridge rmsstd roc roccontrast rules samplesize samplingunit seed size scale score selection show simtests simulate slice std stderr store strata structeq supplementary table tables test testclass testfreq testfunc testid time transform treatments trend twosamplefreq twosamplemeans towsamplesurvival twosamplewilcoxon uds units univar var variance varnames weight where with zeromodel contained +syn match sasAnalyticalProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasAnalyticalProcStatementKeyword,sasGlobalStatementKeyword +syn match sasAnalyticalProcStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn match sasAnalyticalProcStatement '\v%(^|;)\s*\zsformat>' display contained contains=sasAnalyticalProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn region sasAnalyticalProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(aceclus|adaptivereg|bchoice|boxplot|calis|cancorr|candisc|cluster|corresp|discrim|distance|factor|fastclus|fmm|freq|gam|gampl|gee|genmod|glimmix|glmmod|glmpower|glmselect|hpcandisc|hpfmm|hpgenselect|hplmixed|hplogistic|hpmixed|hpnlmod|hppls|hpprincomp|hpquantselect|hpreg|hpsplit|iclifetest|icphreg|inbreed|irt|kde|krige2d|lattice|lifereg|lifetest|loess|logistic|mcmc|mds|mi|mianalyze|mixed|modeclus|multtest|nested|nlin|nlmixed|npar1way|orthoreg|phreg|plm|pls|power|princomp|prinqual|probit|quantlife|quantreg|quantselect|robustreg|rsreg|score|seqdesign|seqtest|sim2d|simnormal|spp|stdize|stdrate|stepdisc|surveyfreq|surveyimpute|surveylogistic|surveymeans|surveyphreg|surveyreg|surveyselect|tpspline|transreg|tree|ttest|varclus|varcomp|variogram)>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepControl,sasDataStepFunction,sasAnalyticalProcStatement +syn region sasAnalyticalProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(anova|arima|catmod|factex|glm|model|optex|plan|reg)>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepControl,sasDataStepFunction,sasAnalyticalProcStatement -" This line defines macro variables in code. "hi def link" at end of file -" defines the color scheme. Begin region with ampersand and end with -" any non-word character offset by -1; put ampersand in the skip list -" just in case it is used to concatenate macro variable values. +" Procedures, ODS graphics, 9.4 +syn keyword sasODSGraphicsProcStatementKeyword band block bubble by colaxis compare dattrvar density dot dropline dynamic ellipse ellipseparm format fringe gradlegend hbar hbarbasic hbarparm hbox heatmap heatmapparm highlow histogram hline inset keylegend label lineparm loess matrix needle parent panelby pbspline plot polygon refline reg rowaxis scatter series spline step style styleattrs symbolchar symbolimage text vbar vbarbasic vbarparm vbox vector vline waterfall where xaxis x2axis yaxis y2axis yaxistable contained +syn match sasODSGraphicsProcStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasODSGraphicsProcStatementKeyword,sasGlobalStatementKeyword +syn match sasODSGraphicsProcStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn match sasODSGraphicsProcStatement '\v%(^|;)\s*\zsformat>' display contained contains=sasODSGraphicsProcStatementKeyword nextgroup=sasFormatContext skipwhite skipnl skipempty +syn region sasODSGraphicsProc matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+%(sgdesign|sgpanel|sgplot|sgrender|sgscatter)>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDataStepFunction,sasODSGraphicsProcStatement -" Thanks to ronald hllwarth for this fix to an intra-versioning -" problem with this little feature +" Proc TEMPLATE, 9.4 +syn keyword sasProcTemplateClause as into +syn keyword sasProcTemplateStatementKeyword block break cellstyle class close column compute continue define delete delstream do done dynamic edit else end eval flush footer header import iterate link list mvar ndent next nmvar notes open path put putl putlog putq putstream putvars replace set source stop style test text text2 text3 translate trigger unblock unset xdent contained +syn keyword sasProcTemplateStatementComplexKeyword cellvalue column crosstabs event footer header statgraph style table tagset contained +syn keyword sasProcTemplateGTLStatementKeyword axislegend axistable bandplot barchart barchartparm begingraph beginpolygon beginpolyline bihistogram3dparm blockplot boxplot boxplotparm bubbleplot continuouslegend contourplotparm dendrogram discretelegend drawarrow drawimage drawline drawoval drawrectangle drawtext dropline ellipse ellipseparm endgraph endinnermargin endlayout endpolygon endpolyline endsidebar entry entryfootnote entrytitle fringeplot heatmap heatmapparm highlowplot histogram histogramparm innermargin layout legenditem legendtextitems linechart lineparm loessplot mergedlegend modelband needleplot pbsplineplot polygonplot referenceline regressionplot scatterplot seriesplot sidebar stepplot surfaceplotparm symbolchar symbolimage textplot vectorplot waterfallchart contained +syn keyword sasProcTemplateGTLComplexKeyword datalattice datapanel globallegend gridded lattice overlay overlayequated overlay3d region contained +syn match sasProcTemplateStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasProcTemplateStatementKeyword,sasProcTemplateGTLStatementKeyword,sasGlobalStatementKeyword +syn match sasProcTemplateStatement '\v%(^|;)\s*\zsdefine>' display contained contains=sasProcTemplateStatementKeyword nextgroup=sasProcTemplateStatementComplexKeyword skipwhite skipnl skipempty +syn match sasProcTemplateStatement '\v%(^|;)\s*\zslayout>' display contained contains=sasProcTemplateGTLStatementKeyword nextgroup=sasProcTemplateGTLComplexKeyword skipwhite skipnl skipempty +syn match sasProcTemplateStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn region sasProcTemplate matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+template>' end='\v%(^|;)\s*%(run|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasProcTemplateClause,sasProcTemplateStatement -syn region sasMacroVar start="&" skip="[_&]" end="\W"he=e-1 +" Proc SQL, 9.4 +syn keyword sasProcSQLFunctionName avg count css cv freq max mean median min n nmiss prt range std stderr sum sumwgt t uss var contained +syn region sasProcSQLFunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasProcSQLFunction +syn match sasProcSQLFunction '\v<\w+\ze\(' contained contains=sasProcSQLFunctionName,sasDataStepFunctionName nextgroup=sasProcSQLFunctionContext +syn keyword sasProcSQLClause add asc between by calculated cascade case check connection constraint cross desc distinct drop else end escape except exists foreign from full group having in inner intersect into is join key left libname like modify natural newline notrim null on order outer primary references restrict right separated set then to trimmed union unique user using values when where contained +syn keyword sasProcSQLClause as contained nextgroup=sasProcSQLStatementKeyword skipwhite skipnl skipempty +syn keyword sasProcSQLStatementKeyword connect delete disconnect execute insert reset select update validate contained +syn keyword sasProcSQLStatementComplexKeyword alter create describe drop contained nextgroup=sasProcSQLStatementNextKeyword skipwhite skipnl skipempty +syn keyword sasProcSQLStatementNextKeyword index table view contained +syn match sasProcSQLStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasProcSQLStatementKeyword,sasGlobalStatementKeyword +syn match sasProcSQLStatement '\v%(^|;)\s*\zs%(alter|create|describe|drop)>' display contained contains=sasProcSQLStatementComplexKeyword nextgroup=sasProcSQLStatementNextKeyword skipwhite skipnl skipempty +syn match sasProcSQLStatement '\v%(^|;)\s*\zsvalidate>' display contained contains=sasProcSQLStatementKeyword nextgroup=sasProcSQLStatementKeyword,sasProcSQLStatementComplexKeyword skipwhite skipnl skipempty +syn match sasProcSQLStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn region sasProcSQL matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+sql>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasProcSQLFunction,sasProcSQLClause,sasProcSQLStatement +" SAS/DS2, 9.4 +syn keyword sasDS2FunctionName abs anyalnum anyalpha anycntrl anydigit anyfirst anygraph anylower anyname anyprint anypunct anyspace anyupper anyxdigit arcos arcosh arsin arsinh artanh atan atan2 band beta betainv blackclprc blackptprc blkshclprc blkshptprc blshift bnot bor brshift bxor byte cat cats catt catx ceil ceilz choosec choosen cmp cmpt coalesce coalescec comb compare compbl compfuzz compound compress constant convx convxp cos cosh count countc countw css cumipmt cumprinc cv datdif date datejul datepart datetime day dequote deviance dhms dif digamma dim divide dur durp effrate erf erfc exp fact find findc findw floor floorz fmtinfo fuzz gaminv gamma garkhclprc garkhptprc gcd geodist geomean geomeanz harmean harmeanz hbound hms holiday hour index indexc indexw inputc inputn int intcindex intck intcycle intdt intfit intget intindex intnest intnx intrr intseas intshift inttest intts intz ipmt iqr irr juldate juldate7 kcount kstrcat kstrip kupdate kupdates kurtosis lag largest lbound lcm left length lengthc lengthm lengthn lgamma log logbeta log10 log1px log2 lowcase mad margrclprc margrptprc max md5 mdy mean median min minute missing mod modz month mort n ndims netpv nmiss nomrate notalnum notalpha notcntrl notdigit notfirst notgraph notlower notname notprint notpunct notspace notupper notxdigit npv null nwkdom ordinal pctl perm pmt poisson power ppmt probbeta probbnml probbnrm probchi probdf probf probgam probhypr probit probmc probmed probnegb probnorm probt prxchange prxmatch prxparse prxposn put pvp qtr quote ranbin rancau rand ranexp rangam range rank rannor ranpoi rantbl rantri ranuni repeat reverse right rms round rounde roundz savings scan sec second sha256hex sha256hmachex sign sin sinh skewness sleep smallest sqlexec sqrt std stderr streaminit strip substr substrn sum sumabs tan tanh time timepart timevalue tinv to_date to_double to_time to_timestamp today translate transtrn tranwrd trigamma trim trimn trunc uniform upcase uss uuidgen var verify vformat vinarray vinformat vlabel vlength vname vtype week weekday whichc whichn year yieldp yrdif yyq contained +syn region sasDS2FunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasDS2Function +syn match sasDS2Function '\v<\w+\ze\(' contained contains=sasDS2FunctionName nextgroup=sasDS2FunctionContext +syn keyword sasDS2Control continue data dcl declare do drop else end enddata endpackage endthread from go goto if leave method otherwise package point return select then thread to until when while contained +syn keyword sasDS2StatementKeyword array by forward keep merge output put rename retain set stop vararray varlist contained +syn keyword sasDS2StatementComplexKeyword package thread contained +syn match sasDS2Statement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasDS2StatementKeyword,sasGlobalStatementKeyword +syn match sasDS2Statement '\v%(^|;)\s*\zs%(dcl|declare|drop)>' display contained contains=sasDS2StatementKeyword nextgroup=sasDS2StatementComplexKeyword skipwhite skipnl skipempty +syn match sasDS2Statement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn region sasDS2 matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+ds2>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasDS2Function,sasDS2Control,sasDS2Statement -" I dont think specific PROCs need to be listed if use this line (Bob Heckel). -syn match sasProc "^\s*PROC \w\+" -syn keyword sasStep RUN QUIT DATA +" SAS/IML, 14.1 +syn keyword sasIMLFunctionName abs all allcomb allperm any apply armasim bin blankstr block branks bspline btran byte char choose col colvec concat contents convexit corr corr2cov countmiss countn countunique cov cov2corr covlag cshape cusum cuprod cv cvexhull datasets design designf det diag dif dimension distance do duration echelon eigval eigvec element exp expmatrix expandgrid fft forward froot full gasetup geomean ginv hadamard half hankel harmean hdir hermite homogen i ifft insert int inv invupdt isempty isskipped j jroot kurtosis lag length loc log logabsdet mad magic mahalanobis max mean median min mod moduleic modulein name ncol ndx2sub nleng norm normal nrow num opscal orpol parentname palette polyroot prod product pv quartile rancomb randdirichlet randfun randmultinomial randmvt randnormal randwishart ranperk ranperm range rank ranktie rates ratio remove repeat root row rowcat rowcatc rowvec rsubstr sample setdif shape shapecol skewness solve sparse splinev spot sqrsym sqrt sqrvech ssq standard std storage sub2ndx substr sum sweep symsqr t toeplitz trace trisolv type uniform union unique uniqueby value var vecdiag vech xmult xsect yield contained +syn keyword sasIMLCallRoutineName appcort armacov armalik bar box change comport delete eigen execute exportdatasettor exportmatrixtor farmacov farmafit farmalik farmasim fdif gaend gagetmem gagetval gainit gareeval garegen gasetcro gasetmut gasetobj gasetsel gblkvp gblkvpd gclose gdelete gdraw gdrawl geneig ggrid ginclude gopen gpie gpiexy gpoint gpoly gport gportpop gportstk gscale gscript gset gshow gsorth gstart gstop gstrlen gtext gvtext gwindow gxaxis gyaxis heatmapcont heatmapdisc histogram importdatasetfromr importmatrixfromr ipf itsolver kalcvf kalcvs kaldff kaldfs lav lcp lms lp lpsolve lts lupdt marg maxqform mcd milpsolve modulei mve nlpcg nlpdd nlpfdd nlpfea nlphqn nlplm nlpnms nlpnra nlpnrr nlpqn nlpqua nlptr ode odsgraph ortvec pgraf push qntl qr quad queue randgen randseed rdodt rupdt rename rupdt rzlind scatter seq seqscale seqshift seqscale seqshift series solvelin sort sortndx sound spline splinec svd tabulate tpspline tpsplnev tsbaysea tsdecomp tsmlocar tsmlomar tsmulmar tspears tspred tsroot tstvcar tsunimar valset varmacov varmalik varmasim vnormal vtsroot wavft wavget wavift wavprint wavthrsh contained +syn region sasIMLFunctionContext start='(' end=')' contained contains=@sasBasicSyntax,sasIMLFunction +syn match sasIMLFunction '\v<\w+\ze\(' contained contains=sasIMLFunctionName,sasDataStepFunction nextgroup=sasIMLFunctionContext +syn keyword sasIMLControl abort by do else end finish goto if link pause quit resume return run start stop then to until while contained +syn keyword sasIMLStatementKeyword append call close closefile create delete display edit file find force free index infile input list load mattrib print purge read remove replace reset save setin setout show sort store summary use window contained +syn match sasIMLStatement '\v%(^|;)\s*\zs\h\w*>' display contained contains=sasIMLStatementKeyword,sasGlobalStatementKeyword +syn match sasIMLStatement '\v%(^|;)\s*\zsods>' display contained contains=sasGlobalStatementKeyword nextgroup=sasGlobalStatementODSKeyword skipwhite skipnl skipempty +syn region sasIML matchgroup=sasSectionKeyword start='\v%(^|;)\s*\zsproc\s+iml>' end='\v%(^|;)\s*%(quit|data|proc|endsas)>'me=s-1 fold contains=@sasBasicSyntax,sasIMLFunction,sasIMLControl,sasIMLStatement +" Macro definition +syn region sasMacro start='\v\%macro>' end='\v\%mend>' fold keepend contains=@sasBasicSyntax,@sasDataStepSyntax,sasDataStep,sasProc,sasODSGraphicsProc,sasGraphProc,sasAnalyticalProc,sasProcTemplate,sasProcSQL,sasDS2,sasIML -" Base SAS Procs - version 8.1 - -syn keyword sasConditional DO ELSE END IF THEN UNTIL WHILE - -syn keyword sasStatement ABORT ARRAY ATTRIB BY CALL CARDS CARDS4 CATNAME -syn keyword sasStatement CONTINUE DATALINES DATALINES4 DELETE DISPLAY -syn keyword sasStatement DM DROP ENDSAS ERROR FILE FILENAME FOOTNOTE -syn keyword sasStatement FORMAT GOTO INFILE INFORMAT INPUT KEEP -syn keyword sasStatement LABEL LEAVE LENGTH LIBNAME LINK LIST LOSTCARD -syn keyword sasStatement MERGE MISSING MODIFY OPTIONS OUTPUT PAGE -syn keyword sasStatement PUT REDIRECT REMOVE RENAME REPLACE RETAIN -syn keyword sasStatement RETURN SELECT SET SKIP STARTSAS STOP TITLE -syn keyword sasStatement UPDATE WAITSAS WHERE WINDOW X SYSTASK - -" Keywords that are used in Proc SQL -" I left them as statements because SAS's enhanced editor highlights -" them the same as normal statements used in data steps (Jim Kidd) - -syn keyword sasStatement ADD AND ALTER AS CASCADE CHECK CREATE -syn keyword sasStatement DELETE DESCRIBE DISTINCT DROP FOREIGN -syn keyword sasStatement FROM GROUP HAVING INDEX INSERT INTO IN -syn keyword sasStatement KEY LIKE MESSAGE MODIFY MSGTYPE NOT -syn keyword sasStatement NULL ON OR ORDER PRIMARY REFERENCES -syn keyword sasStatement RESET RESTRICT SELECT SET TABLE -syn keyword sasStatement UNIQUE UPDATE VALIDATE VIEW WHERE - -" Match declarations have to appear one per line (Paulo Tanimoto) -syn match sasStatement "FOOTNOTE\d" -syn match sasStatement "TITLE\d" - -" Match declarations have to appear one per line (Paulo Tanimoto) -syn match sasMacro "%BQUOTE" -syn match sasMacro "%NRBQUOTE" -syn match sasMacro "%CMPRES" -syn match sasMacro "%QCMPRES" -syn match sasMacro "%COMPSTOR" -syn match sasMacro "%DATATYP" -syn match sasMacro "%DISPLAY" -syn match sasMacro "%DO" -syn match sasMacro "%ELSE" -syn match sasMacro "%END" -syn match sasMacro "%EVAL" -syn match sasMacro "%GLOBAL" -syn match sasMacro "%GOTO" -syn match sasMacro "%IF" -syn match sasMacro "%INDEX" -syn match sasMacro "%INPUT" -syn match sasMacro "%KEYDEF" -syn match sasMacro "%LABEL" -syn match sasMacro "%LEFT" -syn match sasMacro "%LENGTH" -syn match sasMacro "%LET" -syn match sasMacro "%LOCAL" -syn match sasMacro "%LOWCASE" -syn match sasMacro "%MACRO" -syn match sasMacro "%MEND" -syn match sasMacro "%NRBQUOTE" -syn match sasMacro "%NRQUOTE" -syn match sasMacro "%NRSTR" -syn match sasMacro "%PUT" -syn match sasMacro "%QCMPRES" -syn match sasMacro "%QLEFT" -syn match sasMacro "%QLOWCASE" -syn match sasMacro "%QSCAN" -syn match sasMacro "%QSUBSTR" -syn match sasMacro "%QSYSFUNC" -syn match sasMacro "%QTRIM" -syn match sasMacro "%QUOTE" -syn match sasMacro "%QUPCASE" -syn match sasMacro "%SCAN" -syn match sasMacro "%STR" -syn match sasMacro "%SUBSTR" -syn match sasMacro "%SUPERQ" -syn match sasMacro "%SYSCALL" -syn match sasMacro "%SYSEVALF" -syn match sasMacro "%SYSEXEC" -syn match sasMacro "%SYSFUNC" -syn match sasMacro "%SYSGET" -syn match sasMacro "%SYSLPUT" -syn match sasMacro "%SYSPROD" -syn match sasMacro "%SYSRC" -syn match sasMacro "%SYSRPUT" -syn match sasMacro "%THEN" -syn match sasMacro "%TO" -syn match sasMacro "%TRIM" -syn match sasMacro "%UNQUOTE" -syn match sasMacro "%UNTIL" -syn match sasMacro "%UPCASE" -syn match sasMacro "%VERIFY" -syn match sasMacro "%WHILE" -syn match sasMacro "%WINDOW" - -" SAS Functions - -syn keyword sasFunction ABS ADDR AIRY ARCOS ARSIN ATAN ATTRC ATTRN -syn keyword sasFunction BAND BETAINV BLSHIFT BNOT BOR BRSHIFT BXOR -syn keyword sasFunction BYTE CDF CEIL CEXIST CINV CLOSE CNONCT COLLATE -syn keyword sasFunction COMPBL COMPOUND COMPRESS COS COSH CSS CUROBS -syn keyword sasFunction CV DACCDB DACCDBSL DACCSL DACCSYD DACCTAB -syn keyword sasFunction DAIRY DATE DATEJUL DATEPART DATETIME DAY -syn keyword sasFunction DCLOSE DEPDB DEPDBSL DEPDBSL DEPSL DEPSL -syn keyword sasFunction DEPSYD DEPSYD DEPTAB DEPTAB DEQUOTE DHMS -syn keyword sasFunction DIF DIGAMMA DIM DINFO DNUM DOPEN DOPTNAME -syn keyword sasFunction DOPTNUM DREAD DROPNOTE DSNAME ERF ERFC EXIST -syn keyword sasFunction EXP FAPPEND FCLOSE FCOL FDELETE FETCH FETCHOBS -syn keyword sasFunction FEXIST FGET FILEEXIST FILENAME FILEREF FINFO -syn keyword sasFunction FINV FIPNAME FIPNAMEL FIPSTATE FLOOR FNONCT -syn keyword sasFunction FNOTE FOPEN FOPTNAME FOPTNUM FPOINT FPOS -syn keyword sasFunction FPUT FREAD FREWIND FRLEN FSEP FUZZ FWRITE -syn keyword sasFunction GAMINV GAMMA GETOPTION GETVARC GETVARN HBOUND -syn keyword sasFunction HMS HOSTHELP HOUR IBESSEL INDEX INDEXC -syn keyword sasFunction INDEXW INPUT INPUTC INPUTN INT INTCK INTNX -syn keyword sasFunction INTRR IRR JBESSEL JULDATE KURTOSIS LAG LBOUND -syn keyword sasFunction LEFT LENGTH LGAMMA LIBNAME LIBREF LOG LOG10 -syn keyword sasFunction LOG2 LOGPDF LOGPMF LOGSDF LOWCASE MAX MDY -syn keyword sasFunction MEAN MIN MINUTE MOD MONTH MOPEN MORT N -syn keyword sasFunction NETPV NMISS NORMAL NOTE NPV OPEN ORDINAL -syn keyword sasFunction PATHNAME PDF PEEK PEEKC PMF POINT POISSON POKE -syn keyword sasFunction PROBBETA PROBBNML PROBCHI PROBF PROBGAM -syn keyword sasFunction PROBHYPR PROBIT PROBNEGB PROBNORM PROBT PUT -syn keyword sasFunction PUTC PUTN QTR QUOTE RANBIN RANCAU RANEXP -syn keyword sasFunction RANGAM RANGE RANK RANNOR RANPOI RANTBL RANTRI -syn keyword sasFunction RANUNI REPEAT RESOLVE REVERSE REWIND RIGHT -syn keyword sasFunction ROUND SAVING SCAN SDF SECOND SIGN SIN SINH -syn keyword sasFunction SKEWNESS SOUNDEX SPEDIS SQRT STD STDERR STFIPS -syn keyword sasFunction STNAME STNAMEL SUBSTR SUM SYMGET SYSGET SYSMSG -syn keyword sasFunction SYSPROD SYSRC SYSTEM TAN TANH TIME TIMEPART -syn keyword sasFunction TINV TNONCT TODAY TRANSLATE TRANWRD TRIGAMMA -syn keyword sasFunction TRIM TRIMN TRUNC UNIFORM UPCASE USS VAR -syn keyword sasFunction VARFMT VARINFMT VARLABEL VARLEN VARNAME -syn keyword sasFunction VARNUM VARRAY VARRAYX VARTYPE VERIFY VFORMAT -syn keyword sasFunction VFORMATD VFORMATDX VFORMATN VFORMATNX VFORMATW -syn keyword sasFunction VFORMATWX VFORMATX VINARRAY VINARRAYX VINFORMAT -syn keyword sasFunction VINFORMATD VINFORMATDX VINFORMATN VINFORMATNX -syn keyword sasFunction VINFORMATW VINFORMATWX VINFORMATX VLABEL -syn keyword sasFunction VLABELX VLENGTH VLENGTHX VNAME VNAMEX VTYPE -syn keyword sasFunction VTYPEX WEEKDAY YEAR YYQ ZIPFIPS ZIPNAME ZIPNAMEL -syn keyword sasFunction ZIPSTATE - -" Handy settings for using vim with log files -syn keyword sasLogMsg NOTE -syn keyword sasWarnMsg WARNING -syn keyword sasErrMsg ERROR - -" Always contained in a comment (Bob Heckel) -syn keyword sasTodo TODO TBD FIXME contained - -" These don't fit anywhere else (Bob Heckel). -" Added others that were missing. -syn keyword sasUnderscore _ALL_ _AUTOMATIC_ _CHARACTER_ _INFILE_ _N_ _NAME_ _NULL_ _NUMERIC_ _USER_ _WEBOUT_ - -" End of SAS Functions - -" Define the default highlighting. -" Only when an item doesn't have highlighting yet - - -" Default sas enhanced editor color syntax -hi sComment term=bold cterm=NONE ctermfg=Green ctermbg=Black gui=NONE guifg=DarkGreen guibg=White -hi sCard term=bold cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Black guibg=LightYellow -hi sDate_Time term=NONE cterm=bold ctermfg=Green ctermbg=Black gui=bold guifg=SeaGreen guibg=White -hi sKeyword term=NONE cterm=NONE ctermfg=Blue ctermbg=Black gui=NONE guifg=Blue guibg=White -hi sFmtInfmt term=NONE cterm=NONE ctermfg=LightGreen ctermbg=Black gui=NONE guifg=SeaGreen guibg=White -hi sString term=NONE cterm=NONE ctermfg=Magenta ctermbg=Black gui=NONE guifg=Purple guibg=White -hi sText term=NONE cterm=NONE ctermfg=White ctermbg=Black gui=bold guifg=Black guibg=White -hi sNumber term=NONE cterm=bold ctermfg=Green ctermbg=Black gui=bold guifg=SeaGreen guibg=White -hi sProc term=NONE cterm=bold ctermfg=Blue ctermbg=Black gui=bold guifg=Navy guibg=White -hi sSection term=NONE cterm=bold ctermfg=Blue ctermbg=Black gui=bold guifg=Navy guibg=White -hi mDefine term=NONE cterm=bold ctermfg=White ctermbg=Black gui=bold guifg=Black guibg=White -hi mKeyword term=NONE cterm=NONE ctermfg=Blue ctermbg=Black gui=NONE guifg=Blue guibg=White -hi mReference term=NONE cterm=bold ctermfg=White ctermbg=Black gui=bold guifg=Blue guibg=White -hi mSection term=NONE cterm=NONE ctermfg=Blue ctermbg=Black gui=bold guifg=Navy guibg=White -hi mText term=NONE cterm=NONE ctermfg=White ctermbg=Black gui=bold guifg=Black guibg=White - -" Colors that closely match SAS log colors for default color scheme -hi lError term=NONE cterm=NONE ctermfg=Red ctermbg=Black gui=none guifg=Red guibg=White -hi lWarning term=NONE cterm=NONE ctermfg=Green ctermbg=Black gui=none guifg=Green guibg=White -hi lNote term=NONE cterm=NONE ctermfg=Cyan ctermbg=Black gui=none guifg=Blue guibg=White - - -" Special hilighting for the SAS proc section - -hi def link sasComment sComment -hi def link sasConditional sKeyword -hi def link sasStep sSection -hi def link sasFunction sKeyword -hi def link sasMacro mKeyword -hi def link sasMacroVar NonText -hi def link sasNumber sNumber -hi def link sasStatement sKeyword -hi def link sasString sString -hi def link sasProc sProc -" (Bob Heckel) -hi def link sasTodo Todo -hi def link sasErrMsg lError -hi def link sasWarnMsg lWarning -hi def link sasLogMsg lNote -hi def link sasCards sCard -" (Bob Heckel) -hi def link sasUnderscore PreProc +" Define default highlighting +hi def link sasComment Comment +hi def link sasTodo Delimiter +hi def link sasSectLbl Title +hi def link sasSectLblEnds Comment +hi def link sasNumber Number +hi def link sasDateTime Constant +hi def link sasString String +hi def link sasDataStepControl Keyword +hi def link sasProcTemplateClause Keyword +hi def link sasProcSQLClause Keyword +hi def link sasDS2Control Keyword +hi def link sasIMLControl Keyword +hi def link sasOperator Operator +hi def link sasGlobalStatementKeyword Statement +hi def link sasGlobalStatementODSKeyword Statement +hi def link sasSectionKeyword Statement +hi def link sasDataStepFunctionName Function +hi def link sasDataStepCallRoutineName Function +hi def link sasDataStepStatementKeyword Statement +hi def link sasDataStepStatementHashKeyword Statement +hi def link sasDataStepHashOperator Operator +hi def link sasDataStepHashMethodName Function +hi def link sasDataStepHashAttributeName Identifier +hi def link sasProcStatementKeyword Statement +hi def link sasODSGraphicsProcStatementKeyword Statement +hi def link sasGraphProcStatementKeyword Statement +hi def link sasAnalyticalProcStatementKeyword Statement +hi def link sasProcTemplateStatementKeyword Statement +hi def link sasProcTemplateStatementComplexKeyword Statement +hi def link sasProcTemplateGTLStatementKeyword Statement +hi def link sasProcTemplateGTLComplexKeyword Statement +hi def link sasProcSQLFunctionName Function +hi def link sasProcSQLStatementKeyword Statement +hi def link sasProcSQLStatementComplexKeyword Statement +hi def link sasProcSQLStatementNextKeyword Statement +hi def link sasDS2FunctionName Function +hi def link sasDS2StatementKeyword Statement +hi def link sasIMLFunctionName Function +hi def link sasIMLCallRoutineName Function +hi def link sasIMLStatementKeyword Statement +hi def link sasMacroReserved PreProc +hi def link sasMacroVariable Define +hi def link sasMacroFunctionName Define +hi def link sasDataLine SpecialChar +hi def link sasFormat SpecialChar +hi def link sasReserved Special " Syncronize from beginning to keep large blocks from losing " syntax coloring while moving through code. @@ -264,4 +261,5 @@ syn sync fromstart let b:current_syntax = "sas" -" vim: ts=8 +let &cpo = s:cpo_save +unlet s:cpo_save From ef7af078ef41fabbf3ca9d25acb6a1062a0716a7 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 01:09:09 +0100 Subject: [PATCH 03/11] vim-patch:cd5c8f825078 Update runtime files. https://github.com/vim/vim/commit/cd5c8f82507822467232ab71e1ebbaae19595916 --- runtime/compiler/rst.vim | 23 +++-- runtime/doc/autocmd.txt | 2 +- runtime/doc/eval.txt | 37 ++++++-- runtime/doc/insert.txt | 3 +- runtime/indent/r.vim | 28 +++--- runtime/indent/rhelp.vim | 2 +- runtime/macros/less.vim | 12 ++- runtime/syntax/autohotkey.vim | 14 +-- runtime/syntax/r.vim | 173 ++++++++++++++++++++++++++++------ runtime/syntax/rmd.vim | 94 ++++++++++++------ 10 files changed, 291 insertions(+), 97 deletions(-) diff --git a/runtime/compiler/rst.vim b/runtime/compiler/rst.vim index c34bd3ba81..392bea6ae0 100644 --- a/runtime/compiler/rst.vim +++ b/runtime/compiler/rst.vim @@ -1,7 +1,8 @@ " Vim compiler file -" Compiler: reStructuredText Documentation Format +" Compiler: sphinx >= 1.0.8, http://www.sphinx-doc.org +" Description: reStructuredText Documentation Format " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2006-04-19 +" Latest Revision: 2017-03-31 if exists("current_compiler") finish @@ -11,12 +12,18 @@ let current_compiler = "rst" let s:cpo_save = &cpo set cpo&vim -setlocal errorformat= - \%f:%l:\ (%tEBUG/0)\ %m, - \%f:%l:\ (%tNFO/1)\ %m, - \%f:%l:\ (%tARNING/2)\ %m, - \%f:%l:\ (%tRROR/3)\ %m, - \%f:%l:\ (%tEVERE/3)\ %m, +if exists(":CompilerSet") != 2 + command -nargs=* CompilerSet setlocal +endif + +CompilerSet errorformat= + \%f\\:%l:\ %tEBUG:\ %m, + \%f\\:%l:\ %tNFO:\ %m, + \%f\\:%l:\ %tARNING:\ %m, + \%f\\:%l:\ %tRROR:\ %m, + \%f\\:%l:\ %tEVERE:\ %m, + \%f\\:%s:\ %tARNING:\ %m, + \%f\\:%s:\ %tRROR:\ %m, \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f', \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f', \%DMaking\ %*\\a\ in\ %f diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 2850c8058f..709e7ffed6 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -616,7 +616,7 @@ FileChangedShell When Vim notices that the modification time of to tell Vim what to do next. NOTE: When this autocommand is executed, the current buffer "%" may be different from the - buffer that was changed "". + buffer that was changed, which is in "". NOTE: The commands must not change the current buffer, jump to another buffer or delete a buffer. *E246* *E811* diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 319ae26060..d9b47a3ab0 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4078,13 +4078,16 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* getcurpos() Get the position of the cursor. This is like getpos('.'), but includes an extra item in the list: [bufnum, lnum, col, off, curswant] ~ - The "curswant" number is the preferred column when moving the - cursor vertically. - This can be used to save and restore the cursor position: > - let save_cursor = getcurpos() - MoveTheCursorAround - call setpos('.', save_cursor) -< + The "curswant" number is the preferred column when moving the + cursor vertically. Also see |getpos()|. + + This can be used to save and restore the cursor position: > + let save_cursor = getcurpos() + MoveTheCursorAround + call setpos('.', save_cursor) +< Note that this only works within the window. See + |winrestview()| for restoring more state. + getcwd([{winnr}[, {tabnr}]]) *getcwd()* With no arguments the result is a String, which is the name of the current effective working directory. With {winnr} or @@ -4382,11 +4385,13 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()* getwinposx() The result is a Number, which is the X coordinate in pixels of the left hand side of the GUI Vim window. The result will be -1 if the information is not available. + The value can be used with `:winpos`. *getwinposy()* getwinposy() The result is a Number, which is the Y coordinate in pixels of the top of the GUI Vim window. The result will be -1 if the information is not available. + The value can be used with `:winpos`. getwininfo([{winid}]) *getwininfo()* Returns information about windows as a List with Dictionaries. @@ -8271,7 +8276,7 @@ lispindent Compiled with support for lisp indenting. listcmds Compiled with commands for the buffer list |:files| and the argument list |arglist|. localmap Compiled with local mappings and abbr. |:map-local| -mac macOS version of Vim. +mac macOS version of Nvim. menu Compiled with support for |:menu|. mksession Compiled with support for |:mksession|. modify_fname Compiled with file name modifiers. |filename-modifiers| @@ -10417,6 +10422,22 @@ missing: > : echo "You will _never_ see this message" :endif +To execute a command only when the |+eval| feature is disabled requires a trick, +as this example shows: > + if 1 + nnoremap : :" + endif + normal :set history=111 + if 1 + nunmap : + endif + +The "" here is a real CR character, type CTRL-V Enter to get it. + +When the |+eval| feature is available the ":" is remapped to add a double +quote, which has the effect of commenging-out the command. without the +|+eval| feature the nnoremap command is skipped and the command is executed. + ============================================================================== 11. The sandbox *eval-sandbox* *sandbox* *E48* diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index f3bde9d8d2..f6b2ef7bc3 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -146,7 +146,8 @@ CTRL-R CTRL-R {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-R* CTRL-R CTRL-O {0-9a-z"%#*+/:.-=} *i_CTRL-R_CTRL-O* Insert the contents of a register literally and don't auto-indent. Does the same as pasting with the mouse - ||. + ||. When the register is linewise this will + insert the text above the current line, like with `P`. Does not replace characters! The '.' register (last inserted text) is still inserted as typed. diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim index 01f3812ed2..373b0e65df 100644 --- a/runtime/indent/r.vim +++ b/runtime/indent/r.vim @@ -274,7 +274,7 @@ function GetRIndent() let nlnum = s:Get_prev_line(nlnum) let nline = SanitizeRLine(getline(nlnum)) . nline endwhile - if nline =~ '^\s*function\s*(' && indent(nlnum) == &sw + if nline =~ '^\s*function\s*(' && indent(nlnum) == shiftwidth() return 0 endif endif @@ -285,7 +285,7 @@ function GetRIndent() " line is an incomplete command: if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\$' - return indent(lnum) + &sw + return indent(lnum) + shiftwidth() endif " Deal with () and [] @@ -293,14 +293,14 @@ function GetRIndent() let pb = s:Get_paren_balance(line, '(', ')') if line =~ '^\s*{$' || line =~ '(\s*{' || (pb == 0 && (line =~ '{$' || line =~ '(\s*{$')) - return indent(lnum) + &sw + return indent(lnum) + shiftwidth() endif let s:curtabstop = repeat(' ', &tabstop) if g:r_indent_align_args == 1 if pb > 0 && line =~ '{$' - return s:Get_last_paren_idx(line, '(', ')', pb) + &sw + return s:Get_last_paren_idx(line, '(', ')', pb) + shiftwidth() endif let bb = s:Get_paren_balance(line, '[', ']') @@ -364,11 +364,11 @@ function GetRIndent() if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 return indent(lnum) else - return indent(lnum) + &sw + return indent(lnum) + shiftwidth() endif else if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0 - return indent(lnum) - &sw + return indent(lnum) - shiftwidth() endif endif endif @@ -383,7 +383,7 @@ function GetRIndent() let line = linepiece . line endwhile if line =~ '{$' && post_block == 0 - return indent(lnum) + &sw + return indent(lnum) + shiftwidth() endif " Now we can do some tests again @@ -393,19 +393,19 @@ function GetRIndent() if post_block == 0 let newl = SanitizeRLine(line) if newl =~ '\<\(if\|while\|for\|function\)\s*()$' || newl =~ '\ -" Last Change: 2015 Nov 15 +" Last Change: 2017 Mar 31 " Avoid loading this file twice, allow the user to define his own script. if exists("loaded_less") @@ -81,6 +81,10 @@ fun! s:Help() echo "\n" echo "/pattern Search for pattern ?pattern Search backward for pattern" echo "n next pattern match N Previous pattern match" + if &foldmethod != "manual" + echo "\n" + echo "zR open all folds zm increase fold level" + endif echo "\n" echo ":n Next file :p Previous file" echo "\n" @@ -96,7 +100,11 @@ map map map map -map z +" If 'foldmethod' was changed keep the "z" commands, e.g. "zR" to open all +" folds. +if &foldmethod == "manual" + map z +endif map fun! s:NextPage() if line(".") == line("$") diff --git a/runtime/syntax/autohotkey.vim b/runtime/syntax/autohotkey.vim index 3b826af6f5..c6a68f7a21 100644 --- a/runtime/syntax/autohotkey.vim +++ b/runtime/syntax/autohotkey.vim @@ -2,7 +2,7 @@ " Language: AutoHotkey script file " Maintainer: Michael Wong " https://github.com/mmikeww/autohotkey.vim -" Latest Revision: 2017-01-23 +" Latest Revision: 2017-04-03 " Previous Maintainers: SungHyun Nam " Nikolai Weibull @@ -106,6 +106,7 @@ syn keyword autohotkeyCommand \ FormatTime IfInString IfNotInString Sort StringCaseSense StringGetPos \ StringLeft StringRight StringLower StringUpper StringMid StringReplace \ StringSplit StringTrimLeft StringTrimRight StringLen + \ StrSplit StrReplace Throw \ Control ControlClick ControlFocus ControlGet ControlGetFocus \ ControlGetPos ControlGetText ControlMove ControlSend ControlSendRaw \ ControlSetText Menu PostMessage SendMessage SetControlDelay @@ -119,17 +120,18 @@ syn keyword autohotkeyCommand \ SetCapsLockState SetNumLockState SetScrollLockState syn keyword autohotkeyFunction - \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr + \ InStr RegExMatch RegExReplace StrLen SubStr Asc Chr Func \ DllCall VarSetCapacity WinActive WinExist IsLabel OnMessage \ Abs Ceil Exp Floor Log Ln Mod Round Sqrt Sin Cos Tan ASin ACos ATan \ FileExist GetKeyState NumGet NumPut StrGet StrPut RegisterCallback \ IsFunc Trim LTrim RTrim IsObject Object Array FileOpen \ ComObjActive ComObjArray ComObjConnect ComObjCreate ComObjGet \ ComObjError ComObjFlags ComObjQuery ComObjType ComObjValue ComObject + \ Format Exception syn keyword autohotkeyStatement \ Break Continue Exit ExitApp Gosub Goto OnExit Pause Return - \ Suspend Reload + \ Suspend Reload new class extends syn keyword autohotkeyRepeat \ Loop @@ -138,7 +140,7 @@ syn keyword autohotkeyConditional \ IfExist IfNotExist If IfEqual IfLess IfGreater Else \ IfWinExist IfWinNotExist IfWinActive IfWinNotActive \ IfNotEqual IfLessOrEqual IfGreaterOrEqual - \ while until for in + \ while until for in try catch finally syn match autohotkeyPreProcStart \ nextgroup= @@ -178,7 +180,7 @@ syn keyword autohotkeyPreProc \ Warn syn keyword autohotkeyMatchClass - \ ahk_group ahk_class ahk_id ahk_pid + \ ahk_group ahk_class ahk_id ahk_pid ahk_exe syn match autohotkeyNumbers \ display @@ -217,7 +219,7 @@ syn match autohotkeyHotkey \ contains=autohotkeyKey, \ autohotkeyHotkeyDelimiter \ display - \ '^.\{-}::' + \ '^\s*\S*\%( Up\)\?::' syn match autohotkeyKey \ contained diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim index 30a5b23f84..45ff498b3b 100644 --- a/runtime/syntax/r.vim +++ b/runtime/syntax/r.vim @@ -5,10 +5,10 @@ " Tom Payne " Contributor: Johannes Ranke " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Thu Aug 25, 2016 08:52PM +" Last Change: Sat Apr 08, 2017 07:01PM " Filenames: *.R *.r *.Rhistory *.Rt " -" NOTE: The highlighting of R functions is defined in +" NOTE: The highlighting of R functions might be defined in " runtime files created by a filetype plugin, if installed. " " CONFIGURATION: @@ -18,7 +18,7 @@ " " ROxygen highlighting can be turned off by " -" let r_hl_roxygen = 0 +" let r_syntax_hl_roxygen = 0 " " Some lines of code were borrowed from Zhuojun Chen. @@ -26,13 +26,25 @@ if exists("b:current_syntax") finish endif -syn iskeyword @,48-57,_,. +if has("patch-7.4.1142") + syn iskeyword @,48-57,_,. +else + setlocal iskeyword=@,48-57,_,. +endif + +" The variables g:r_hl_roxygen and g:r_syn_minlines were renamed on April 8, 2017. +if exists("g:r_hl_roxygen") + let g:r_syntax_hl_roxygen = g:r_hl_roxygen +endif +if exists("g:r_syn_minlines") + let g:r_syntax_minlines = g:r_syn_minlines +endif if exists("g:r_syntax_folding") && g:r_syntax_folding setlocal foldmethod=syntax endif -if !exists("g:r_hl_roxygen") - let g:r_hl_roxygen = 1 +if !exists("g:r_syntax_hl_roxygen") + let g:r_syntax_hl_roxygen = 1 endif syn case match @@ -42,19 +54,106 @@ syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):" syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*" " Roxygen -if g:r_hl_roxygen - syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend - syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey - syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained +if g:r_syntax_hl_roxygen + " A roxygen block can start at the beginning of a file (first version) and + " after a blank line (second version). It ends when a line that does not + " contain a roxygen comment. In the following comments, any line containing + " a roxygen comment marker (one or two hash signs # followed by a single + " quote ' and preceded only by whitespace) is called a roxygen line. A + " roxygen line containing only a roxygen comment marker, optionally followed + " by whitespace is called an empty roxygen line. - syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword + " First we match all roxygen blocks as containing only a title. In case an + " empty roxygen line ending the title or a tag is found, this will be + " overriden later by the definitions of rOBlock. + syn match rOTitleBlock "\%^\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag + syn match rOTitleBlock "^\s*\n\(\s*#\{1,2}' .*\n\)\{1,}" contains=rOCommentKey,rOTitleTag - syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)" - syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)" - syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)" - syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)" - syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)" - syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)" + " When a roxygen block has a title and additional content, the title + " consists of one or more roxygen lines (as little as possible are matched), + " followed either by an empty roxygen line + syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold + syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold + + " or by a roxygen tag (we match everything starting with @ but not @@ which is used as escape sequence for a literal @). + syn region rOBlock start="\%^\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold + syn region rOBlock start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-}\s*#\{1,2}' @\(@\)\@!" end="^\s*\(#\{1,2}'\)\@!" contains=rOTitle,rOTag,rOExamples,@Spell keepend fold + + " If a block contains an @rdname, @describeIn tag, it may have paragraph breaks, but does not have a title + syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold + syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @rdname" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold + syn region rOBlockNoTitle start="\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold + syn region rOBlockNoTitle start="^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*\n\(\s*#\{1,2}'.*\n\)\{-}\s*#\{1,2}' @describeIn" end="^\s*\(#\{1,2}'\)\@!" contains=rOTag,rOExamples,@Spell keepend fold + + " A title as part of a block is always at the beginning of the block, i.e. + " either at the start of a file or after a completely empty line. + syn match rOTitle "\%^\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag + syn match rOTitle "^\s*\n\(\s*#\{1,2}' .*\n\)\{-1,}\s*#\{1,2}'\s*$" contained contains=rOCommentKey,rOTitleTag + syn match rOTitleTag contained "@title" + + syn match rOCommentKey "#\{1,2}'" contained + syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOTag fold + + " rOTag list generated from the lists in + " https://github.com/klutometis/roxygen/R/rd.R and + " https://github.com/klutometis/roxygen/R/namespace.R + " using s/^ \([A-Za-z0-9]*\) = .*/ syn match rOTag contained "@\1"/ + " Plus we need the @include tag + + " rd.R + syn match rOTag contained "@aliases" + syn match rOTag contained "@author" + syn match rOTag contained "@backref" + syn match rOTag contained "@concept" + syn match rOTag contained "@describeIn" + syn match rOTag contained "@description" + syn match rOTag contained "@details" + syn match rOTag contained "@docType" + syn match rOTag contained "@encoding" + syn match rOTag contained "@evalRd" + syn match rOTag contained "@example" + syn match rOTag contained "@examples" + syn match rOTag contained "@family" + syn match rOTag contained "@field" + syn match rOTag contained "@format" + syn match rOTag contained "@inherit" + syn match rOTag contained "@inheritParams" + syn match rOTag contained "@inheritDotParams" + syn match rOTag contained "@inheritSection" + syn match rOTag contained "@keywords" + syn match rOTag contained "@method" + syn match rOTag contained "@name" + syn match rOTag contained "@md" + syn match rOTag contained "@noMd" + syn match rOTag contained "@noRd" + syn match rOTag contained "@note" + syn match rOTag contained "@param" + syn match rOTag contained "@rdname" + syn match rOTag contained "@rawRd" + syn match rOTag contained "@references" + syn match rOTag contained "@return" + syn match rOTag contained "@section" + syn match rOTag contained "@seealso" + syn match rOTag contained "@slot" + syn match rOTag contained "@source" + syn match rOTag contained "@template" + syn match rOTag contained "@templateVar" + syn match rOTag contained "@title" + syn match rOTag contained "@usage" + " namespace.R + syn match rOTag contained "@export" + syn match rOTag contained "@exportClass" + syn match rOTag contained "@exportMethod" + syn match rOTag contained "@exportPattern" + syn match rOTag contained "@import" + syn match rOTag contained "@importClassesFrom" + syn match rOTag contained "@importFrom" + syn match rOTag contained "@importMethodsFrom" + syn match rOTag contained "@rawNamespace" + syn match rOTag contained "@S3method" + syn match rOTag contained "@useDynLib" + " other + syn match rOTag contained "@include" endif @@ -168,12 +267,28 @@ syn match rBraceError "[)}]" contained syn match rCurlyError "[)\]]" contained syn match rParenError "[\]}]" contained -if !exists("g:R_hi_fun") - let g:R_hi_fun = 1 +" Use Nvim-R to highlight functions dynamically if it is installed +if !exists("g:r_syntax_fun_pattern") + let s:ff = split(substitute(globpath(&rtp, "R/functions.vim"), "functions.vim", "", "g"), "\n") + if len(s:ff) > 0 + let g:r_syntax_fun_pattern = 0 + else + let g:r_syntax_fun_pattern = 1 + endif endif -if g:R_hi_fun - " Nvim-R: - runtime R/functions.vim + +" Only use Nvim-R to highlight functions if they should not be highlighted +" according to a generic pattern +if g:r_syntax_fun_pattern == 1 + syn match rFunction '[0-9a-zA-Z_\.]\+\s*\ze(' +else + if !exists("g:R_hi_fun") + let g:R_hi_fun = 1 + endif + if g:R_hi_fun + " Nvim-R: + runtime R/functions.vim + endif endif syn match rDollar display contained "\$" @@ -205,8 +320,8 @@ if &filetype == "rhelp" syn match rhSection "\\dontrun\>" endif -if exists("r_syn_minlines") - exe "syn sync minlines=" . r_syn_minlines +if exists("r_syntax_minlines") + exe "syn sync minlines=" . r_syntax_minlines else syn sync minlines=40 endif @@ -243,15 +358,17 @@ hi def link rStatement Statement hi def link rString String hi def link rStrError Error hi def link rType Type -if g:r_hl_roxygen - hi def link rOKeyword Title - hi def link rOBlock Comment +if g:r_syntax_hl_roxygen + hi def link rOTitleTag Operator + hi def link rOTag Operator + hi def link rOTitleBlock Title + hi def link rOBlock Comment + hi def link rOBlockNoTitle Comment hi def link rOTitle Title hi def link rOCommentKey Comment hi def link rOExamples SpecialComment endif - let b:current_syntax="r" " vim: ts=8 sw=2 diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim index 48fb5e079c..05435354ad 100644 --- a/runtime/syntax/rmd.vim +++ b/runtime/syntax/rmd.vim @@ -1,17 +1,26 @@ " markdown Text with R statements " Language: markdown with R code chunks " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Tue Jun 28, 2016 10:09AM +" Last Change: Sat Jan 28, 2017 10:06PM " " CONFIGURATION: -" To highlight chunk headers as R code, put in your vimrc: +" To highlight chunk headers as R code, put in your vimrc (e.g. .config/nvim/init.vim): " let rmd_syn_hl_chunk = 1 +" +" For highlighting pandoc extensions to markdown like citations and TeX and +" many other advanced features like folding of markdown sections, it is +" recommended to install the vim-pandoc filetype plugin as well as the +" vim-pandoc-syntax filetype plugin from https://github.com/vim-pandoc. +" +" TODO: +" - Provide highlighting for rmarkdown parameters in yaml header if exists("b:current_syntax") finish endif -" load all of pandoc info +" load all of pandoc info, e.g. from +" https://github.com/vim-pandoc/vim-pandoc-syntax runtime syntax/pandoc.vim if exists("b:current_syntax") let rmdIsPandoc = 1 @@ -22,28 +31,54 @@ else if exists("b:current_syntax") unlet b:current_syntax endif + + " load all of the yaml syntax highlighting rules into @yaml + syntax include @yaml syntax/yaml.vim + if exists("b:current_syntax") + unlet b:current_syntax + endif + + " highlight yaml block commonly used for front matter + syntax region rmdYamlBlock matchgroup=rmdYamlBlockDelim start="^---" matchgroup=rmdYamlBlockDelim end="^---" contains=@yaml keepend fold endif -" load all of the r syntax highlighting rules into @R -syntax include @R syntax/r.vim -if exists("b:current_syntax") - unlet b:current_syntax -endif - -if exists("g:rmd_syn_hl_chunk") - " highlight R code inside chunk header - syntax match rmdChunkDelim "^[ \t]*```{r" contained - syntax match rmdChunkDelim "}$" contained +if !exists("g:rmd_syn_langs") + let g:rmd_syn_langs = ["r"] else - syntax match rmdChunkDelim "^[ \t]*```{r.*}$" contained + let s:hasr = 0 + for s:lng in g:rmd_syn_langs + if s:lng == "r" + let s:hasr = 1 + endif + endfor + if s:hasr == 0 + let g:rmd_syn_langs += ["r"] + endif endif -syntax match rmdChunkDelim "^[ \t]*```$" contained -syntax region rmdChunk start="^[ \t]*``` *{r.*}$" end="^[ \t]*```$" contains=@R,rmdChunkDelim keepend fold + +for s:lng in g:rmd_syn_langs + exe 'syntax include @' . toupper(s:lng) . ' syntax/'. s:lng . '.vim' + if exists("b:current_syntax") + unlet b:current_syntax + endif + exe 'syntax region rmd' . toupper(s:lng) . 'Chunk start="^[ \t]*``` *{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\).*}$" end="^[ \t]*```$" contains=@' . toupper(s:lng) . ',rmd' . toupper(s:lng) . 'ChunkDelim keepend fold' + + if exists("g:rmd_syn_hl_chunk") && s:lng == "r" + " highlight R code inside chunk header + syntax match rmdRChunkDelim "^[ \t]*```{r" contained + syntax match rmdRChunkDelim "}$" contained + else + exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\).*}$" contained' + endif + exe 'syntax match rmd' . toupper(s:lng) . 'ChunkDelim "^[ \t]*```$" contained' +endfor + " also match and syntax highlight in-line R code -syntax match rmdEndInline "`" contained -syntax match rmdBeginInline "`r " contained -syntax region rmdrInline start="`r " end="`" contains=@R,rmdBeginInline,rmdEndInline keepend +syntax region rmdrInline matchgroup=rmdInlineDelim start="`r " end="`" contains=@R containedin=pandocLaTeXRegion,yamlFlowString keepend +" I was not able to highlight rmdrInline inside a pandocLaTeXCommand, although +" highlighting works within pandocLaTeXRegion and yamlFlowString. +syntax cluster texMathZoneGroup add=rmdrInline " match slidify special marker syntax match rmdSlidifySpecial "\*\*\*" @@ -56,8 +91,6 @@ if rmdIsPandoc == 0 if exists("b:current_syntax") unlet b:current_syntax endif - " Extend cluster - syn cluster texMathZoneGroup add=rmdrInline " Inline syntax match rmdLaTeXInlDelim "\$" syntax match rmdLaTeXInlDelim "\\\$" @@ -65,19 +98,24 @@ if rmdIsPandoc == 0 " Region syntax match rmdLaTeXRegDelim "\$\$" contained syntax match rmdLaTeXRegDelim "\$\$latex$" contained - syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend - syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXSt,rmdLaTeXRegDelim keepend + syntax match rmdLaTeXSt "\\[a-zA-Z]\+" + syntax region rmdLaTeXRegion start="^\$\$" skip="\\\$" end="\$\$$" contains=@LaTeX,rmdLaTeXRegDelim keepend + syntax region rmdLaTeXRegion2 start="^\\\[" end="\\\]" contains=@LaTeX,rmdLaTeXRegDelim keepend + hi def link rmdBlockQuote Comment hi def link rmdLaTeXSt Statement hi def link rmdLaTeXInlDelim Special hi def link rmdLaTeXRegDelim Special endif -syn sync match rmdSyncChunk grouphere rmdChunk "^[ \t]*``` *{r" +for s:lng in g:rmd_syn_langs + exe 'syn sync match rmd' . toupper(s:lng) . 'SyncChunk grouphere rmd' . toupper(s:lng) . 'Chunk /^[ \t]*``` *{\(' . s:lng . '\|r.*engine\s*=\s*["' . "']" . s:lng . "['" . '"]\)/' +endfor -hi def link rmdChunkDelim Special -hi def link rmdBeginInline Special -hi def link rmdEndInline Special -hi def link rmdBlockQuote Comment +hi def link rmdYamlBlockDelim Delim +for s:lng in g:rmd_syn_langs + exe 'hi def link rmd' . toupper(s:lng) . 'ChunkDelim Special' +endfor +hi def link rmdInlineDelim Special hi def link rmdSlidifySpecial Special let b:current_syntax = "rmd" From 49a627dbd913f92d708c0eace7f7878fd6d18d3e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 01:17:06 +0100 Subject: [PATCH 04/11] vim-patch:94237495c03f Updated runtime files. https://github.com/vim/vim/commit/94237495c03f919a60b262fdcd3861e1931fc45a --- runtime/doc/editing.txt | 7 ++ runtime/doc/eval.txt | 4 +- runtime/doc/index.txt | 30 +++--- runtime/filetype.vim | 7 +- runtime/syntax/zsh.vim | 226 +++++----------------------------------- 5 files changed, 54 insertions(+), 220 deletions(-) diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 0099d14822..9f771374ed 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1364,6 +1364,13 @@ If you want to automatically reload a file when it has been changed outside of Vim, set the 'autoread' option. This doesn't work at the moment you write the file though, only when the file wasn't changed inside of Vim. +If you do not want to be asked or automatically reload the file, you can use +this: > + set buftype=nofile + +Or, when starting gvim from a shell: > + gvim file.log -c "set buftype=nofile" + Note that if a FileChangedShell autocommand is defined you will not get a warning message or prompt. The autocommand is expected to handle this. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d9b47a3ab0..23612d1216 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -6843,7 +6843,7 @@ setqflist({list} [, {action}[, {what}]]) *setqflist()* This function can be used to create a quickfix list independent of the 'errorformat' setting. Use a command like - ":cc 1" to jump to the first position. + `:cc 1` to jump to the first position. *setreg()* @@ -10435,7 +10435,7 @@ as this example shows: > The "" here is a real CR character, type CTRL-V Enter to get it. When the |+eval| feature is available the ":" is remapped to add a double -quote, which has the effect of commenging-out the command. without the +quote, which has the effect of commenting-out the command. without the |+eval| feature the nnoremap command is skipped and the command is executed. ============================================================================== diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index bde4bcb630..0d6fb26ed6 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -298,10 +298,10 @@ tag char note action in Normal mode ~ |B| B 1 cursor N WORDS backward |C| ["x]C 2 change from the cursor position to the end of the line, and N-1 more lines [into - buffer x]; synonym for "c$" + register x]; synonym for "c$" |D| ["x]D 2 delete the characters under the cursor until the end of the line and N-1 more - lines [into buffer x]; synonym for "d$" + lines [into register x]; synonym for "d$" |E| E 1 cursor forward to the end of WORD N |F| F{char} 1 cursor to the Nth occurrence of {char} to the left @@ -318,13 +318,13 @@ tag char note action in Normal mode ~ opposite direction |O| O 2 begin a new line above the cursor and insert text, repeat N times -|P| ["x]P 2 put the text [from buffer x] before the +|P| ["x]P 2 put the text [from register x] before the cursor N times |Q| Q switch to "Ex" mode |R| R 2 enter replace mode: overtype existing characters, repeat the entered text N-1 times -|S| ["x]S 2 delete N lines [into buffer x] and start +|S| ["x]S 2 delete N lines [into register x] and start insert; synonym for "cc". |T| T{char} 1 cursor till after Nth occurrence of {char} to the left @@ -332,8 +332,8 @@ tag char note action in Normal mode ~ |V| V start linewise Visual mode |W| W 1 cursor N WORDS forward |X| ["x]X 2 delete N characters before the cursor [into - buffer x] -|Y| ["x]Y yank N lines [into buffer x]; synonym for + register x] +|Y| ["x]Y yank N lines [into register x]; synonym for "yy" |ZZ| ZZ store current file if modified, and exit |ZQ| ZQ exit current file always @@ -356,12 +356,12 @@ tag char note action in Normal mode ~ |`}| `} 1 cursor to the end of the current paragraph |a| a 2 append text after the cursor N times |b| b 1 cursor N words backward -|c| ["x]c{motion} 2 delete Nmove text [into buffer x] and start +|c| ["x]c{motion} 2 delete Nmove text [into register x] and + start insert +|cc| ["x]cc 2 delete N lines [into register x] and start insert -|cc| ["x]cc 2 delete N lines [into buffer x] and start - insert -|d| ["x]d{motion} 2 delete Nmove text [into buffer x] -|dd| ["x]dd 2 delete N lines [into buffer x] +|d| ["x]d{motion} 2 delete Nmove text [into register x] +|dd| ["x]dd 2 delete N lines [into register x] |do| do 2 same as ":diffget" |dp| dp 2 same as ":diffput" |e| e 1 cursor forward to the end of word N @@ -387,16 +387,16 @@ tag char note action in Normal mode ~ |q?| q? edit ? command-line in command-line window |r| r{char} 2 replace N chars with {char} |s| ["x]s 2 (substitute) delete N characters [into - buffer x] and start insert + register x] and start insert |t| t{char} 1 cursor till before Nth occurrence of {char} to the right |u| u 2 undo changes |v| v start characterwise Visual mode |w| w 1 cursor N words forward |x| ["x]x 2 delete N characters under and after the - cursor [into buffer x] -|y| ["x]y{motion} yank Nmove text [into buffer x] -|yy| ["x]yy yank N lines [into buffer x] + cursor [into register x] +|y| ["x]y{motion} yank Nmove text [into register x] +|yy| ["x]yy yank N lines [into register x] |z| z{char} commands starting with 'z', see |z| below |{| { 1 cursor N paragraphs backward |bar| | 1 cursor to column N diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 6de4f2fbb8..1bfbca5764 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2017 Mar 27 +" Last Change: 2017 Apr 20 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -2128,7 +2128,10 @@ au BufNewFile,BufRead ssh_config,*/.ssh/config setf sshconfig au BufNewFile,BufRead sshd_config setf sshdconfig " Stata -au BufNewFile,BufRead *.ado,*.class,*.do,*.imata,*.mata setf stata +au BufNewFile,BufRead *.ado,*.do,*.imata,*.mata setf stata +" Also *.class, but not when it's a Java bytecode file +au BufNewFile,BufRead *.class + \ if getline(1) !~ "^\xca\xfe\xba\xbe" | setf stata | endif " SMCL au BufNewFile,BufRead *.hlp,*.ihlp,*.smcl setf smcl diff --git a/runtime/syntax/zsh.vim b/runtime/syntax/zsh.vim index 0d385a35d0..c69ef153a0 100644 --- a/runtime/syntax/zsh.vim +++ b/runtime/syntax/zsh.vim @@ -2,9 +2,9 @@ " Language: Zsh shell script " Maintainer: Christian Brabandt " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2016-02-15 +" Latest Revision: 2017-04-10 " License: Vim (see :h license) -" Repository: https://github.com/chrisbra/vim-zsh +" Repository: https://github.com/chrisbra/vim-zsh if exists("b:current_syntax") finish @@ -24,7 +24,7 @@ endif syn keyword zshTodo contained TODO FIXME XXX NOTE -syn region zshComment oneline start='\%(^\|\s*\)#' end='$' +syn region zshComment oneline start='\%(^\|\s\+\)#' end='$' \ contains=zshTodo,@Spell fold syn region zshComment start='^\s*#' end='^\%(\s*#\)\@!' @@ -88,33 +88,20 @@ syn match zshVariable '\<\h\w*' contained syn match zshVariableDef '\<\h\w*\ze+\==' " XXX: how safe is this? syn region zshVariableDef oneline - \ start='\$\@' -if s:zsh_syntax_variables =~ 'short\|all' - syn match zshShortDeref '\$[!#$*@?_-]\w\@!' - syn match zshShortDeref '\$[=^~]*[#+]*\d\+\>' -endif +syn match zshLongDeref '\$\%(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' +syn match zshLongDeref '\$\%(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' +syn match zshLongDeref '\$\%(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' -if s:zsh_syntax_variables =~ 'long\|all' - syn match zshLongDeref '\$\%(ARGC\|argv\|status\|pipestatus\|CPUTYPE\|EGID\|EUID\|ERRNO\|GID\|HOST\|LINENO\|LOGNAME\)' - syn match zshLongDeref '\$\%(MACHTYPE\|OLDPWD OPTARG\|OPTIND\|OSTYPE\|PPID\|PWD\|RANDOM\|SECONDS\|SHLVL\|signals\)' - syn match zshLongDeref '\$\%(TRY_BLOCK_ERROR\|TTY\|TTYIDLE\|UID\|USERNAME\|VENDOR\|ZSH_NAME\|ZSH_VERSION\|REPLY\|reply\|TERM\)' -endif - -if s:zsh_syntax_variables =~ 'all' - syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' -else - syn match zshDeref transparent contains=NONE '\$[=^~]*[#+]*\h\w*\>' -endif +syn match zshDollarVar '\$\h\w*' +syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' syn match zshCommands '\%(^\|\s\)[.:]\ze\s' syn keyword zshCommands alias autoload bg bindkey break bye cap cd @@ -126,10 +113,10 @@ syn keyword zshCommands alias autoload bg bindkey break bye cap cd \ functions getcap getln getopts hash history \ jobs kill let limit log logout popd print \ printf pushd pushln pwd r read readonly - \ rehash return sched set setcap setopt shift + \ rehash return sched set setcap shift \ source stat suspend test times trap true \ ttyctl type ulimit umask unalias unfunction - \ unhash unlimit unset unsetopt vared wait + \ unhash unlimit unset vared wait \ whence where which zcompile zformat zftp zle \ zmodload zparseopts zprof zpty zregexparse \ zsocket zstyle ztcp @@ -145,163 +132,9 @@ syn keyword zshCommands alias autoload bg bindkey break bye cap cd " done syn case ignore -syn keyword zshOptions aliases allexport all_export alwayslastprompt - \ always_last_prompt always_lastprompt alwaystoend always_to_end appendcreate - \ append_create appendhistory append_history autocd auto_cd autocontinue - \ auto_continue autolist auto_list - \ automenu auto_menu autonamedirs auto_name_dirs - \ autoparamkeys auto_param_keys autoparamslash - \ auto_param_slash autopushd auto_pushd autoremoveslash - \ auto_remove_slash autoresume auto_resume badpattern bad_pattern - \ banghist bang_hist bareglobqual bare_glob_qual - \ bashautolist bash_auto_list bashrematch bash_rematch - \ beep bgnice bg_nice braceccl brace_ccl braceexpand brace_expand - \ bsdecho bsd_echo caseglob case_glob casematch case_match - \ cbases c_bases cdablevars cdable_vars cd_able_vars chasedots chase_dots - \ chaselinks chase_links checkjobs check_jobs - \ clobber combiningchars combining_chars completealiases - \ complete_aliases completeinword complete_in_word - \ continueonerror continue_on_error correct - \ correctall correct_all cprecedences c_precedences - \ cshjunkiehistory csh_junkie_history cshjunkieloops - \ csh_junkie_loops cshjunkiequotes csh_junkie_quotes - \ csh_nullcmd csh_null_cmd cshnullcmd csh_null_cmd cshnullglob csh_null_glob - \ debugbeforecmd debug_before_cmd dotglob dot_glob dvorak - \ emacs equals errexit err_exit errreturn err_return evallineno - \ eval_lineno exec extendedglob extended_glob extendedhistory - \ extended_history flowcontrol flow_control forcefloat - \ force_float functionargzero function_argzero function_arg_zero glob globalexport - \ global_export globalrcs global_rcs globassign glob_assign - \ globcomplete glob_complete globdots glob_dots glob_subst - \ globsubst globstarshort glob_star_short hashall hash_all hashcmds - \ hash_cmds hashdirs hash_dirs hashexecutablesonly hash_executables_only - \ hashlistall hash_list_all histallowclobber hist_allow_clobber histappend - \ hist_append histbeep hist_beep hist_expand hist_expire_dups_first - \ histexpand histexpiredupsfirst histfcntllock hist_fcntl_lock - \ histfindnodups hist_find_no_dups histignorealldups - \ hist_ignore_all_dups histignoredups hist_ignore_dups - \ histignorespace hist_ignore_space histlexwords hist_lex_words - \ histnofunctions hist_no_functions histnostore hist_no_store - \ histreduceblanks hist_reduce_blanks histsavebycopy - \ hist_save_by_copy histsavenodups hist_save_no_dups - \ histsubstpattern hist_subst_pattern histverify hist_verify - \ hup ignorebraces ignore_braces ignoreclosebraces ignore_close_braces - \ ignoreeof ignore_eof incappendhistory inc_append_history - \ incappendhistorytime inc_append_history_time interactive - \ interactivecomments interactive_comments ksharrays ksh_arrays - \ kshautoload ksh_autoload kshglob ksh_glob kshoptionprint - \ ksh_option_print kshtypeset ksh_typeset kshzerosubscript - \ ksh_zero_subscript listambiguous list_ambiguous listbeep - \ list_beep listpacked list_packed listrowsfirst list_rows_first - \ listtypes list_types localloops local_loops localoptions - \ local_options localpatterns local_patterns localtraps - \ local_traps log login longlistjobs long_list_jobs magicequalsubst - \ magic_equal_subst mailwarn mail_warn mail_warning mark_dirs - \ mailwarning markdirs menucomplete menu_complete monitor - \ multibyte multi_byte multifuncdef multi_func_def multios - \ multi_os nomatch no_match notify nullglob null_glob numericglobsort - \ numeric_glob_sort octalzeroes octal_zeroes onecmd one_cmd - \ overstrike over_strike pathdirs path_dirs pathscript - \ path_script physical pipefail pipe_fail posixaliases - \ posix_aliases posixargzero posix_arg_zero posix_argzero posixbuiltins - \ posix_builtins posixcd posix_cd posixidentifiers posix_identifiers - \ posixjobs posix_jobs posixstrings posix_strings posixtraps - \ posix_traps printeightbit print_eight_bit printexitvalue - \ print_exit_value privileged promptbang prompt_bang promptcr - \ prompt_cr promptpercent prompt_percent promptsp prompt_sp - \ promptsubst prompt_subst promptvars prompt_vars pushdignoredups - \ pushd_ignore_dups pushdminus pushd_minus pushdsilent pushd_silent - \ pushdtohome pushd_to_home rcexpandparam rc_expandparam rc_expand_param rcquotes - \ rc_quotes rcs recexact rec_exact rematchpcre re_match_pcre rematch_pcre - \ restricted rmstarsilent rm_star_silent rmstarwait rm_star_wait - \ sharehistory share_history shfileexpansion sh_file_expansion - \ shglob sh_glob shinstdin shin_stdin shnullcmd sh_nullcmd - \ shoptionletters sh_option_letters shortloops short_loops shwordsplit - \ sh_word_split singlecommand single_command singlelinezle single_line_zle - \ sourcetrace source_trace stdin sunkeyboardhack sun_keyboard_hack - \ trackall track_all transientrprompt transient_rprompt - \ trapsasync traps_async typesetsilent type_set_silent typeset_silent unset verbose vi - \ warncreateglobal warn_create_global xtrace zle -syn keyword zshOptions noaliases no_aliases noallexport no_allexport noall_export no_all_export noalwayslastprompt no_alwayslastprompt - \ noalways_lastprompt no_always_lastprompt no_always_last_prompt noalwaystoend no_alwaystoend noalways_to_end no_always_to_end - \ noappendcreate no_appendcreate no_append_create noappendhistory no_appendhistory noappend_history no_append_history noautocd - \ no_autocd no_auto_cd noautocontinue no_autocontinue noauto_continue no_auto_continue noautolist no_autolist noauto_list - \ no_auto_list noautomenu no_automenu noauto_menu no_auto_menu noautonamedirs no_autonamedirs noauto_name_dirs - \ no_auto_name_dirs noautoparamkeys no_autoparamkeys noauto_param_keys no_auto_param_keys noautoparamslash no_autoparamslash - \ noauto_param_slash no_auto_param_slash noautopushd no_autopushd noauto_pushd no_auto_pushd noautoremoveslash no_autoremoveslash - \ noauto_remove_slash no_auto_remove_slash noautoresume no_autoresume noauto_resume no_auto_resume nobadpattern no_badpattern no_bad_pattern - \ nobanghist no_banghist nobang_hist no_bang_hist nobareglobqual no_bareglobqual nobare_glob_qual no_bare_glob_qual - \ nobashautolist no_bashautolist nobash_auto_list no_bash_auto_list nobashrematch no_bashrematch nobash_rematch no_bash_rematch - \ nobeep no_beep nobgnice no_bgnice no_bg_nice nobraceccl no_braceccl nobrace_ccl no_brace_ccl nobraceexpand no_braceexpand nobrace_expand no_brace_expand - \ nobsdecho no_bsdecho nobsd_echo no_bsd_echo nocaseglob no_caseglob nocase_glob no_case_glob nocasematch no_casematch nocase_match no_case_match - \ nocbases no_cbases no_c_bases nocdablevars no_cdablevars no_cdable_vars nocd_able_vars no_cd_able_vars nochasedots no_chasedots nochase_dots no_chase_dots - \ nochaselinks no_chaselinks nochase_links no_chase_links nocheckjobs no_checkjobs nocheck_jobs no_check_jobs - \ noclobber no_clobber nocombiningchars no_combiningchars nocombining_chars no_combining_chars nocompletealiases no_completealiases - \ nocomplete_aliases no_complete_aliases nocompleteinword no_completeinword nocomplete_in_word no_complete_in_word - \ nocontinueonerror no_continueonerror nocontinue_on_error no_continue_on_error nocorrect no_correct - \ nocorrectall no_correctall nocorrect_all no_correct_all nocprecedences no_cprecedences noc_precedences no_c_precedences - \ nocshjunkiehistory no_cshjunkiehistory nocsh_junkie_history no_csh_junkie_history nocshjunkieloops no_cshjunkieloops - \ nocsh_junkie_loops no_csh_junkie_loops nocshjunkiequotes no_cshjunkiequotes nocsh_junkie_quotes no_csh_junkie_quotes - \ nocshnullcmd no_cshnullcmd no_csh_nullcmd nocsh_null_cmd no_csh_null_cmd nocshnullglob no_cshnullglob nocsh_null_glob no_csh_null_glob - \ nodebugbeforecmd no_debugbeforecmd nodebug_before_cmd no_debug_before_cmd nodotglob no_dotglob nodot_glob no_dot_glob nodvorak no_dvorak - \ noemacs no_emacs noequals no_equals noerrexit no_errexit noerr_exit no_err_exit noerrreturn no_errreturn noerr_return no_err_return noevallineno no_evallineno - \ noeval_lineno no_eval_lineno noexec no_exec noextendedglob no_extendedglob noextended_glob no_extended_glob noextendedhistory no_extendedhistory - \ noextended_history no_extended_history noflowcontrol no_flowcontrol noflow_control no_flow_control noforcefloat no_forcefloat - \ noforce_float no_force_float nofunctionargzero no_functionargzero nofunction_arg_zero no_function_argzero no_function_arg_zero noglob no_glob noglobalexport no_globalexport - \ noglobal_export no_global_export noglobalrcs no_globalrcs noglobal_rcs no_global_rcs noglobassign no_globassign noglob_assign no_glob_assign - \ noglobcomplete no_globcomplete noglob_complete no_glob_complete noglobdots no_globdots noglob_dots no_glob_dots - \ noglobstarshort no_glob_star_short noglob_subst no_glob_subst - \ noglobsubst no_globsubst nohashall no_hashall nohash_all no_hash_all nohashcmds no_hashcmds nohash_cmds no_hash_cmds nohashdirs no_hashdirs - \ nohash_dirs no_hash_dirs nohashexecutablesonly no_hashexecutablesonly nohash_executables_only no_hash_executables_only nohashlistall no_hashlistall - \ nohash_list_all no_hash_list_all nohistallowclobber no_histallowclobber nohist_allow_clobber no_hist_allow_clobber nohistappend no_histappend - \ nohist_append no_hist_append nohistbeep no_histbeep nohist_beep no_hist_beep nohist_expand no_hist_expand nohist_expire_dups_first no_hist_expire_dups_first - \ nohistexpand no_histexpand nohistexpiredupsfirst no_histexpiredupsfirst nohistfcntllock no_histfcntllock nohist_fcntl_lock no_hist_fcntl_lock - \ nohistfindnodups no_histfindnodups nohist_find_no_dups no_hist_find_no_dups nohistignorealldups no_histignorealldups - \ nohist_ignore_all_dups no_hist_ignore_all_dups nohistignoredups no_histignoredups nohist_ignore_dups no_hist_ignore_dups - \ nohistignorespace no_histignorespace nohist_ignore_space no_hist_ignore_space nohistlexwords no_histlexwords nohist_lex_words no_hist_lex_words - \ nohistnofunctions no_histnofunctions nohist_no_functions no_hist_no_functions nohistnostore no_histnostore nohist_no_store no_hist_no_store - \ nohistreduceblanks no_histreduceblanks nohist_reduce_blanks no_hist_reduce_blanks nohistsavebycopy no_histsavebycopy - \ nohist_save_by_copy no_hist_save_by_copy nohistsavenodups no_histsavenodups nohist_save_no_dups no_hist_save_no_dups - \ nohistsubstpattern no_histsubstpattern nohist_subst_pattern no_hist_subst_pattern nohistverify no_histverify nohist_verify no_hist_verify - \ nohup no_hup noignorebraces no_ignorebraces noignore_braces no_ignore_braces noignoreclosebraces no_ignoreclosebraces noignore_close_braces no_ignore_close_braces - \ noignoreeof no_ignoreeof noignore_eof no_ignore_eof noincappendhistory no_incappendhistory noinc_append_history no_inc_append_history - \ noincappendhistorytime no_incappendhistorytime noinc_append_history_time no_inc_append_history_time nointeractive no_interactive - \ nointeractivecomments no_interactivecomments nointeractive_comments no_interactive_comments noksharrays no_ksharrays noksh_arrays no_ksh_arrays - \ nokshautoload no_kshautoload noksh_autoload no_ksh_autoload nokshglob no_kshglob noksh_glob no_ksh_glob nokshoptionprint no_kshoptionprint - \ noksh_option_print no_ksh_option_print nokshtypeset no_kshtypeset noksh_typeset no_ksh_typeset nokshzerosubscript no_kshzerosubscript - \ noksh_zero_subscript no_ksh_zero_subscript nolistambiguous no_listambiguous nolist_ambiguous no_list_ambiguous nolistbeep no_listbeep - \ nolist_beep no_list_beep nolistpacked no_listpacked nolist_packed no_list_packed nolistrowsfirst no_listrowsfirst nolist_rows_first no_list_rows_first - \ nolisttypes no_listtypes nolist_types no_list_types nolocalloops no_localloops nolocal_loops no_local_loops nolocaloptions no_localoptions - \ nolocal_options no_local_options nolocalpatterns no_localpatterns nolocal_patterns no_local_patterns nolocaltraps no_localtraps - \ nolocal_traps no_local_traps nolog no_log nologin no_login nolonglistjobs no_longlistjobs nolong_list_jobs no_long_list_jobs nomagicequalsubst no_magicequalsubst - \ nomagic_equal_subst no_magic_equal_subst nomailwarn no_mailwarn nomail_warn no_mail_warn nomail_warning no_mail_warning nomark_dirs no_mark_dirs - \ nomailwarning no_mailwarning nomarkdirs no_markdirs nomenucomplete no_menucomplete nomenu_complete no_menu_complete nomonitor no_monitor - \ nomultibyte no_multibyte nomulti_byte no_multi_byte nomultifuncdef no_multifuncdef nomulti_func_def no_multi_func_def nomultios no_multios - \ nomulti_os no_multi_os nonomatch no_nomatch nono_match no_no_match nonotify no_notify nonullglob no_nullglob nonull_glob no_null_glob nonumericglobsort no_numericglobsort - \ nonumeric_glob_sort no_numeric_glob_sort nooctalzeroes no_octalzeroes nooctal_zeroes no_octal_zeroes noonecmd no_onecmd noone_cmd no_one_cmd - \ nooverstrike no_overstrike noover_strike no_over_strike nopathdirs no_pathdirs nopath_dirs no_path_dirs nopathscript no_pathscript - \ nopath_script no_path_script nophysical no_physical nopipefail no_pipefail nopipe_fail no_pipe_fail noposixaliases no_posixaliases - \ noposix_aliases no_posix_aliases noposixargzero no_posixargzero no_posix_argzero noposix_arg_zero no_posix_arg_zero noposixbuiltins no_posixbuiltins - \ noposix_builtins no_posix_builtins noposixcd no_posixcd noposix_cd no_posix_cd noposixidentifiers no_posixidentifiers noposix_identifiers no_posix_identifiers - \ noposixjobs no_posixjobs noposix_jobs no_posix_jobs noposixstrings no_posixstrings noposix_strings no_posix_strings noposixtraps no_posixtraps - \ noposix_traps no_posix_traps noprinteightbit no_printeightbit noprint_eight_bit no_print_eight_bit noprintexitvalue no_printexitvalue - \ noprint_exit_value no_print_exit_value noprivileged no_privileged nopromptbang no_promptbang noprompt_bang no_prompt_bang nopromptcr no_promptcr - \ noprompt_cr no_prompt_cr nopromptpercent no_promptpercent noprompt_percent no_prompt_percent nopromptsp no_promptsp noprompt_sp no_prompt_sp - \ nopromptsubst no_promptsubst noprompt_subst no_prompt_subst nopromptvars no_promptvars noprompt_vars no_prompt_vars nopushdignoredups no_pushdignoredups - \ nopushd_ignore_dups no_pushd_ignore_dups nopushdminus no_pushdminus nopushd_minus no_pushd_minus nopushdsilent no_pushdsilent nopushd_silent no_pushd_silent - \ nopushdtohome no_pushdtohome nopushd_to_home no_pushd_to_home norcexpandparam no_rcexpandparam norc_expandparam no_rc_expandparam no_rc_expand_param norcquotes no_rcquotes - \ norc_quotes no_rc_quotes norcs no_rcs norecexact no_recexact norec_exact no_rec_exact norematchpcre no_rematchpcre nore_match_pcre no_re_match_pcre no_rematch_pcre - \ norestricted no_restricted normstarsilent no_rmstarsilent norm_star_silent no_rm_star_silent normstarwait no_rmstarwait norm_star_wait no_rm_star_wait - \ nosharehistory no_sharehistory noshare_history no_share_history noshfileexpansion no_shfileexpansion nosh_file_expansion no_sh_file_expansion - \ noshglob no_shglob nosh_glob no_sh_glob noshinstdin no_shinstdin noshin_stdin no_shin_stdin noshnullcmd no_shnullcmd nosh_nullcmd no_sh_nullcmd - \ noshoptionletters no_shoptionletters nosh_option_letters no_sh_option_letters noshortloops no_shortloops noshort_loops no_short_loops noshwordsplit no_shwordsplit - \ nosh_word_split no_sh_word_split nosinglecommand no_singlecommand nosingle_command no_single_command nosinglelinezle no_singlelinezle nosingle_line_zle no_single_line_zle - \ nosourcetrace no_sourcetrace nosource_trace no_source_trace nostdin no_stdin nosunkeyboardhack no_sunkeyboardhack nosun_keyboard_hack no_sun_keyboard_hack - \ notrackall no_trackall notrack_all no_track_all notransientrprompt no_transientrprompt notransient_rprompt no_transient_rprompt - \ notrapsasync no_trapsasync notrapasync no_trapasync no_traps_async notypesetsilent no_typesetsilent notype_set_silent no_type_set_silent no_typeset_silent \nounset no_unset - \ noverbose no_verbose novi no_vi nowarncreateglobal no_warncreateglobal nowarn_create_global no_warn_create_global noxtrace no_xtrace nozle no_zle -syn case match +syn match zshOptStart /^\s*\%(\%(\%(un\)\?setopt\)\|set\s+[-+]o\)/ nextgroup=zshOption skipwhite +syn match zshOption /\%(\%(no_\?\)\?aliases\)\|\%(\%(no_\?\)\?allexport\)\|\%(\%(no_\?\)\?all_export\)\|\%(\%(no_\?\)\?alwayslastprompt\)\|\%(\%(no_\?\)\?always_last_prompt\)\|\%(\%(no_\?\)\?always_lastprompt\)\|\%(\%(no_\?\)\?alwaystoend\)\|\%(\%(no_\?\)\?always_to_end\)\|\%(\%(no_\?\)\?appendcreate\)\|\%(\%(no_\?\)\?append_create\)\|\%(\%(no_\?\)\?appendhistory\)\|\%(\%(no_\?\)\?append_history\)\|\%(\%(no_\?\)\?autocd\)\|\%(\%(no_\?\)\?auto_cd\)\|\%(\%(no_\?\)\?autocontinue\)\|\%(\%(no_\?\)\?auto_continue\)\|\%(\%(no_\?\)\?autolist\)\|\%(\%(no_\?\)\?auto_list\)\|\%(\%(no_\?\)\?automenu\)\|\%(\%(no_\?\)\?auto_menu\)\|\%(\%(no_\?\)\?autonamedirs\)\|\%(\%(no_\?\)\?auto_name_dirs\)\|\%(\%(no_\?\)\?autoparamkeys\)\|\%(\%(no_\?\)\?auto_param_keys\)\|\%(\%(no_\?\)\?autoparamslash\)\|\%(\%(no_\?\)\?auto_param_slash\)\|\%(\%(no_\?\)\?autopushd\)\|\%(\%(no_\?\)\?auto_pushd\)\|\%(\%(no_\?\)\?autoremoveslash\)\|\%(\%(no_\?\)\?auto_remove_slash\)\|\%(\%(no_\?\)\?autoresume\)\|\%(\%(no_\?\)\?auto_resume\)\|\%(\%(no_\?\)\?badpattern\)\|\%(\%(no_\?\)\?bad_pattern\)\|\%(\%(no_\?\)\?banghist\)\|\%(\%(no_\?\)\?bang_hist\)\|\%(\%(no_\?\)\?bareglobqual\)\|\%(\%(no_\?\)\?bare_glob_qual\)\|\%(\%(no_\?\)\?bashautolist\)\|\%(\%(no_\?\)\?bash_auto_list\)\|\%(\%(no_\?\)\?bashrematch\)\|\%(\%(no_\?\)\?bash_rematch\)\|\%(\%(no_\?\)\?beep\)\|\%(\%(no_\?\)\?bgnice\)\|\%(\%(no_\?\)\?bg_nice\)\|\%(\%(no_\?\)\?braceccl\)\|\%(\%(no_\?\)\?brace_ccl\)\|\%(\%(no_\?\)\?braceexpand\)\|\%(\%(no_\?\)\?brace_expand\)\|\%(\%(no_\?\)\?bsdecho\)\|\%(\%(no_\?\)\?bsd_echo\)\|\%(\%(no_\?\)\?caseglob\)\|\%(\%(no_\?\)\?case_glob\)\|\%(\%(no_\?\)\?casematch\)\|\%(\%(no_\?\)\?case_match\)\|\%(\%(no_\?\)\?cbases\)\|\%(\%(no_\?\)\?c_bases\)\|\%(\%(no_\?\)\?cdablevars\)\|\%(\%(no_\?\)\?cdable_vars\)\|\%(\%(no_\?\)\?cd_able_vars\)\|\%(\%(no_\?\)\?chasedots\)\|\%(\%(no_\?\)\?chase_dots\)\|\%(\%(no_\?\)\?chaselinks\)\|\%(\%(no_\?\)\?chase_links\)\|\%(\%(no_\?\)\?checkjobs\)\|\%(\%(no_\?\)\?check_jobs\)\|\%(\%(no_\?\)\?clobber\)\|\%(\%(no_\?\)\?combiningchars\)\|\%(\%(no_\?\)\?combining_chars\)\|\%(\%(no_\?\)\?completealiases\)\|\%(\%(no_\?\)\?complete_aliases\)\|\%(\%(no_\?\)\?completeinword\)\|\%(\%(no_\?\)\?complete_in_word\)\|\%(\%(no_\?\)\?continueonerror\)\|\%(\%(no_\?\)\?continue_on_error\)\|\%(\%(no_\?\)\?correct\)\|\%(\%(no_\?\)\?correctall\)\|\%(\%(no_\?\)\?correct_all\)\|\%(\%(no_\?\)\?cprecedences\)\|\%(\%(no_\?\)\?c_precedences\)\|\%(\%(no_\?\)\?cshjunkiehistory\)\|\%(\%(no_\?\)\?csh_junkie_history\)\|\%(\%(no_\?\)\?cshjunkieloops\)\|\%(\%(no_\?\)\?csh_junkie_loops\)\|\%(\%(no_\?\)\?cshjunkiequotes\)\|\%(\%(no_\?\)\?csh_junkie_quotes\)\|\%(\%(no_\?\)\?csh_nullcmd\)\|\%(\%(no_\?\)\?csh_null_cmd\)\|\%(\%(no_\?\)\?cshnullcmd\)\|\%(\%(no_\?\)\?csh_null_cmd\)\|\%(\%(no_\?\)\?cshnullglob\)\|\%(\%(no_\?\)\?csh_null_glob\)\|\%(\%(no_\?\)\?debugbeforecmd\)\|\%(\%(no_\?\)\?debug_before_cmd\)\|\%(\%(no_\?\)\?dotglob\)\|\%(\%(no_\?\)\?dot_glob\)\|\%(\%(no_\?\)\?dvorak\)\|\%(\%(no_\?\)\?emacs\)\|\%(\%(no_\?\)\?equals\)\|\%(\%(no_\?\)\?errexit\)\|\%(\%(no_\?\)\?err_exit\)\|\%(\%(no_\?\)\?errreturn\)\|\%(\%(no_\?\)\?err_return\)\|\%(\%(no_\?\)\?evallineno\)\|\%(\%(no_\?\)\?eval_lineno\)\|\%(\%(no_\?\)\?exec\)\|\%(\%(no_\?\)\?extendedglob\)\|\%(\%(no_\?\)\?extended_glob\)\|\%(\%(no_\?\)\?extendedhistory\)\|\%(\%(no_\?\)\?extended_history\)\|\%(\%(no_\?\)\?flowcontrol\)\|\%(\%(no_\?\)\?flow_control\)\|\%(\%(no_\?\)\?forcefloat\)\|\%(\%(no_\?\)\?force_float\)\|\%(\%(no_\?\)\?functionargzero\)\|\%(\%(no_\?\)\?function_argzero\)\|\%(\%(no_\?\)\?function_arg_zero\)\|\%(\%(no_\?\)\?glob\)\|\%(\%(no_\?\)\?globalexport\)\|\%(\%(no_\?\)\?global_export\)\|\%(\%(no_\?\)\?globalrcs\)\|\%(\%(no_\?\)\?global_rcs\)\|\%(\%(no_\?\)\?globassign\)\|\%(\%(no_\?\)\?glob_assign\)\|\%(\%(no_\?\)\?globcomplete\)\|\%(\%(no_\?\)\?glob_complete\)\|\%(\%(no_\?\)\?globdots\)\|\%(\%(no_\?\)\?glob_dots\)\|\%(\%(no_\?\)\?glob_subst\)\|\%(\%(no_\?\)\?globsubst\)\|\%(\%(no_\?\)\?globstarshort\)\|\%(\%(no_\?\)\?glob_star_short\)\|\%(\%(no_\?\)\?hashall\)\|\%(\%(no_\?\)\?hash_all\)\|\%(\%(no_\?\)\?hashcmds\)\|\%(\%(no_\?\)\?hash_cmds\)\|\%(\%(no_\?\)\?hashdirs\)\|\%(\%(no_\?\)\?hash_dirs\)\|\%(\%(no_\?\)\?hashexecutablesonly\)\|\%(\%(no_\?\)\?hash_executables_only\)\|\%(\%(no_\?\)\?hashlistall\)\|\%(\%(no_\?\)\?hash_list_all\)\|\%(\%(no_\?\)\?histallowclobber\)\|\%(\%(no_\?\)\?hist_allow_clobber\)\|\%(\%(no_\?\)\?histappend\)\|\%(\%(no_\?\)\?hist_append\)\|\%(\%(no_\?\)\?histbeep\)\|\%(\%(no_\?\)\?hist_beep\)\|\%(\%(no_\?\)\?hist_expand\)\|\%(\%(no_\?\)\?hist_expire_dups_first\)\|\%(\%(no_\?\)\?histexpand\)\|\%(\%(no_\?\)\?histexpiredupsfirst\)\|\%(\%(no_\?\)\?histfcntllock\)\|\%(\%(no_\?\)\?hist_fcntl_lock\)\|\%(\%(no_\?\)\?histfindnodups\)\|\%(\%(no_\?\)\?hist_find_no_dups\)\|\%(\%(no_\?\)\?histignorealldups\)\|\%(\%(no_\?\)\?hist_ignore_all_dups\)\|\%(\%(no_\?\)\?histignoredups\)\|\%(\%(no_\?\)\?hist_ignore_dups\)\|\%(\%(no_\?\)\?histignorespace\)\|\%(\%(no_\?\)\?hist_ignore_space\)\|\%(\%(no_\?\)\?histlexwords\)\|\%(\%(no_\?\)\?hist_lex_words\)\|\%(\%(no_\?\)\?histnofunctions\)\|\%(\%(no_\?\)\?hist_no_functions\)\|\%(\%(no_\?\)\?histnostore\)\|\%(\%(no_\?\)\?hist_no_store\)\|\%(\%(no_\?\)\?histreduceblanks\)\|\%(\%(no_\?\)\?hist_reduce_blanks\)\|\%(\%(no_\?\)\?histsavebycopy\)\|\%(\%(no_\?\)\?hist_save_by_copy\)\|\%(\%(no_\?\)\?histsavenodups\)\|\%(\%(no_\?\)\?hist_save_no_dups\)\|\%(\%(no_\?\)\?histsubstpattern\)\|\%(\%(no_\?\)\?hist_subst_pattern\)\|\%(\%(no_\?\)\?histverify\)\|\%(\%(no_\?\)\?hist_verify\)\|\%(\%(no_\?\)\?hup\)\|\%(\%(no_\?\)\?ignorebraces\)\|\%(\%(no_\?\)\?ignore_braces\)\|\%(\%(no_\?\)\?ignoreclosebraces\)\|\%(\%(no_\?\)\?ignore_close_braces\)\|\%(\%(no_\?\)\?ignoreeof\)\|\%(\%(no_\?\)\?ignore_eof\)\|\%(\%(no_\?\)\?incappendhistory\)\|\%(\%(no_\?\)\?inc_append_history\)\|\%(\%(no_\?\)\?incappendhistorytime\)\|\%(\%(no_\?\)\?inc_append_history_time\)\|\%(\%(no_\?\)\?interactive\)\|\%(\%(no_\?\)\?interactivecomments\)\|\%(\%(no_\?\)\?interactive_comments\)\|\%(\%(no_\?\)\?ksharrays\)\|\%(\%(no_\?\)\?ksh_arrays\)\|\%(\%(no_\?\)\?kshautoload\)\|\%(\%(no_\?\)\?ksh_autoload\)\|\%(\%(no_\?\)\?kshglob\)\|\%(\%(no_\?\)\?ksh_glob\)\|\%(\%(no_\?\)\?kshoptionprint\)\|\%(\%(no_\?\)\?ksh_option_print\)\|\%(\%(no_\?\)\?kshtypeset\)\|\%(\%(no_\?\)\?ksh_typeset\)\|\%(\%(no_\?\)\?kshzerosubscript\)\|\%(\%(no_\?\)\?ksh_zero_subscript\)\|\%(\%(no_\?\)\?listambiguous\)\|\%(\%(no_\?\)\?list_ambiguous\)\|\%(\%(no_\?\)\?listbeep\)\|\%(\%(no_\?\)\?list_beep\)\|\%(\%(no_\?\)\?listpacked\)\|\%(\%(no_\?\)\?list_packed\)\|\%(\%(no_\?\)\?listrowsfirst\)\|\%(\%(no_\?\)\?list_rows_first\)\|\%(\%(no_\?\)\?listtypes\)\|\%(\%(no_\?\)\?list_types\)\|\%(\%(no_\?\)\?localloops\)\|\%(\%(no_\?\)\?local_loops\)\|\%(\%(no_\?\)\?localoptions\)\|\%(\%(no_\?\)\?local_options\)\|\%(\%(no_\?\)\?localpatterns\)\|\%(\%(no_\?\)\?local_patterns\)\|\%(\%(no_\?\)\?localtraps\)\|\%(\%(no_\?\)\?local_traps\)\|\%(\%(no_\?\)\?log\)\|\%(\%(no_\?\)\?login\)\|\%(\%(no_\?\)\?longlistjobs\)\|\%(\%(no_\?\)\?long_list_jobs\)\|\%(\%(no_\?\)\?magicequalsubst\)\|\%(\%(no_\?\)\?magic_equal_subst\)\|\%(\%(no_\?\)\?mailwarn\)\|\%(\%(no_\?\)\?mail_warn\)\|\%(\%(no_\?\)\?mail_warning\)\|\%(\%(no_\?\)\?mark_dirs\)\|\%(\%(no_\?\)\?mailwarning\)\|\%(\%(no_\?\)\?markdirs\)\|\%(\%(no_\?\)\?menucomplete\)\|\%(\%(no_\?\)\?menu_complete\)\|\%(\%(no_\?\)\?monitor\)\|\%(\%(no_\?\)\?multibyte\)\|\%(\%(no_\?\)\?multi_byte\)\|\%(\%(no_\?\)\?multifuncdef\)\|\%(\%(no_\?\)\?multi_func_def\)\|\%(\%(no_\?\)\?multios\)\|\%(\%(no_\?\)\?multi_os\)\|\%(\%(no_\?\)\?nomatch\)\|\%(\%(no_\?\)\?no_match\)\|\%(\%(no_\?\)\?notify\)\|\%(\%(no_\?\)\?nullglob\)\|\%(\%(no_\?\)\?null_glob\)\|\%(\%(no_\?\)\?numericglobsort\)\|\%(\%(no_\?\)\?numeric_glob_sort\)\|\%(\%(no_\?\)\?octalzeroes\)\|\%(\%(no_\?\)\?octal_zeroes\)\|\%(\%(no_\?\)\?onecmd\)\|\%(\%(no_\?\)\?one_cmd\)\|\%(\%(no_\?\)\?overstrike\)\|\%(\%(no_\?\)\?over_strike\)\|\%(\%(no_\?\)\?pathdirs\)\|\%(\%(no_\?\)\?path_dirs\)\|\%(\%(no_\?\)\?pathscript\)\|\%(\%(no_\?\)\?path_script\)\|\%(\%(no_\?\)\?physical\)\|\%(\%(no_\?\)\?pipefail\)\|\%(\%(no_\?\)\?pipe_fail\)\|\%(\%(no_\?\)\?posixaliases\)\|\%(\%(no_\?\)\?posix_aliases\)\|\%(\%(no_\?\)\?posixargzero\)\|\%(\%(no_\?\)\?posix_arg_zero\)\|\%(\%(no_\?\)\?posix_argzero\)\|\%(\%(no_\?\)\?posixbuiltins\)\|\%(\%(no_\?\)\?posix_builtins\)\|\%(\%(no_\?\)\?posixcd\)\|\%(\%(no_\?\)\?posix_cd\)\|\%(\%(no_\?\)\?posixidentifiers\)\|\%(\%(no_\?\)\?posix_identifiers\)\|\%(\%(no_\?\)\?posixjobs\)\|\%(\%(no_\?\)\?posix_jobs\)\|\%(\%(no_\?\)\?posixstrings\)\|\%(\%(no_\?\)\?posix_strings\)\|\%(\%(no_\?\)\?posixtraps\)\|\%(\%(no_\?\)\?posix_traps\)\|\%(\%(no_\?\)\?printeightbit\)\|\%(\%(no_\?\)\?print_eight_bit\)\|\%(\%(no_\?\)\?printexitvalue\)\|\%(\%(no_\?\)\?print_exit_value\)\|\%(\%(no_\?\)\?privileged\)\|\%(\%(no_\?\)\?promptbang\)\|\%(\%(no_\?\)\?prompt_bang\)\|\%(\%(no_\?\)\?promptcr\)\|\%(\%(no_\?\)\?prompt_cr\)\|\%(\%(no_\?\)\?promptpercent\)\|\%(\%(no_\?\)\?prompt_percent\)\|\%(\%(no_\?\)\?promptsp\)\|\%(\%(no_\?\)\?prompt_sp\)\|\%(\%(no_\?\)\?promptsubst\)\|\%(\%(no_\?\)\?prompt_subst\)\|\%(\%(no_\?\)\?promptvars\)\|\%(\%(no_\?\)\?prompt_vars\)\|\%(\%(no_\?\)\?pushdignoredups\)\|\%(\%(no_\?\)\?pushd_ignore_dups\)\|\%(\%(no_\?\)\?pushdminus\)\|\%(\%(no_\?\)\?pushd_minus\)\|\%(\%(no_\?\)\?pushdsilent\)\|\%(\%(no_\?\)\?pushd_silent\)\|\%(\%(no_\?\)\?pushdtohome\)\|\%(\%(no_\?\)\?pushd_to_home\)\|\%(\%(no_\?\)\?rcexpandparam\)\|\%(\%(no_\?\)\?rc_expandparam\)\|\%(\%(no_\?\)\?rc_expand_param\)\|\%(\%(no_\?\)\?rcquotes\)\|\%(\%(no_\?\)\?rc_quotes\)\|\%(\%(no_\?\)\?rcs\)\|\%(\%(no_\?\)\?recexact\)\|\%(\%(no_\?\)\?rec_exact\)\|\%(\%(no_\?\)\?rematchpcre\)\|\%(\%(no_\?\)\?re_match_pcre\)\|\%(\%(no_\?\)\?rematch_pcre\)\|\%(\%(no_\?\)\?restricted\)\|\%(\%(no_\?\)\?rmstarsilent\)\|\%(\%(no_\?\)\?rm_star_silent\)\|\%(\%(no_\?\)\?rmstarwait\)\|\%(\%(no_\?\)\?rm_star_wait\)\|\%(\%(no_\?\)\?sharehistory\)\|\%(\%(no_\?\)\?share_history\)\|\%(\%(no_\?\)\?shfileexpansion\)\|\%(\%(no_\?\)\?sh_file_expansion\)\|\%(\%(no_\?\)\?shglob\)\|\%(\%(no_\?\)\?sh_glob\)\|\%(\%(no_\?\)\?shinstdin\)\|\%(\%(no_\?\)\?shin_stdin\)\|\%(\%(no_\?\)\?shnullcmd\)\|\%(\%(no_\?\)\?sh_nullcmd\)\|\%(\%(no_\?\)\?shoptionletters\)\|\%(\%(no_\?\)\?sh_option_letters\)\|\%(\%(no_\?\)\?shortloops\)\|\%(\%(no_\?\)\?short_loops\)\|\%(\%(no_\?\)\?shwordsplit\)\|\%(\%(no_\?\)\?sh_word_split\)\|\%(\%(no_\?\)\?singlecommand\)\|\%(\%(no_\?\)\?single_command\)\|\%(\%(no_\?\)\?singlelinezle\)\|\%(\%(no_\?\)\?single_line_zle\)\|\%(\%(no_\?\)\?sourcetrace\)\|\%(\%(no_\?\)\?source_trace\)\|\%(\%(no_\?\)\?stdin\)\|\%(\%(no_\?\)\?sunkeyboardhack\)\|\%(\%(no_\?\)\?sun_keyboard_hack\)\|\%(\%(no_\?\)\?trackall\)\|\%(\%(no_\?\)\?track_all\)\|\%(\%(no_\?\)\?transientrprompt\)\|\%(\%(no_\?\)\?transient_rprompt\)\|\%(\%(no_\?\)\?trapsasync\)\|\%(\%(no_\?\)\?traps_async\)\|\%(\%(no_\?\)\?typesetsilent\)\|\%(\%(no_\?\)\?type_set_silent\)\|\%(\%(no_\?\)\?typeset_silent\)\|\%(\%(no_\?\)\?unset\)\|\%(\%(no_\?\)\?verbose\)\|\%(\%(no_\?\)\?vi\)\|\%(\%(no_\?\)\?warncreateglobal\)\|\%(\%(no_\?\)\?warn_create_global\)\|\%(\%(no_\?\)\?xtrace\)\|\%(\%(no_\?\)\?zle\)/ nextgroup=zshOption skipwhite contained syn keyword zshTypes float integer local typeset declare private @@ -319,9 +152,9 @@ syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst syn region zshSubst matchgroup=zshSubstDelim transparent \ start='\$(' skip='\\)' end=')' contains=TOP fold syn region zshParentheses transparent start='(' skip='\\)' end=')' fold +syn region zshGlob start='(#' end=')' syn region zshMathSubst matchgroup=zshSubstDelim transparent - \ start='\$((' skip='\\)' - \ matchgroup=zshSubstDelim end='))' + \ start='\$((' skip='\\)' end='))' \ contains=zshParentheses,@zshSubst,zshNumber, \ @zshDerefs,zshString keepend fold syn region zshBrackets contained transparent start='{' skip='\\}' @@ -359,23 +192,13 @@ hi def link zshRedir Operator hi def link zshVariable None hi def link zshVariableDef zshVariable hi def link zshDereferencing PreProc -if s:zsh_syntax_variables =~ 'short\|all' - hi def link zshShortDeref zshDereferencing -else - hi def link zshShortDeref None -endif -if s:zsh_syntax_variables =~ 'long\|all' - hi def link zshLongDeref zshDereferencing -else - hi def link zshLongDeref None -endif -if s:zsh_syntax_variables =~ 'all' - hi def link zshDeref zshDereferencing -else - hi def link zshDeref None -endif +hi def link zshShortDeref zshDereferencing +hi def link zshLongDeref zshDereferencing +hi def link zshDeref zshDereferencing +hi def link zshDollarVar zshDereferencing hi def link zshCommands Keyword -hi def link zshOptions Constant +hi def link zshOptStart Keyword +hi def link zshOption Constant hi def link zshTypes Type hi def link zshSwitches Special hi def link zshNumber Number @@ -383,6 +206,7 @@ hi def link zshSubst PreProc hi def link zshMathSubst zshSubst hi def link zshOldSubst zshSubst hi def link zshSubstDelim zshSubst +hi def link zshGlob zshSubst let b:current_syntax = "zsh" From 60179b8a3be5ffeb5543660c45a71d99634259ee Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 01:20:13 +0100 Subject: [PATCH 05/11] vim-patch:0635ee682481 Runtime file updates https://github.com/vim/vim/commit/0635ee682481e2da0d39cd970b3cb573a1c12a17 --- runtime/syntax/php.vim | 50 +++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index 278fc1358c..8f78beff94 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: php PHP 3/4/5/7 " Maintainer: Jason Woofenden -" Last Change: Dec 11, 2016 +" Last Change: Apr 28, 2017 " URL: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blob;f=php.vim;hb=HEAD " Former Maintainers: Peter Hodge " Debian VIM Maintainers @@ -11,32 +11,28 @@ " colourscheme, because elflord's colours will better highlight the break-points " (Statements) in your code. " -" Options: php_sql_query = 1 for SQL syntax highlighting inside strings -" php_htmlInStrings = 1 for HTML syntax highlighting inside strings -" php_baselib = 1 for highlighting baselib functions -" php_asp_tags = 1 for highlighting ASP-style short tags -" php_parent_error_close = 1 for highlighting parent error ] or ) -" php_parent_error_open = 1 for skipping an php end tag, if there exists an open ( or [ without a closing one -" php_oldStyle = 1 for using old colorstyle -" php_noShortTags = 1 don't sync as php -" php_folding = 1 for folding classes and functions -" php_folding = 2 for folding all { } regions -" php_sync_method = x -" x=-1 to sync by search ( default ) -" x>0 to sync at least x lines backwards -" x=0 to sync from start -" -" Added by Peter Hodge On June 9, 2006: -" php_special_functions = 1|0 to highlight functions with abnormal behaviour -" php_alt_comparisons = 1|0 to highlight comparison operators in an alternate colour -" php_alt_assignByReference = 1|0 to highlight '= &' in an alternate colour -" -" Note: these all default to 1 (On), so you would set them to '0' to turn them off. -" E.g., in your .vimrc or _vimrc file: -" let php_special_functions = 0 -" let php_alt_comparisons = 0 -" let php_alt_assignByReference = 0 -" Unletting these variables will revert back to their default (On). +" Options: +" Set to anything to enable: +" php_sql_query SQL syntax highlighting inside strings +" php_htmlInStrings HTML syntax highlighting inside strings +" php_baselib highlighting baselib functions +" php_asp_tags highlighting ASP-style short tags +" php_parent_error_close highlighting parent error ] or ) +" php_parent_error_open skipping an php end tag, if there exists +" an open ( or [ without a closing one +" php_oldStyle use old colorstyle +" php_noShortTags don't sync as php +" Set to a specific value: +" php_folding = 1 fold classes and functions +" php_folding = 2 fold all { } regions +" php_sync_method = x where x is an integer: +" -1 sync by search ( default ) +" >0 sync at least x lines backwards +" 0 sync from start +" Set to 0 to _disable_: (Added by Peter Hodge On June 9, 2006) +" php_special_functions = 0 highlight functions with abnormal behaviour +" php_alt_comparisons = 0 comparison operators in an alternate colour +" php_alt_assignByReference = 0 '= &' in an alternate colour " " " Note: From 78223bc97f6c7b4376ff9b8708e2bec4cea92f6d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 01:20:56 +0100 Subject: [PATCH 06/11] vim-patch:b4d6c3ea4a59 Update runtime files. https://github.com/vim/vim/commit/b4d6c3ea4a59c6d8d4e0e52120596866f0edd510 --- runtime/doc/options.txt | 6 ++ runtime/doc/pi_matchit.txt | 7 ++- runtime/doc/usr_44.txt | 2 +- runtime/filetype.vim | 11 ++-- runtime/ftplugin/sbt.vim | 15 +++++ runtime/indent/sh.vim | 19 +++--- runtime/indent/tex.vim | 119 ++++++++++++++++++++----------------- runtime/syntax/c.vim | 58 +++++++----------- runtime/syntax/sbt.vim | 32 ++++++++++ 9 files changed, 161 insertions(+), 108 deletions(-) create mode 100644 runtime/ftplugin/sbt.vim create mode 100644 runtime/syntax/sbt.vim diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 045f3ada45..20526677e9 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -711,6 +711,12 @@ A jump table for the options with a short description can be found at |Q_op|. < Vim will guess the value. In the GUI this should work correctly, in other cases Vim might not be able to guess the right value. + When the t_BG option is set, Vim will use it to request the background + color from the terminal. If the returned RGB value is dark/light and + 'background' is not dark/light, 'background' will be set and the + screen is redrawn. This may have side effects, make t_BG empty in + your .vimrc if you suspect this problem. + When starting the GUI, the default value for 'background' will be "light". When the value is not set in the gvimrc, and Vim detects that the background is actually quite dark, 'background' is set to diff --git a/runtime/doc/pi_matchit.txt b/runtime/doc/pi_matchit.txt index c711cd588f..652734f7bb 100644 --- a/runtime/doc/pi_matchit.txt +++ b/runtime/doc/pi_matchit.txt @@ -1,6 +1,6 @@ *pi_matchit.txt* Extended "%" matching -For Vim version 6.3. Last change: 2015 May 21 +For Vim version 6.3. Last change: 2017 May 14 *matchit* *matchit.vim* @@ -211,7 +211,7 @@ Examples: In LaTeX, since "%" is used as the comment character, you can > :let b:match_skip = 'r:%' < Unfortunately, this will skip anything after "\%", an escaped "%". To - allow for this, and also "\\%" (an excaped backslash followed by the + allow for this, and also "\\%" (an escaped backslash followed by the comment character) you can > :let b:match_skip = 'r:\(^\|[^\\]\)\(\\\\\)*%' < @@ -356,7 +356,8 @@ The back reference '\'.d refers to the same thing as '\'.b:match_table[d] in The various |:vmap|s defined in the script (%, |g%|, |[%|, |]%|, |a%|) may have undesired effects in Select mode |Select-mode-mapping|. At least, if you want to replace the selection with any character in "ag%[]" there will be a -pause of |'updatetime'| first. +pause of |'updatetime'| first. E.g., "yV%" would normally work linewise, but +the plugin mapping makes it characterwise. It would be nice if "\0" were recognized as the entire pattern. That is, it would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1". diff --git a/runtime/doc/usr_44.txt b/runtime/doc/usr_44.txt index fcd6b71219..b06557b950 100644 --- a/runtime/doc/usr_44.txt +++ b/runtime/doc/usr_44.txt @@ -686,7 +686,7 @@ that included files do this too, you might have to reset "b:current_syntax" if you include two files. If you want your syntax file to work with Vim 5.x, add a check for v:version. -See yacc.vim for an example. +Find an syntax file in the Vim 7.2 distribution for an example. Do not include anything that is a user preference. Don't set 'tabstop', 'expandtab', etc. These belong in a filetype plugin. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 1bfbca5764..a6ecdd401a 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2017 Apr 20 +" Last Change: 2017 May 27 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -976,7 +976,7 @@ au BufNewFile,BufRead */etc/initng/*/*.i,*.ii setf initng " Innovation Data Processing au BufRead,BufNewFile upstream.dat\c,upstream.*.dat\c,*.upstream.dat\c setf upstreamdat -au BufRead,BufNewFile upstream.log\c,upstream.*.log\c,*.upstream.log\c setf upstreamlog +au BufRead,BufNewFile fdrupstream.log,upstream.log\c,upstream.*.log\c,*.upstream.log\c,UPSTREAM-*.log\c setf upstreamlog au BufRead,BufNewFile upstreaminstall.log\c,upstreaminstall.*.log\c,*.upstreaminstall.log\c setf upstreaminstalllog au BufRead,BufNewFile usserver.log\c,usserver.*.log\c,*.usserver.log\c setf usserverlog au BufRead,BufNewFile usw2kagt.log\c,usw2kagt.*.log\c,*.usw2kagt.log\c setf usw2kagtlog @@ -1414,8 +1414,8 @@ if has("fname_case") else au BufNewFile,BufRead *.pl call s:FTpl() endif -au BufNewFile,BufRead *.plx,*.al setf perl -au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6 +au BufNewFile,BufRead *.plx,*.al,*.psgi setf perl +au BufNewFile,BufRead *.p6,*.pm6,*.pl6 setf perl6 func! s:FTpl() if exists("g:filetype_pl") @@ -1802,6 +1802,9 @@ au BufNewFile,BufRead *.sa setf sather " Scala au BufNewFile,BufRead *.scala setf scala +" SBT - Scala Build Tool +au BufNewFile,BufRead *.sbt setf sbt + " Scilab au BufNewFile,BufRead *.sci,*.sce setf scilab diff --git a/runtime/ftplugin/sbt.vim b/runtime/ftplugin/sbt.vim new file mode 100644 index 0000000000..309d30e503 --- /dev/null +++ b/runtime/ftplugin/sbt.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin file +" Language: sbt +" Maintainer: Steven Dobay +" License: Same as Vim +" Last Change: 2017.04.30 +" ---------------------------------------------------------------------------- + +if exists('b:did_ftplugin') || &cp + finish +endif + +let b:did_ftplugin = 1 + +runtime! ftplugin/scala.vim + diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index aca110f504..ae4f4b53c4 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -3,10 +3,12 @@ " Maintainer: Christian Brabandt " Previous Maintainer: Peter Aronoff " Original Author: Nikolai Weibull -" Latest Revision: 2016-06-27 +" Latest Revision: 2017-05-02 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-sh-indent " Changelog: +" 20170502: - get rid of buffer-shiftwidth function +" 20160912: - preserve indentation of here-doc blocks " 20160627: - detect heredocs correctly " 20160213: - detect function definition correctly " 20160202: - use shiftwidth() function @@ -33,15 +35,11 @@ endif let s:cpo_save = &cpo set cpo&vim -function s:buffer_shiftwidth() - return shiftwidth() -endfunction - let s:sh_indent_defaults = { - \ 'default': function('s:buffer_shiftwidth'), - \ 'continuation-line': function('s:buffer_shiftwidth'), - \ 'case-labels': function('s:buffer_shiftwidth'), - \ 'case-statements': function('s:buffer_shiftwidth'), + \ 'default': function('shiftwidth'), + \ 'continuation-line': function('shiftwidth'), + \ 'case-labels': function('shiftwidth'), + \ 'case-statements': function('shiftwidth'), \ 'case-breaks': 0 } function! s:indent_value(option) @@ -110,6 +108,9 @@ function! GetShIndent() let ind -= s:indent_value('case-breaks') elseif s:is_here_doc(line) let ind = 0 + " statements, executed within a here document. Keep the current indent + elseif match(map(synstack(v:lnum, 1), 'synIDattr(v:val, "name")'), '\c\mheredoc') > -1 + return indent(v:lnum) endif return ind diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim index 0150bb9623..fc6cc0a638 100644 --- a/runtime/indent/tex.vim +++ b/runtime/indent/tex.vim @@ -1,8 +1,8 @@ " Vim indent file " Language: LaTeX -" Maintainer: YiChao Zhou +" Maintainer: Yichao Zhou " Created: Sat, 16 Feb 2002 16:50:19 +0100 -" Version: 0.9.2 +" Version: 0.9.4 " Please email me if you found something I can do. Comments, bug report and " feature request are welcome. @@ -15,49 +15,53 @@ " 2005/06/15, Moshe Kaminsky " (*) New variables: " g:tex_items, g:tex_itemize_env, g:tex_noindent_env -" 2011/3/6, by Zhou YiChao +" 2011/3/6, by Yichao Zhou " (*) Don't change indentation of lines starting with '%' " I don't see any code with '%' and it doesn't work properly " so I add some code. " (*) New features: Add smartindent-like indent for "{}" and "[]". " (*) New variables: g:tex_indent_brace -" 2011/9/25, by Zhou Yichao +" 2011/9/25, by Yichao Zhou " (*) Bug fix: smartindent-like indent for "[]" " (*) New features: Align with "&". " (*) New variable: g:tex_indent_and. -" 2011/10/23 by Zhou Yichao +" 2011/10/23 by Yichao Zhou " (*) Bug fix: improve the smartindent-like indent for "{}" and " "[]". -" 2012/02/27 by Zhou Yichao +" 2012/02/27 by Yichao Zhou " (*) Bug fix: support default folding marker. " (*) Indent with "&" is not very handy. Make it not enable by " default. -" 2012/03/06 by Zhou Yichao +" 2012/03/06 by Yichao Zhou " (*) Modify "&" behavior and make it default again. Now "&" " won't align when there are more then one "&" in the previous " line. " (*) Add indent "\left(" and "\right)" " (*) Trust user when in "verbatim" and "lstlisting" -" 2012/03/11 by Zhou Yichao +" 2012/03/11 by Yichao Zhou " (*) Modify "&" so that only indent when current line start with " "&". -" 2012/03/12 by Zhou Yichao +" 2012/03/12 by Yichao Zhou " (*) Modify indentkeys. -" 2012/03/18 by Zhou Yichao +" 2012/03/18 by Yichao Zhou " (*) Add &cpo -" 2013/05/02 by Zhou Yichao +" 2013/05/02 by Yichao Zhou " (*) Fix problem about GetTeXIndent checker. Thank Albert Netymk " for reporting this. -" 2014/06/23 by Zhou Yichao +" 2014/06/23 by Yichao Zhou " (*) Remove the feature g:tex_indent_and because it is buggy. " (*) If there is not any obvious indentation hints, we do not " alert our user's current indentation. " (*) g:tex_indent_brace now only works if the open brace is the " last character of that line. -" 2014/08/03 by Zhou Yichao +" 2014/08/03 by Yichao Zhou " (*) Indent current line if last line has larger indentation -" 2014/08/09 by Zhou Yichao -" (*) Add missing return value for s:GetEndIndentation(...) +" 2016/11/08 by Yichao Zhou +" (*) Fix problems for \[ and \]. Thanks Bruno for reporting. +" 2017/04/30 by Yichao Zhou +" (*) Fix a bug between g:tex_noindent_env and g:tex_indent_items +" Now g:tex_noindent_env='document\|verbatim\|itemize' (Emacs +" style) is supported. Thanks Miles Wheeler for reporting. " " }}} @@ -81,44 +85,44 @@ " % Example 2 " \tikzexternalize[ " prefix=tikz] -" +" " * g:tex_indent_items " " If this variable is set, item-environments are indented like Emacs does " it, i.e., continuation lines are indented with a shiftwidth. -" +" " NOTE: I've already set the variable below; delete the corresponding line " if you don't like this behaviour. " " Per default, it is unset. -" +" " set unset " ---------------------------------------------------------------- -" \begin{itemize} \begin{itemize} +" \begin{itemize} \begin{itemize} " \item blablabla \item blablabla -" bla bla bla bla bla bla +" bla bla bla bla bla bla " \item blablabla \item blablabla -" bla bla bla bla bla bla -" \end{itemize} \end{itemize} +" bla bla bla bla bla bla +" \end{itemize} \end{itemize} " " " * g:tex_items " -" A list of tokens to be considered as commands for the beginning of an item -" command. The tokens should be separated with '\|'. The initial '\' should +" A list of tokens to be considered as commands for the beginning of an item +" command. The tokens should be separated with '\|'. The initial '\' should " be escaped. The default is '\\bibitem\|\\item'. " " * g:tex_itemize_env -" -" A list of environment names, separated with '\|', where the items (item -" commands matching g:tex_items) may appear. The default is +" +" A list of environment names, separated with '\|', where the items (item +" commands matching g:tex_items) may appear. The default is " 'itemize\|description\|enumerate\|thebibliography'. " " * g:tex_noindent_env " -" A list of environment names. separated with '\|', where no indentation is +" A list of environment names. separated with '\|', where no indentation is " required. The default is 'document\|verbatim'. -" }}} +" }}} " Only define the function once if exists("b:did_indent") @@ -146,7 +150,7 @@ if g:tex_indent_items let g:tex_itemize_env = 'itemize\|description\|enumerate\|thebibliography' endif if !exists('g:tex_items') - let g:tex_items = '\\bibitem\|\\item' + let g:tex_items = '\\bibitem\|\\item' endif else let g:tex_items = '' @@ -177,7 +181,7 @@ function! GetTeXIndent() " {{{ " At the start of the file use zero indent. if lnum == 0 - return 0 + return 0 endif let line = substitute(getline(lnum), '\s*%.*', '','g') " last line @@ -191,9 +195,9 @@ function! GetTeXIndent() " {{{ return indent(v:lnum) end endif - + if lnum == 0 - return 0 + return 0 endif let ind = indent(lnum) @@ -206,12 +210,14 @@ function! GetTeXIndent() " {{{ " Add a 'shiftwidth' after beginning of environments. " Don't add it for \begin{document} and \begin{verbatim} - ""if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim' + " if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim' " LH modification : \begin does not always start a line " ZYC modification : \end after \begin won't cause wrong indent anymore - if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env - let ind = ind + &sw - let stay = 0 + if line =~ '\\begin{.*}' + if line !~ g:tex_noindent_env + let ind = ind + &sw + let stay = 0 + endif if g:tex_indent_items " Add another sw for item-environments @@ -245,29 +251,27 @@ function! GetTeXIndent() " {{{ endif if g:tex_indent_brace - let char = line[strlen(line)-1] - if char == '[' || char == '{' + if line =~ '[[{]$' let ind += &sw let stay = 0 endif - let cind = indent(v:lnum) - let char = cline[cind] - if (char == ']' || char == '}') && - \ s:CheckPairedIsLastCharacter(v:lnum, cind) + if cline =~ '^\s*\\\?[\]}]' && s:CheckPairedIsLastCharacter(v:lnum, indent(v:lnum)) let ind -= &sw let stay = 0 endif - for i in range(indent(lnum)+1, strlen(line)-1) - let char = line[i] - if char == ']' || char == '}' - if s:CheckPairedIsLastCharacter(lnum, i) - let ind -= &sw - let stay = 0 + if line !~ '^\s*\\\?[\]}]' + for i in range(indent(lnum)+1, strlen(line)-1) + let char = line[i] + if char == ']' || char == '}' + if s:CheckPairedIsLastCharacter(lnum, i) + let ind -= &sw + let stay = 0 + endif endif - endif - endfor + endfor + endif endif " Special treatment for 'item' @@ -309,12 +313,12 @@ function! s:GetLastBeginIndentation(lnum) " {{{ let matchend -= 1 endif if matchend == 0 - if line =~ g:tex_itemize_env - return indent(lnum) + 2 * &sw - endif if line =~ g:tex_noindent_env return indent(lnum) endif + if line =~ g:tex_itemize_env + return indent(lnum) + 2 * &sw + endif return indent(lnum) + &sw endif endfor @@ -348,12 +352,15 @@ endfunction " Most of the code is from matchparen.vim function! s:CheckPairedIsLastCharacter(lnum, col) "{{{ - " Get the character under the cursor and check if it's in 'matchpairs'. let c_lnum = a:lnum let c_col = a:col+1 + let line = getline(c_lnum) + if line[c_col-1] == '\' + let c_col = c_col + 1 + endif + let c = line[c_col-1] - let c = getline(c_lnum)[c_col-1] let plist = split(&matchpairs, '.\zs[:,]') let i = index(plist, c) if i < 0 diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index 16c7ce4d92..f659a87b71 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar -" Last Change: 2016 Nov 18 +" Last Change: 2017 Apr 30 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -311,44 +311,32 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") syn keyword cConstant PTRDIFF_MIN PTRDIFF_MAX SIG_ATOMIC_MIN SIG_ATOMIC_MAX syn keyword cConstant SIZE_MAX WCHAR_MIN WCHAR_MAX WINT_MIN WINT_MAX endif - syn keyword cConstant FLT_RADIX FLT_ROUNDS - syn keyword cConstant FLT_DIG FLT_MANT_DIG FLT_EPSILON - syn keyword cConstant DBL_DIG DBL_MANT_DIG DBL_EPSILON - syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON - syn keyword cConstant FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP - syn keyword cConstant FLT_MIN_10_EXP FLT_MAX_10_EXP - syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP - syn keyword cConstant DBL_MIN_10_EXP DBL_MAX_10_EXP - syn keyword cConstant LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP - syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP - syn keyword cConstant HUGE_VAL CLOCKS_PER_SEC NULL - syn keyword cConstant LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY - syn keyword cConstant LC_NUMERIC LC_TIME - syn keyword cConstant SIG_DFL SIG_ERR SIG_IGN - syn keyword cConstant SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM + syn keyword cConstant FLT_RADIX FLT_ROUNDS FLT_DIG FLT_MANT_DIG FLT_EPSILON DBL_DIG DBL_MANT_DIG DBL_EPSILON + syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP FLT_MIN_10_EXP FLT_MAX_10_EXP + syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP DBL_MIN_10_EXP DBL_MAX_10_EXP LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP + syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP HUGE_VAL CLOCKS_PER_SEC NULL LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY + syn keyword cConstant LC_NUMERIC LC_TIME SIG_DFL SIG_ERR SIG_IGN SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM " Add POSIX signals as well... - syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP - syn keyword cConstant SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV - syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU - syn keyword cConstant SIGUSR1 SIGUSR2 - syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF WEOF - syn keyword cConstant FOPEN_MAX FILENAME_MAX L_tmpnam - syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET - syn keyword cConstant TMP_MAX stderr stdin stdout - syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX + syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV + syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2 + syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF WEOF FOPEN_MAX FILENAME_MAX L_tmpnam + syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET TMP_MAX stderr stdin stdout EXIT_FAILURE EXIT_SUCCESS RAND_MAX " POSIX 2001 - syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG - syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ + syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG SIGVTALRM SIGXCPU SIGXFSZ " non-POSIX signals syn keyword cConstant SIGWINCH SIGINFO - " Add POSIX errors as well - syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY - syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT - syn keyword cConstant EFBIG EILSEQ EINPROGRESS EINTR EINVAL EIO EISDIR - syn keyword cConstant EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENFILE ENODEV - syn keyword cConstant ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS - syn keyword cConstant ENOTDIR ENOTEMPTY ENOTSUP ENOTTY ENXIO EPERM - syn keyword cConstant EPIPE ERANGE EROFS ESPIPE ESRCH ETIMEDOUT EXDEV + " Add POSIX errors as well. List comes from: + " http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html + syn keyword cConstant E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT EAGAIN EALREADY EBADF + syn keyword cConstant EBADMSG EBUSY ECANCELED ECHILD ECONNABORTED ECONNREFUSED ECONNRESET EDEADLK + syn keyword cConstant EDESTADDRREQ EDOM EDQUOT EEXIST EFAULT EFBIG EHOSTUNREACH EIDRM EILSEQ + syn keyword cConstant EINPROGRESS EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE + syn keyword cConstant EMULTIHOP ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS ENODATA + syn keyword cConstant ENODEV ENOENT ENOEXEC ENOLCK ENOLINK ENOMEM ENOMSG ENOPROTOOPT ENOSPC ENOSR + syn keyword cConstant ENOSTR ENOSYS ENOTCONN ENOTDIR ENOTEMPTY ENOTRECOVERABLE ENOTSOCK ENOTSUP + syn keyword cConstant ENOTTY ENXIO EOPNOTSUPP EOVERFLOW EOWNERDEAD EPERM EPIPE EPROTO + syn keyword cConstant EPROTONOSUPPORT EPROTOTYPE ERANGE EROFS ESPIPE ESRCH ESTALE ETIME ETIMEDOUT + syn keyword cConstant ETXTBSY EWOULDBLOCK EXDEV " math.h syn keyword cConstant M_E M_LOG2E M_LOG10E M_LN2 M_LN10 M_PI M_PI_2 M_PI_4 syn keyword cConstant M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2 diff --git a/runtime/syntax/sbt.vim b/runtime/syntax/sbt.vim new file mode 100644 index 0000000000..cbf73beafe --- /dev/null +++ b/runtime/syntax/sbt.vim @@ -0,0 +1,32 @@ +" Vim syntax file +" Language: sbt +" Maintainer: Steven Dobay +" Last Change: 2017.04.30 + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/scala.vim + +syn region sbtString start="\"[^"]" skip="\\\"" end="\"" contains=sbtStringEscape +syn match sbtStringEscape "\\u[0-9a-fA-F]\{4}" contained +syn match sbtStringEscape "\\[nrfvb\\\"]" contained + +syn match sbtIdentitifer "^\S\+\ze\s*\(:=\|++=\|+=\|<<=\|<+=\)" +syn match sbtBeginningSeq "^[Ss]eq\>" + +syn match sbtSpecial "\(:=\|++=\|+=\|<<=\|<+=\)" + +syn match sbtLineComment "//.*" +syn region sbtComment start="/\*" end="\*/" +syn region sbtDocComment start="/\*\*" end="\*/" keepend + +hi link sbtString String +hi link sbtIdentitifer Keyword +hi link sbtBeginningSeq Keyword +hi link sbtSpecial Special +hi link sbtComment Comment +hi link sbtLineComment Comment +hi link sbtDocComment Comment + From 599170de8304d74baa3e18df0929330e3773a14d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 01:29:14 +0100 Subject: [PATCH 07/11] vim-patch:6aa8cea46d41 Update runtime files. https://github.com/vim/vim/commit/6aa8cea46d4179b2617daae034063dd0d8054e35 --- runtime/doc/arabic.txt | 26 ++++++++-------- runtime/doc/autocmd.txt | 2 +- runtime/doc/eval.txt | 1 + runtime/doc/ft_ada.txt | 2 +- runtime/doc/help.txt | 2 +- runtime/doc/insert.txt | 12 +++---- runtime/doc/intro.txt | 4 +-- runtime/doc/map.txt | 2 +- runtime/doc/options.txt | 8 ++++- runtime/doc/print.txt | 64 +++++++++++++++++++------------------- runtime/doc/spell.txt | 4 +-- runtime/doc/syntax.txt | 9 +++--- runtime/doc/usr_09.txt | 4 +-- runtime/syntax/cpp.vim | 4 +-- runtime/syntax/haskell.vim | 4 +-- src/nvim/po/it.po | 51 ++++++++++++++++++++++++++++-- 16 files changed, 127 insertions(+), 72 deletions(-) diff --git a/runtime/doc/arabic.txt b/runtime/doc/arabic.txt index 3f30d7b5bc..07350083c6 100644 --- a/runtime/doc/arabic.txt +++ b/runtime/doc/arabic.txt @@ -36,7 +36,7 @@ the user interface remains the standard Vi interface. Highlights ---------- -o Editing left-to-right files as in the original VIM hasn't changed. +o Editing left-to-right files as in the original Vim hasn't changed. o Viewing and editing files in right-to-left windows. File orientation is per window, so it is possible to view the same @@ -46,7 +46,7 @@ o No special terminal with right-to-left capabilities is required. The right-to-left changes are completely hardware independent. Only Arabic fonts are necessary. -o Compatible with the original VIM. Almost all features work in +o Compatible with the original Vim. Almost all features work in right-to-left mode (there are liable to be bugs). o Changing keyboard mapping and reverse insert modes using a single @@ -60,14 +60,14 @@ o While in Arabic mode, numbers are entered from left to right. Upon o Arabic keymapping on the command line in reverse insert mode. -o Proper Bidirectional functionality is possible given VIM is +o Proper Bidirectional functionality is possible given Vim is started within a Bidi capable terminal emulator. Arabic Fonts *arabicfonts* ------------ -VIM requires monospaced fonts of which there are many out there. +Vim requires monospaced fonts of which there are many out there. Arabic requires ISO-8859-6 as well as Presentation Form-B fonts (without Form-B, Arabic will _NOT_ be usable). It is highly recommended that users search for so-called 'ISO-10646-1' fonts. @@ -90,13 +90,13 @@ o Installation of fonts for X Window systems (Unix/Linux) Usage ----- -Prior to the actual usage of Arabic within VIM, a number of settings +Prior to the actual usage of Arabic within Vim, a number of settings need to be accounted for and invoked. o Setting the Arabic fonts - + For VIM GUI set the 'guifont' to your_ARABIC_FONT. This is done - by entering the following command in the VIM window. + + For Vim GUI set the 'guifont' to your_ARABIC_FONT. This is done + by entering the following command in the Vim window. > :set guifont=your_ARABIC_FONT < @@ -109,7 +109,7 @@ o Setting the Arabic fonts you can include ':set guifont=your_ARABIC_FONT' to your vimrc file. - + Under the X Window environment, you can also start VIM with + + Under the X Window environment, you can also start Vim with '-fn your_ARABIC_FONT' option. o Setting the appropriate character Encoding @@ -131,11 +131,11 @@ o Setting the appropriate character Encoding o Enable Arabic settings [short-cut] In order to simplify and streamline things, you can either invoke - VIM with the command-line option, + Vim with the command-line option, % vim -A my_utf8_arabic_file ... - or enable 'arabic' via the following command within VIM + or enable 'arabic' via the following command within Vim > :set arabic < @@ -196,7 +196,7 @@ o Enable Arabic settings [short-cut] + Arabic deletion of a combined pair character - By default VIM has the 'delcombine' option disabled. This option + By default Vim has the 'delcombine' option disabled. This option allows the deletion of ALEF in a LAM_ALEF (LAA) combined character and still retain the LAM (i.e. it reverts to treating the combined character as its natural two characters form -- this also pertains @@ -255,7 +255,7 @@ o Enable Arabic settings [short-cut] Keymap/Keyboard *arabickeymap* --------------- -The character/letter encoding used in VIM is the standard UTF-8. +The character/letter encoding used in Vim is the standard UTF-8. It is widely discouraged that any other encoding be used or even attempted. @@ -288,7 +288,7 @@ o Keyboard Restrictions ------------ -o VIM in its GUI form does not currently support Bi-directionality +o Vim in its GUI form does not currently support Bi-directionality (i.e. the ability to see both Arabic and Latin intermixed within the same line). diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 709e7ffed6..dfcabf9e7d 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -605,7 +605,7 @@ FileChangedShell When Vim notices that the modification time of |timestamp| Mostly triggered after executing a shell command, but also with a |:checktime| command - or when Gvim regains input focus. + or when gvim regains input focus. This autocommand is triggered for each changed file. It is not used when 'autoread' is set and the buffer was not changed. If a diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 23612d1216..dc075b795f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3109,6 +3109,7 @@ did_filetype() Returns |TRUE| when autocommands are being executed and the FileType event has been triggered at least once. Can be used to avoid triggering the FileType event again in the scripts that detect the file type. |FileType| + Returns |FALSE| when `:setf FALLBACK` was used. When editing another file, the counter is reset, thus this really checks if the FileType event has been triggered for the current buffer. This allows an autocommand that starts diff --git a/runtime/doc/ft_ada.txt b/runtime/doc/ft_ada.txt index 94d97b481a..c1aa0904c4 100644 --- a/runtime/doc/ft_ada.txt +++ b/runtime/doc/ft_ada.txt @@ -116,7 +116,7 @@ NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic then "gnat xref -v *.ad?" 4) Project manager support is completely broken - don't even try "gnat xref -Padacl.gpr". -5) VIM is faster when the tags file is sorted - use "sort --unique +5) Vim is faster when the tags file is sorted - use "sort --unique --ignore-case --output=tags tags" . 6) Remember to insert "!_TAG_FILE_SORTED 2 %sort ui" as first line to mark the file assorted. diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 5e4c095130..d929bd75cd 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -30,7 +30,7 @@ Get specific help: It is possible to go directly to whatever you want help help entries for "word". Or use ":helpgrep word". |:helpgrep| -VIM stands for Vi IMproved. Most of VIM was made by Bram Moolenaar, but only +Vim stands for Vi IMproved. Most of Vim was made by Bram Moolenaar, but only through the help of many others. See |credits|. ------------------------------------------------------------------------------ *doc-file-list* *Q_ct* diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index f6b2ef7bc3..b6cc18ab1b 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -608,13 +608,13 @@ Completion can be done for: 10. User defined completion |i_CTRL-X_CTRL-U| 11. omni completion |i_CTRL-X_CTRL-O| 12. Spelling suggestions |i_CTRL-X_s| -13. keywords in 'complete' |i_CTRL-N| +13. keywords in 'complete' |i_CTRL-N| |i_CTRL-P| -All these (except 2) are done in CTRL-X mode. This is a sub-mode of Insert -and Replace modes. You enter CTRL-X mode by typing CTRL-X and one of the -CTRL-X commands. You exit CTRL-X mode by typing a key that is not a valid -CTRL-X mode command. Valid keys are the CTRL-X command itself, CTRL-N (next), -and CTRL-P (previous). +All these, except CTRL-N and CTRL-P, are done in CTRL-X mode. This is a +sub-mode of Insert and Replace modes. You enter CTRL-X mode by typing CTRL-X +and one of the CTRL-X commands. You exit CTRL-X mode by typing a key that is +not a valid CTRL-X mode command. Valid keys are the CTRL-X command itself, +CTRL-N (next), and CTRL-P (previous). Also see the 'infercase' option if you want to adjust the case of the match. diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index d71e73ceac..93cc8be41f 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -68,8 +68,8 @@ The Vim pages contain the most recent information about Vim. They also contain links to the most recent version of Vim. The FAQ is a list of Frequently Asked Questions. Read this if you have problems. - VIM home page: http://www.vim.org/ - VIM FAQ: http://vimdoc.sf.net/ + Vim home page: http://www.vim.org/ + Vim FAQ: http://vimdoc.sf.net/ Downloading: ftp://ftp.vim.org/pub/vim/MIRRORS diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index fa7d01aa5f..12170ca16a 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -175,7 +175,7 @@ that starts with ",". Then you need to type another character for Vim to know whether to use the "," mapping or the longer one. To avoid this add the argument. Then the mapping will be used when it matches, Vim does not wait for more characters to be typed. However, if the characters were -already type they are used. +already typed they are used. *:map-* *:map-silent* To define a mapping which will not be echoed on the command line, add diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 20526677e9..3479336a1a 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -311,7 +311,7 @@ Note: In the future more global options can be made global-local. Using Setting the filetype -:setf[iletype] {filetype} *:setf* *:setfiletype* +:setf[iletype] [FALLBACK] {filetype} *:setf* *:setfiletype* Set the 'filetype' option to {filetype}, but only if not done yet in a sequence of (nested) autocommands. This is short for: > @@ -322,6 +322,12 @@ Setting the filetype setting the 'filetype' option twice, causing different settings and syntax files to be loaded. + When the optional FALLBACK argument is present, a + later :setfiletype command will override the + 'filetype'. This is to used for filetype detections + that are just a guess. |did_filetype()| will return + false after this command. + *option-window* *optwin* :bro[wse] se[t] *:set-browse* *:browse-set* *:opt* *:options* :opt[ions] Open a window for viewing and setting all options. diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index 72625a450a..3ffb52b5ae 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -87,25 +87,25 @@ If the option is empty, then vim will use the system default printer for Macintosh: mac-roman, HPUX: hp-roman8) global -Sets the character encoding used when printing. This option tells VIM which +Sets the character encoding used when printing. This option tells Vim which print character encoding file from the "print" directory in 'runtimepath' to use. This option will accept any value from |encoding-names|. Any recognized names -are converted to VIM standard names - see 'encoding' for more details. Names -not recognized by VIM will just be converted to lower case and underscores +are converted to Vim standard names - see 'encoding' for more details. Names +not recognized by Vim will just be converted to lower case and underscores replaced with '-' signs. -If 'printencoding' is empty or VIM cannot find the file then it will use -'encoding' (if VIM is compiled with |+multi_byte| and it is set an 8-bit -encoding) to find the print character encoding file. If VIM is unable to find +If 'printencoding' is empty or Vim cannot find the file then it will use +'encoding' (if Vim is compiled with |+multi_byte| and it is set an 8-bit +encoding) to find the print character encoding file. If Vim is unable to find a character encoding file then it will use the "latin1" print character encoding file. -When 'encoding' is set to a multi-byte encoding, VIM will try to convert +When 'encoding' is set to a multi-byte encoding, Vim will try to convert characters to the printing encoding for printing (if 'printencoding' is empty then the conversion will be to latin1). Conversion to a printing encoding -other than latin1 will require VIM to be compiled with the |+iconv| feature. +other than latin1 will require Vim to be compiled with the |+iconv| feature. If no conversion is possible then printing will fail. Any characters that cannot be converted will be replaced with upside down question marks. @@ -186,7 +186,7 @@ header is used when this option is empty. 'printmbcharset' 'pmbcs' string (default "") global Sets the CJK character set to be used when generating CJK output from -|:hardcopy|. The following predefined values are currently recognised by VIM: +|:hardcopy|. The following predefined values are currently recognised by Vim: Value Description ~ Chinese GB_2312-80 @@ -253,7 +253,7 @@ Japanese text you would do the following; > If 'printmbcharset' is not one of the above values then it is assumed to specify a custom multi-byte character set and no check will be made that it is -compatible with the value for 'printencoding'. VIM will look for a file +compatible with the value for 'printencoding'. Vim will look for a file defining the character set in the "print" directory in 'runtimepath'. *pmbfn-option* @@ -403,10 +403,10 @@ There are currently a number of limitations with PostScript printing: possible to get all the characters in an encoding to print by installing a new version of the Courier font family. -- Multi-byte support - Currently VIM will try to convert multi-byte characters +- Multi-byte support - Currently Vim will try to convert multi-byte characters to the 8-bit encoding specified by 'printencoding' (or latin1 if it is empty). Any characters that are not successfully converted are shown as - unknown characters. Printing will fail if VIM cannot convert the multi-byte + unknown characters. Printing will fail if Vim cannot convert the multi-byte to the 8-bit encoding. ============================================================================== @@ -417,11 +417,11 @@ you need to define your own PostScript font encoding vector. Details on how to define a font encoding vector is beyond the scope of this help file, but you can find details in the PostScript Language Reference Manual, 3rd Edition, published by Addison-Wesley and available in PDF form at -http://www.adobe.com/. The following describes what you need to do for VIM to +http://www.adobe.com/. The following describes what you need to do for Vim to locate and use your print character encoding. i. Decide on a unique name for your encoding vector, one that does not clash - with any of the recognized or standard encoding names that VIM uses (see + with any of the recognized or standard encoding names that Vim uses (see |encoding-names| for a list), and that no one else is likely to use. ii. Copy $VIMRUNTIME/print/latin1.ps to the print subdirectory in your 'runtimepath' and rename it with your unique name. @@ -429,23 +429,23 @@ iii. Edit your renamed copy of latin1.ps, replacing all occurrences of latin1 with your unique name (don't forget the line starting %%Title:), and modify the array of glyph names to define your new encoding vector. The array must have exactly 256 entries or you will not be able to print! -iv. Within VIM, set 'printencoding' to your unique encoding name and then - print your file. VIM will now use your custom print character encoding. +iv. Within Vim, set 'printencoding' to your unique encoding name and then + print your file. Vim will now use your custom print character encoding. -VIM will report an error with the resource file if you change the order or +Vim will report an error with the resource file if you change the order or content of the first 3 lines, other than the name of the encoding on the line starting %%Title: or the version number on the line starting %%Version:. -[Technical explanation for those that know PostScript - VIM looks for a file +[Technical explanation for those that know PostScript - Vim looks for a file with the same name as the encoding it will use when printing. The file defines a new PostScript Encoding resource called /VIM-name, where name is the -print character encoding VIM will use.] +print character encoding Vim will use.] ============================================================================== 5. PostScript CJK Printing *postscript-cjk-printing* *E673* *E674* *E675* -VIM supports printing of Chinese, Japanese, and Korean files. Setting up VIM +Vim supports printing of Chinese, Japanese, and Korean files. Setting up Vim to correctly print CJK files requires setting up a few more options. Each of these countries has many standard character sets and encodings which @@ -466,7 +466,7 @@ option allows you to specify different fonts to use when printing characters which are syntax highlighted with the font styles normal, italic, bold and bold-italic. -No CJK fonts are supplied with VIM. There are some free Korean, Japanese, and +No CJK fonts are supplied with Vim. There are some free Korean, Japanese, and Traditional Chinese fonts available at: http://examples.oreilly.com/cjkvinfo/adobe/samples/ @@ -481,7 +481,7 @@ CJK fonts can be large containing several thousand glyphs, and it is not uncommon to find that they only contain a subset of a national standard. It is not unusual to find the fonts to not include characters for codes in the ASCII code range. If you find half-width Roman characters are not appearing -in your printout then you should configure VIM to use the Courier font the +in your printout then you should configure Vim to use the Courier font the half-width ASCII characters with 'printmbfont'. If your font does not include other characters then you will need to find another font that does. @@ -489,7 +489,7 @@ Another issue with ASCII characters, is that the various national character sets specify a couple of different glyphs in the ASCII code range. If you print ASCII text using the national character set you may see some unexpected characters. If you want true ASCII code printing then you need to configure -VIM to output ASCII characters for the ASCII code range with 'printmbfont'. +Vim to output ASCII characters for the ASCII code range with 'printmbfont'. It is possible to define your own multi-byte character set although this should not be attempted lightly. A discussion on the process if beyond the @@ -508,13 +508,13 @@ print job completing. There are a number of possible causes as to why the printing may have failed: - Wrong version of the prolog resource file. The prolog resource file - contains some PostScript that VIM needs to be able to print. Each version - of VIM needs one particular version. Make sure you have correctly installed + contains some PostScript that Vim needs to be able to print. Each version + of Vim needs one particular version. Make sure you have correctly installed the runtime files, and don't have any old versions of a file called prolog in the print directory in your 'runtimepath' directory. - Paper size. Some PostScript printers will abort printing a file if they do - not support the requested paper size. By default VIM uses A4 paper. Find + not support the requested paper size. By default Vim uses A4 paper. Find out what size paper your printer normally uses and set the appropriate paper size with 'printoptions'. If you cannot find the name of the paper used, measure a sheet and compare it with the table of supported paper sizes listed @@ -645,7 +645,7 @@ complex print document creation. N-UP PRINTING -The psnup utility takes an existing PostScript file generated from VIM and +The psnup utility takes an existing PostScript file generated from Vim and convert it to an n-up version. The simplest way to create a 2-up printout is to first create a PostScript file with: > @@ -701,16 +701,16 @@ There are a couple of points to bear in mind: ============================================================================== 8. Formfeed Characters *printing-formfeed* -By default VIM does not do any special processing of |formfeed| control -characters. Setting the 'printoptions' formfeed item will make VIM recognize +By default Vim does not do any special processing of |formfeed| control +characters. Setting the 'printoptions' formfeed item will make Vim recognize formfeed characters and continue printing the current line at the beginning of the first line on a new page. The use of formfeed characters provides rudimentary print control but there are certain things to be aware of. -VIM will always start printing a line (including a line number if enabled) +Vim will always start printing a line (including a line number if enabled) containing a formfeed character, even if it is the first character on the line. This means if a line starting with a formfeed character is the first -line of a page then VIM will print a blank page. +line of a page then Vim will print a blank page. Since the line number is printed at the start of printing the line containing the formfeed character, the remainder of the line printed on the new page @@ -719,7 +719,7 @@ lines of a long line when wrap in 'printoptions' is enabled). If the formfeed character is the last character on a line, then printing will continue on the second line of the new page, not the first. This is due to -VIM processing the end of the line after the formfeed character and moving +Vim processing the end of the line after the formfeed character and moving down a line to continue printing. Due to the points made above it is recommended that when formfeed character diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index f2be25097c..59575359ef 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -459,7 +459,7 @@ Vim uses a binary file format for spelling. This greatly speeds up loading the word list and keeps it small. *.aff* *.dic* *Myspell* You can create a Vim spell file from the .aff and .dic files that Myspell -uses. Myspell is used by OpenOffice.org and Mozilla. The OpenOffice .oxt +uses. Myspell is used by OpenOffice.org and Mozilla. The OpenOffice .oxt files are zip files which contain the .aff and .dic files. You should be able to find them here: http://extensions.services.openoffice.org/dictionary @@ -1594,7 +1594,7 @@ COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE* KEY (Hunspell) *spell-KEY* Define characters that are close together on the keyboard. Used to give better suggestions. Not supported. - + LANG (Hunspell) *spell-LANG* This specifies language-specific behavior. This actually moves part of the language knowledge into the program, diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 6cbee8c108..eb8cd1a58b 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4757,10 +4757,11 @@ ctermbg={color-nr} *highlight-ctermbg* Example: > :highlight Normal ctermfg=grey ctermbg=darkblue < When setting the "ctermbg" color for the Normal group, the - 'background' option will be adjusted automatically. This causes the - highlight groups that depend on 'background' to change! This means - you should set the colors for Normal first, before setting other - colors. + 'background' option will be adjusted automatically, under the + condition that the color is recognized and 'background' was not set + explicitly. This causes the highlight groups that depend on + 'background' to change! This means you should set the colors for + Normal first, before setting other colors. When a colorscheme is being used, changing 'background' causes it to be reloaded, which may reset all colors (including Normal). First delete the "g:colors_name" variable when you don't want this. diff --git a/runtime/doc/usr_09.txt b/runtime/doc/usr_09.txt index 1ff3d93329..bf3399e379 100644 --- a/runtime/doc/usr_09.txt +++ b/runtime/doc/usr_09.txt @@ -187,7 +187,7 @@ mouse button. The selected text will be inserted. The "current selection" will only remain valid until some other text is selected. After doing the paste in the other gVim, now select some characters in that window. You will notice that the words that were previously selected -in the other gVim window are displayed differently. This means that it no +in the other gvim window are displayed differently. This means that it no longer is the current selection. You don't need to select text with the mouse, using the keyboard commands for @@ -211,7 +211,7 @@ USING BOTH This use of both the "current selection" and the "real clipboard" might sound a bit confusing. But it is very useful. Let's show this with an example. -Use one gVim with a text file and perform these actions: +Use one gvim with a text file and perform these actions: - Select two words in Visual mode. - Use the Edit/Copy menu to get these words onto the clipboard. diff --git a/runtime/syntax/cpp.vim b/runtime/syntax/cpp.vim index 5a478fb77d..9cb0860e84 100644 --- a/runtime/syntax/cpp.vim +++ b/runtime/syntax/cpp.vim @@ -2,7 +2,7 @@ " Language: C++ " Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) " Previous Maintainer: Ken Shan -" Last Change: 2016 Oct 28 +" Last Change: 2017 Jun 05 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -48,7 +48,7 @@ endif if !exists("cpp_no_cpp14") syn case ignore syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>" - syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>" + syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>" contains=cFloat syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>" syn case match endif diff --git a/runtime/syntax/haskell.vim b/runtime/syntax/haskell.vim index 11f4c35a58..e398085ba8 100644 --- a/runtime/syntax/haskell.vim +++ b/runtime/syntax/haskell.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Haskell " Maintainer: Haskell Cafe mailinglist -" Last Change: 2008 Dec 15 +" Last Change: 2017 Jun 04 " Original Author: John Williams " " Thanks to Ryan Crumley for suggestions and John Meacham for @@ -62,7 +62,7 @@ syn match hsCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=hsSpecialChar,hs syn match hsNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>" syn match hsFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>" -" Keyword definitions. These must be patters instead of keywords +" Keyword definitions. These must be patterns instead of keywords " because otherwise they would match as keywords at the start of a " "literate" comment (see lhs.vim). syn match hsModule "\" diff --git a/src/nvim/po/it.po b/src/nvim/po/it.po index b8b119ade6..91b7b715f8 100644 --- a/src/nvim/po/it.po +++ b/src/nvim/po/it.po @@ -1402,6 +1402,31 @@ msgstr "com: %s" msgid "frame is zero" msgstr "al livello zero" +msgid "E901: gethostbyname() in channel_open()" +msgstr "E901: gethostbyname() in channel_open()" + +msgid "E898: socket() in channel_open()" +msgstr "E898: socket() in channel_open()" + +msgid "E903: received command with non-string argument" +msgstr "E903: il comando ricevuto non aveva come argomento una stringa" + +msgid "E904: last argument for expr/call must be a number" +msgstr "E904: l'ultimo argomento per espressione/chiamata dev'essere numerico" + +msgid "E904: third argument for call must be a list" +msgstr "E904: il terzo argomento della chiamata dev'essere una Lista" + +msgid "E905: received unknown command: %s" +msgstr "E905: recevuto comando non conosciuto: %s" + +#, c-format +msgid "E630: %s(): write while not connected" +msgstr "E630: %s(): scrittura in mancanza di connessione" + +msgid "E631: %s(): write failed" +msgstr "E631: %s(): scrittura non riuscita" + #, c-format msgid "frame at highest level: %d" msgstr "al livello pi alto: %d" @@ -4812,10 +4837,16 @@ msgstr "" "\n" "Non posso impostare il contesto di sicurezza per " +msgid "E151: No match: %s" +msgstr "E151: Nessuna corrispondenza: %s" + #, c-format msgid "Could not set security context %s for %s" msgstr "Non posso impostare il contesto di sicurezza %s per %s" +msgid "E934: Cannot jump to a buffer that does not have a name" +msgstr "E934: Impossibile passare a un buffer che non ha un nome" + #, c-format msgid "Could not get security context %s for %s. Removing it!" msgstr "Non posso ottenere il contesto di sicurezza %s per %s. Lo rimuovo!" @@ -5353,8 +5384,24 @@ msgstr "E770: Sezione non supportata nel file ortografico" #: ../spell.c:3762 #, c-format -msgid "Warning: region %s not supported" -msgstr "Avviso: regione %s non supportata" +msgid "E778: This does not look like a .sug file: %s" +msgstr "E778: Questo non sembra un file .sug: %s" + +#, c-format +msgid "E779: Old .sug file, needs to be updated: %s" +msgstr "E779: File .sug obsoleto, necessario aggiornarlo: %s" + +#, c-format +msgid "E780: .sug file is for newer version of Vim: %s" +msgstr "E780: Il file .sug per versioni di Vim pi recenti: %s" + +#, c-format +msgid "E781: .sug file doesn't match .spl file: %s" +msgstr "E781: Il file .sug non corrisponde al file .spl: %s" + +#, c-format +msgid "E782: error while reading .sug file: %s" +msgstr "E782: Errore leggendo il file .sug: %s" #: ../spell.c:4550 #, c-format From a39bf019580d82f8ca5f9e8d99dd856418ffc491 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 01:34:28 +0100 Subject: [PATCH 08/11] vim-patch:3ec574f2b549 Update runtime files. Includes changing &sw to shiftwidth() for all indent scripts. https://github.com/vim/vim/commit/3ec574f2b549f456f664f689d6da36dc5719aeb9 --- runtime/doc/eval.txt | 5 ++- runtime/doc/pattern.txt | 8 +++-- runtime/filetype.vim | 4 ++- runtime/indent/ada.vim | 22 ++++++------ runtime/indent/awk.vim | 6 ++-- runtime/indent/bst.vim | 4 +-- runtime/indent/bzl.vim | 9 ++--- runtime/indent/cdl.vim | 18 +++++----- runtime/indent/chaiscript.vim | 6 ++-- runtime/indent/clojure.vim | 8 ++--- runtime/indent/cmake.vim | 8 ++--- runtime/indent/cobol.vim | 24 +++++++------- runtime/indent/cucumber.vim | 4 +-- runtime/indent/dylan.vim | 12 +++---- runtime/indent/erlang.vim | 32 +++++++++--------- runtime/indent/eruby.vim | 6 +--- runtime/indent/falcon.vim | 16 ++++----- runtime/indent/gitconfig.vim | 4 +-- runtime/indent/gitolite.vim | 8 ++--- runtime/indent/go.vim | 22 +++--------- runtime/indent/haml.vim | 4 +-- runtime/indent/hamster.vim | 4 +-- runtime/indent/hog.vim | 6 ++-- runtime/indent/html.vim | 57 ++++++++++++++------------------ runtime/indent/idlang.vim | 14 ++++---- runtime/indent/ishd.vim | 8 ++--- runtime/indent/javascript.vim | 7 ++-- runtime/indent/json.vim | 6 ++-- runtime/indent/liquid.vim | 4 +-- runtime/indent/logtalk.vim | 12 +++---- runtime/indent/lua.vim | 6 ++-- runtime/indent/matlab.vim | 8 ++--- runtime/indent/mma.vim | 2 +- runtime/indent/ocaml.vim | 12 +++---- runtime/indent/occam.vim | 6 ++-- runtime/indent/pascal.vim | 28 ++++++++-------- runtime/indent/perl.vim | 16 ++++----- runtime/indent/perl6.vim | 10 +++--- runtime/indent/php.vim | 36 ++++++++------------ runtime/indent/postscr.vim | 6 ++-- runtime/indent/pov.vim | 6 ++-- runtime/indent/prolog.vim | 8 ++--- runtime/indent/rpl.vim | 8 ++--- runtime/indent/ruby.vim | 6 +--- runtime/indent/rust.vim | 4 +-- runtime/indent/sass.vim | 4 +-- runtime/indent/sdl.vim | 6 ++-- runtime/indent/sml.vim | 14 ++++---- runtime/indent/sqlanywhere.vim | 24 +++++++------- runtime/indent/systemverilog.vim | 2 +- runtime/indent/teraterm.vim | 18 +++------- runtime/indent/tex.vim | 24 +++++++------- runtime/indent/tilde.vim | 4 +-- runtime/indent/vb.vim | 10 +++--- runtime/indent/vhdl.vim | 36 ++++++++++---------- runtime/indent/xml.vim | 4 +-- runtime/indent/yaml.vim | 14 ++------ runtime/syntax/debchangelog.vim | 12 +++---- runtime/syntax/debsources.vim | 10 +++--- runtime/syntax/help.vim | 6 ++-- runtime/syntax/php.vim | 4 +-- src/nvim/po/it.po | 2 +- 62 files changed, 328 insertions(+), 376 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index dc075b795f..8ef26d28c5 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5157,7 +5157,10 @@ line({expr}) The result is a Number, which is the line number of the file < *last-position-jump* This autocommand jumps to the last known position in a file just after opening it, if the '" mark is set: > - :au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + :au BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit' + \ | exe "normal! g`\"" + \ | endif line2byte({lnum}) *line2byte()* Return the byte count from the start of the buffer for line diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index b7025c8e7e..ab78b8b71c 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1058,12 +1058,16 @@ x A single character, with no special meaning, matches itself ":s/[/x/" searches for "[/x" and replaces it with nothing. It does not search for "[" and replaces it with "x"! + *E944* *E945* If the sequence begins with "^", it matches any single character NOT in the collection: "[^xyz]" matches anything but 'x', 'y' and 'z'. - If two characters in the sequence are separated by '-', this is shorthand for the full list of ASCII characters between them. E.g., - "[0-9]" matches any decimal digit. Non-ASCII characters can be - used, but the character values must not be more than 256 apart. + "[0-9]" matches any decimal digit. If the starting character exceeds + the ending character, e.g. [c-a], E944 occurs. Non-ASCII characters + can be used, but the character values must not be more than 256 apart + in the old regexp engine. For example, searching by [\u3000-\u4000] + after setting re=1 emits a E945 error. Prepending \%#=2 will fix it. - A character class expression is evaluated to the set of characters belonging to that character class. The following character classes are supported: diff --git a/runtime/filetype.vim b/runtime/filetype.vim index a6ecdd401a..4babd636a2 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2017 May 27 +" Last Change: 2017 Jun 12 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -2229,6 +2229,8 @@ func! s:FTtex() let format = tolower(matchstr(firstline, '\a\+')) let format = substitute(format, 'pdf', '', '') if format == 'tex' + let format = 'latex' + elseif format == 'plaintex' let format = 'plain' endif else diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim index 575f326454..1ca7fbacbe 100644 --- a/runtime/indent/ada.vim +++ b/runtime/indent/ada.vim @@ -87,7 +87,7 @@ function s:MainBlockIndent (prev_indent, prev_lnum, blockstart, stop_at) endwhile endwhile " Fallback - just move back one - return a:prev_indent - &sw + return a:prev_indent - shiftwidth() endfunction MainBlockIndent " Section: s:EndBlockIndent {{{1 @@ -131,7 +131,7 @@ function s:EndBlockIndent( prev_indent, prev_lnum, blockstart, blockend ) endwhile endwhile " Fallback - just move back one - return a:prev_indent - &sw + return a:prev_indent - shiftwidth() endfunction EndBlockIndent " Section: s:StatementIndent {{{1 @@ -213,15 +213,15 @@ function GetAdaIndent() endif " Move indent in if ! false_match - let ind = ind + &sw + let ind = ind + shiftwidth() endif elseif line =~ '^\s*\(case\|exception\)\>' " Move indent in twice (next 'when' will move back) - let ind = ind + 2 * &sw + let ind = ind + 2 * shiftwidth() elseif line =~ '^\s*end\s*record\>' - " Move indent back to tallying 'type' preceding the 'record'. + " Move indent back to tallying 'type' preceeding the 'record'. " Allow indent to be equal to 'end record's. - let ind = s:MainBlockIndent( ind+&sw, lnum, 'type\>', '' ) + let ind = s:MainBlockIndent( ind+shiftwidth(), lnum, 'type\>', '' ) elseif line =~ '\(^\s*new\>.*\)\@' " Multiple line generic instantiation ('package blah is\nnew thingy') - let ind = s:StatementIndent( ind - &sw, lnum ) + let ind = s:StatementIndent( ind - shiftwidth(), lnum ) elseif line =~ ';\s*$' " Statement end (but not 'end' ) - try to find current statement-start indent let ind = s:StatementIndent( ind, lnum ) @@ -256,17 +256,17 @@ function GetAdaIndent() elseif continuation && line =~ '^\s*(' " Don't do this if we've already indented due to the previous line if ind == initind - let ind = ind + &sw + let ind = ind + shiftwidth() endif elseif line =~ '^\s*\(begin\|is\)\>' let ind = s:MainBlockIndent( ind, lnum, '\(procedure\|function\|declare\|package\|task\)\>', 'begin\>' ) elseif line =~ '^\s*record\>' - let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\', '' ) + &sw + let ind = s:MainBlockIndent( ind, lnum, 'type\>\|for\>.*\', '' ) + shiftwidth() elseif line =~ '^\s*\(else\|elsif\)\>' let ind = s:MainBlockIndent( ind, lnum, 'if\>', '' ) elseif line =~ '^\s*when\>' " Align 'when' one /in/ from matching block start - let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + &sw + let ind = s:MainBlockIndent( ind, lnum, '\(case\|exception\)\>', '' ) + shiftwidth() elseif line =~ '^\s*end\>\s*\' " End of if statements let ind = s:EndBlockIndent( ind, lnum, 'if\>', 'end\>\s*\' ) diff --git a/runtime/indent/awk.vim b/runtime/indent/awk.vim index 6f6b70cc4e..aad73ee71f 100644 --- a/runtime/indent/awk.vim +++ b/runtime/indent/awk.vim @@ -60,7 +60,7 @@ function! GetAwkIndent() " 'pattern { action }' (simple check match on /{/ increases the indent then) if s:Get_brace_balance( prev_data, '{', '}' ) > 0 - return ind + &sw + return ind + shiftwidth() endif let brace_balance = s:Get_brace_balance( prev_data, '(', ')' ) @@ -99,7 +99,7 @@ function! GetAwkIndent() return s:Safe_indent( ind, s:First_word_len(prev_data), getline(v:lnum)) else " if/for/while without '{' - return ind + &sw + return ind + shiftwidth() endif endif endif @@ -140,7 +140,7 @@ function! GetAwkIndent() " Decrease indent if this line contains a '}'. if getline(v:lnum) =~ '^\s*}' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/bst.vim b/runtime/indent/bst.vim index be1f63e8e9..47e3058810 100644 --- a/runtime/indent/bst.vim +++ b/runtime/indent/bst.vim @@ -69,7 +69,7 @@ function! GetBstIndent(lnum) abort endif let fakeline = substitute(line,'^}','','').matchstr(cline,'^}') let ind = indent(lnum) - let ind = ind + &sw * s:count(line,'{') - let ind = ind - &sw * s:count(fakeline,'}') + let ind = ind + shiftwidth() * s:count(line,'{') + let ind = ind - shiftwidth() * s:count(fakeline,'}') return ind endfunction diff --git a/runtime/indent/bzl.vim b/runtime/indent/bzl.vim index 24e5b870cd..6904bfdedb 100644 --- a/runtime/indent/bzl.vim +++ b/runtime/indent/bzl.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Bazel (http://bazel.io) " Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) -" Last Change: 2015 Aug 11 +" Last Change: 2017 Jun 13 if exists('b:did_indent') finish @@ -41,11 +41,8 @@ function GetBzlIndent(lnum) abort if exists('g:pyindent_open_paren') let l:pyindent_open_paren = g:pyindent_open_paren endif - " Vim 7.3.693 and later defines a shiftwidth() function to get the effective - " shiftwidth value. Fall back to &shiftwidth if the function doesn't exist. - let l:sw_expr = exists('*shiftwidth') ? 'shiftwidth()' : '&shiftwidth' - let g:pyindent_nested_paren = l:sw_expr . ' * 2' - let g:pyindent_open_paren = l:sw_expr . ' * 2' + let g:pyindent_nested_paren = 'shiftwidth() * 2' + let g:pyindent_open_paren = 'shiftwidth() * 2' endif let l:indent = -1 diff --git a/runtime/indent/cdl.vim b/runtime/indent/cdl.vim index 5ec2a7b21a..5fae7b9046 100644 --- a/runtime/indent/cdl.vim +++ b/runtime/indent/cdl.vim @@ -47,7 +47,7 @@ fun! CdlGetIndent(lnum) let thisline = getline(a:lnum) if match(thisline, '^\s*\(\k\+\|\[[^]]*]\)\s*\(,\|;\s*$\)') >= 0 " it's an attributes line - return &sw + return shiftwidth() elseif match(thisline, '^\c\s*\([{}]\|\/[*/]\|dimension\|schedule\|group\|hierarchy\|class\)') >= 0 " it's a header or '{' or '}' or a comment return 0 @@ -71,13 +71,13 @@ fun! CdlGetIndent(lnum) let c = line[inicio-1] " ')' and '=' don't change indent and are useless to set 'f' if c == '{' - return &sw + return shiftwidth() elseif c != ')' && c != '=' let f = 1 " all but 'elseif' are followed by a formula if c ==? 'n' || c ==? 'e' " 'then', 'else' - let ind = ind + &sw + let ind = ind + shiftwidth() elseif strpart(line, inicio-6, 6) ==? 'elseif' " elseif, set f to conditional - let ind = ind + &sw + let ind = ind + shiftwidth() let f = 0 end end @@ -98,16 +98,16 @@ fun! CdlGetIndent(lnum) let ind = 0 let f = 1 elseif c == ')' || c== ';' || strpart(line, inicio-5, 5) ==? 'endif' - let ind = ind - &sw + let ind = ind - shiftwidth() elseif c == '(' || c ==? 'f' " '(' or 'if' - let ind = ind + &sw + let ind = ind + shiftwidth() else " c == '=' " if it is an asignment increase indent if f == -1 " we don't know yet, find out let f = CdlAsignment(lnum, strpart(line, 0, inicio)) end if f == 1 " formula increase it - let ind = ind + &sw + let ind = ind + shiftwidth() end end endw @@ -115,13 +115,13 @@ fun! CdlGetIndent(lnum) " CURRENT LINE, if it starts with a closing element, decrease indent " or if it starts with '=' (asignment), increase indent if match(thisline, '^\c\s*\(else\|then\|endif\|[);]\)') >= 0 - let ind = ind - &sw + let ind = ind - shiftwidth() elseif match(thisline, '^\s*=') >= 0 if f == -1 " we don't know yet if is an asignment, find out let f = CdlAsignment(lnum, "") end if f == 1 " formula increase it - let ind = ind + &sw + let ind = ind + shiftwidth() end end diff --git a/runtime/indent/chaiscript.vim b/runtime/indent/chaiscript.vim index 247e1a6e4c..445281cc46 100644 --- a/runtime/indent/chaiscript.vim +++ b/runtime/indent/chaiscript.vim @@ -31,19 +31,19 @@ function! GetChaiScriptIndent() let flag = 0 let prevline = getline(lnum) if prevline =~ '^.*{.*' - let ind = ind + &shiftwidth + let ind = ind + shiftwidth() let flag = 1 endif " Subtract a 'shiftwidth' after lines containing a { followed by a } " to keep it balanced if flag == 1 && prevline =~ '.*{.*}.*' - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() endif " Subtract a 'shiftwidth' on lines ending with } if getline(v:lnum) =~ '^\s*\%(}\)' - let ind = ind - &shiftwidth + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/clojure.vim b/runtime/indent/clojure.vim index 7592b10d7d..7c4186e29b 100644 --- a/runtime/indent/clojure.vim +++ b/runtime/indent/clojure.vim @@ -261,7 +261,7 @@ if exists("*searchpairpos") call cursor(paren) if s:is_method_special_case(paren) - return [paren[0], paren[1] + &shiftwidth - 1] + return [paren[0], paren[1] + shiftwidth() - 1] endif if s:is_reader_conditional_special_case(paren) @@ -299,19 +299,19 @@ if exists("*searchpairpos") let ww = s:strip_namespace_and_macro_chars(w) if &lispwords =~# '\V\<' . ww . '\>' - return [paren[0], paren[1] + &shiftwidth - 1] + return [paren[0], paren[1] + shiftwidth() - 1] endif if g:clojure_fuzzy_indent \ && !s:match_one(g:clojure_fuzzy_indent_blacklist, ww) \ && s:match_one(g:clojure_fuzzy_indent_patterns, ww) - return [paren[0], paren[1] + &shiftwidth - 1] + return [paren[0], paren[1] + shiftwidth() - 1] endif call search('\v\_s', 'cW') call search('\v\S', 'W') if paren[0] < line(".") - return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : &shiftwidth - 1)] + return [paren[0], paren[1] + (g:clojure_align_subforms ? 0 : shiftwidth() - 1)] endif call search('\v\S', 'bW') diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim index 421afcb6d7..93a131b938 100644 --- a/runtime/indent/cmake.vim +++ b/runtime/indent/cmake.vim @@ -68,19 +68,19 @@ fun! CMakeGetIndent(lnum) let ind = ind else if previous_line =~? cmake_indent_begin_regex - let ind = ind + &sw + let ind = ind + shiftwidth() endif if previous_line =~? cmake_indent_open_regex - let ind = ind + &sw + let ind = ind + shiftwidth() endif endif " Subtract if this_line =~? cmake_indent_end_regex - let ind = ind - &sw + let ind = ind - shiftwidth() endif if previous_line =~? cmake_indent_close_regex - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/cobol.vim b/runtime/indent/cobol.vim index 8dce3cd014..c08444ac40 100644 --- a/runtime/indent/cobol.vim +++ b/runtime/indent/cobol.vim @@ -52,11 +52,11 @@ function! s:optionalblock(lnum,ind,blocks,clauses) if getline(lastclause) =~? clauses && s:stripped(lastclause) !~? '^'.begin let ind = indent(lastclause) elseif lastclause > 0 - let ind = indent(lastclause) + &sw - "let ind = ind + &sw + let ind = indent(lastclause) + shiftwidth() + "let ind = ind + shiftwidth() endif elseif line =~? clauses && cline !~? end - let ind = ind + &sw + let ind = ind + shiftwidth() endif return ind endfunction @@ -98,8 +98,8 @@ function! GetCobolIndent(lnum) abort let num = matchstr(line,'^\s*\zs\d\+\>') if 0+cnum == num return lindent - elseif 0+cnum > num && default < lindent + &sw - let default = lindent + &sw + elseif 0+cnum > num && default < lindent + shiftwidth() + let default = lindent + shiftwidth() endif elseif lindent < bshft && lindent >= ashft break @@ -135,13 +135,13 @@ function! GetCobolIndent(lnum) abort if line =~? '^PERFORM\>' let perfline = substitute(line, '\c^PERFORM\s*', "", "") if perfline =~? '^\%(\k\+\s\+TIMES\)\=\s*$' - let ind = ind + &sw + let ind = ind + shiftwidth() elseif perfline =~? '^\%(WITH\s\+TEST\|VARYING\|UNTIL\)\>.*[^.]$' - let ind = ind + &sw + let ind = ind + shiftwidth() endif endif if line =~? '^\%(IF\|THEN\|ELSE\|READ\|EVALUATE\|SEARCH\|SELECT\)\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif let ind = s:optionalblock(a:lnum,ind,'ADD\|COMPUTE\|DIVIDE\|MULTIPLY\|SUBTRACT','ON\s\+SIZE\s\+ERROR') let ind = s:optionalblock(a:lnum,ind,'STRING\|UNSTRING\|ACCEPT\|DISPLAY\|CALL','ON\s\+OVERFLOW\|ON\s\+EXCEPTION') @@ -157,10 +157,10 @@ function! GetCobolIndent(lnum) abort "&& s:stripped(lastclause) !~? '^\%(SEARCH\|EVALUATE\|READ\)\>' let ind = indent(lastclause) elseif lastclause > 0 - let ind = indent(lastclause) + &sw + let ind = indent(lastclause) + shiftwidth() endif elseif line =~? '^WHEN\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif "I'm not sure why I had this "if line =~? '^ELSE\>-\@!' && line !~? '\.$' @@ -168,7 +168,7 @@ function! GetCobolIndent(lnum) abort "endif if cline =~? '^\(END\)\>-\@!' " On lines with just END, 'guess' a simple shift left - let ind = ind - &sw + let ind = ind - shiftwidth() elseif cline =~? '^\(END-IF\|THEN\|ELSE\)\>-\@!' call cursor(a:lnum,indent(a:lnum)) let match = searchpair('\c-\@','\c-\@','\c-\@\zs','bnW',s:skip) @@ -209,7 +209,7 @@ function! GetCobolIndent(lnum) abort if match > 0 let ind = indent(match) elseif cline =~? '^\(END-\(READ\|EVALUATE\|SEARCH\|PERFORM\)\)\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif endif return ind < bshft ? bshft : ind diff --git a/runtime/indent/cucumber.vim b/runtime/indent/cucumber.vim index 999b8d6a76..ad28a67a0d 100644 --- a/runtime/indent/cucumber.vim +++ b/runtime/indent/cucumber.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Cucumber " Maintainer: Tim Pope -" Last Change: 2016 Aug 29 +" Last Change: 2017 Jun 13 if exists("b:did_indent") finish @@ -27,7 +27,7 @@ function! GetCucumberIndent() let line = getline(prevnonblank(v:lnum-1)) let cline = getline(v:lnum) let nline = getline(nextnonblank(v:lnum+1)) - let sw = exists('*shiftwidth') ? shiftwidth() : &sw + let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth() let syn = s:syn(prevnonblank(v:lnum-1)) let csyn = s:syn(v:lnum) let nsyn = s:syn(nextnonblank(v:lnum+1)) diff --git a/runtime/indent/dylan.vim b/runtime/indent/dylan.vim index 0afcbeada7..6811ec4af5 100644 --- a/runtime/indent/dylan.vim +++ b/runtime/indent/dylan.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Dylan " Version: 0.01 -" Last Change: 2003 Feb 04 +" Last Change: 2017 Jun 13 " Maintainer: Brent A. Fulgham " Only load this indent file when no other was loaded. @@ -45,13 +45,13 @@ function DylanGetIndent() " If previous line was a 'define', indent if prevline =~? '\(^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)\|\s*\S*\s*=>$\)' - let chg = &sw + let chg = shiftwidth() " local methods indent the shift-width, plus 6 for the 'local' elseif prevline =~? '^\s*local' - let chg = &sw + 6 + let chg = shiftwidth() + 6 " If previous line was a let with no closing semicolon, indent elseif prevline =~? '^\s*let.*[^;]\s*$' - let chg = &sw + let chg = shiftwidth() " If previous line opened a parenthesis, and did not close it, indent elseif prevline =~ '^.*(\s*[^)]*\((.*)\)*[^)]*$' return = match( prevline, '(.*\((.*)\|[^)]\)*.*$') + 1 @@ -75,13 +75,13 @@ function DylanGetIndent() " line doesn't start with an indentable command: let curr_str = getline(curr_line) if curr_str =~? '^\s*\(begin\|block\|case\|define\|else\|elseif\|for\|finally\|if\|select\|unless\|while\)' - let chg = &sw + let chg = shiftwidth() endif endif " If a line starts with end, un-indent (even if we just indented!) if cline =~? '^\s*\(cleanup\|end\|else\|elseif\|exception\|finally\|otherwise\)' - let chg = chg - &sw + let chg = chg - shiftwidth() endif return ind + chg diff --git a/runtime/indent/erlang.vim b/runtime/indent/erlang.vim index 7569fe9106..9228f18683 100644 --- a/runtime/indent/erlang.vim +++ b/runtime/indent/erlang.vim @@ -669,7 +669,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol) call s:Pop(a:stack) if empty(a:stack) call s:Log(' Stack is ["when"], so LTI is in a guard -> return') - return [1, a:stored_vcol + &sw + 2] + return [1, a:stored_vcol + shiftwidth() + 2] else return [1, s:UnexpectedToken(a:token, a:stack)] endif @@ -678,7 +678,7 @@ function! s:BeginningOfClauseFound(stack, token, stored_vcol) call s:Pop(a:stack) if empty(a:stack) call s:Log(' Stack is ["->"], so LTI is in function body -> return') - return [1, a:stored_vcol + &sw] + return [1, a:stored_vcol + shiftwidth()] elseif a:stack[0] ==# ';' call s:Pop(a:stack) if empty(a:stack) @@ -797,7 +797,7 @@ function! s:ErlangCalcIndent2(lnum, stack) elseif token ==# 'begin' let [ret, res] = s:BeginElementFound(stack, token, curr_vcol, - \stored_vcol, 'end', &sw) + \stored_vcol, 'end', shiftwidth()) if ret | return res | endif " case EXPR of BRANCHES end @@ -848,11 +848,11 @@ function! s:ErlangCalcIndent2(lnum, stack) elseif stack == ['->'] call s:Log(' LTI is in a branch after ' . \'"of/receive/after/if/catch" -> return') - return stored_vcol + &sw + return stored_vcol + shiftwidth() elseif stack == ['when'] call s:Log(' LTI is in a guard after ' . \'"of/receive/after/if/catch" -> return') - return stored_vcol + &sw + return stored_vcol + shiftwidth() else return s:UnexpectedToken(token, stack) endif @@ -888,7 +888,7 @@ function! s:ErlangCalcIndent2(lnum, stack) if empty(stack) call s:Log(' LTI is in a condition; matching ' . \'"case/if/try/receive" found') - let stored_vcol = curr_vcol + &sw + let stored_vcol = curr_vcol + shiftwidth() elseif stack[0] ==# 'align_to_begin_element' call s:Pop(stack) let stored_vcol = curr_vcol @@ -897,23 +897,23 @@ function! s:ErlangCalcIndent2(lnum, stack) \'"case/if/try/receive" found') call s:Pop(stack) call s:Pop(stack) - let stored_vcol = curr_vcol + &sw + let stored_vcol = curr_vcol + shiftwidth() elseif stack[0] ==# '->' call s:Log(' LTI is in a branch; matching ' . \'"case/if/try/receive" found') call s:Pop(stack) - let stored_vcol = curr_vcol + 2 * &sw + let stored_vcol = curr_vcol + 2 * shiftwidth() elseif stack[0] ==# 'when' call s:Log(' LTI is in a guard; matching ' . \'"case/if/try/receive" found') call s:Pop(stack) - let stored_vcol = curr_vcol + 2 * &sw + 2 + let stored_vcol = curr_vcol + 2 * shiftwidth() + 2 endif endif let [ret, res] = s:BeginElementFound(stack, token, curr_vcol, - \stored_vcol, 'end', &sw) + \stored_vcol, 'end', shiftwidth()) if ret | return res | endif elseif token ==# 'fun' @@ -930,7 +930,7 @@ function! s:ErlangCalcIndent2(lnum, stack) " stack = ['when'] => LTI is in a guard if empty(stack) call s:Log(' LTI is in a condition; matching "fun" found') - let stored_vcol = curr_vcol + &sw + let stored_vcol = curr_vcol + shiftwidth() elseif len(stack) > 1 && stack[0] ==# '->' && stack[1] ==# ';' call s:Log(' LTI is in a condition; matching "fun" found') call s:Pop(stack) @@ -938,15 +938,15 @@ function! s:ErlangCalcIndent2(lnum, stack) elseif stack[0] ==# '->' call s:Log(' LTI is in a branch; matching "fun" found') call s:Pop(stack) - let stored_vcol = curr_vcol + 2 * &sw + let stored_vcol = curr_vcol + 2 * shiftwidth() elseif stack[0] ==# 'when' call s:Log(' LTI is in a guard; matching "fun" found') call s:Pop(stack) - let stored_vcol = curr_vcol + 2 * &sw + 2 + let stored_vcol = curr_vcol + 2 * shiftwidth() + 2 endif let [ret, res] = s:BeginElementFound(stack, token, curr_vcol, - \stored_vcol, 'end', &sw) + \stored_vcol, 'end', shiftwidth()) if ret | return res | endif else " Pass: we have a function reference (e.g. "fun f/0") @@ -1220,7 +1220,7 @@ function! s:ErlangCalcIndent2(lnum, stack) " when A, " LTI let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol, - \stored_vcol, &sw) + \stored_vcol, shiftwidth()) if ret | return res | endif else " Example: @@ -1252,7 +1252,7 @@ function! s:ErlangCalcIndent2(lnum, stack) " If LTI is between an 'after' and the corresponding " 'end', then let's return let [ret, res] = s:BeginElementFoundIfEmpty(stack, token, curr_vcol, - \stored_vcol, &sw) + \stored_vcol, shiftwidth()) if ret | return res | endif endif diff --git a/runtime/indent/eruby.vim b/runtime/indent/eruby.vim index afabd4fe5b..5058325495 100644 --- a/runtime/indent/eruby.vim +++ b/runtime/indent/eruby.vim @@ -47,11 +47,7 @@ set cpo&vim function! GetErubyIndent(...) " The value of a single shift-width - if exists('*shiftwidth') - let sw = shiftwidth() - else - let sw = &sw - endif + let sw = shiftwidth() if a:0 && a:1 == '.' let v:lnum = line('.') diff --git a/runtime/indent/falcon.vim b/runtime/indent/falcon.vim index 84b16d55f0..b34e7cfd47 100644 --- a/runtime/indent/falcon.vim +++ b/runtime/indent/falcon.vim @@ -339,7 +339,7 @@ function FalconGetIndent(...) " If the previous line ended with a block opening, add a level of indent. if s:Match(lnum, s:block_regex) - return indent(s:GetMSL(lnum)) + &sw + return indent(s:GetMSL(lnum)) + shiftwidth() endif " If it contained hanging closing brackets, find the rightmost one, find its @@ -350,20 +350,20 @@ function FalconGetIndent(...) if opening.pos != -1 if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 if col('.') + 1 == col('$') - return ind + &sw + return ind + shiftwidth() else return virtcol('.') endif else let nonspace = matchend(line, '\S', opening.pos + 1) - 1 - return nonspace > 0 ? nonspace : ind + &sw + return nonspace > 0 ? nonspace : ind + shiftwidth() endif elseif closing.pos != -1 call cursor(lnum, closing.pos + 1) normal! % if s:Match(line('.'), s:falcon_indent_keywords) - return indent('.') + &sw + return indent('.') + shiftwidth() else return indent('.') endif @@ -392,7 +392,7 @@ function FalconGetIndent(...) let col = s:Match(lnum, s:falcon_indent_keywords) if col > 0 call cursor(lnum, col) - let ind = virtcol('.') - 1 + &sw + let ind = virtcol('.') - 1 + shiftwidth() " TODO: make this better (we need to count them) (or, if a searchpair " fails, we know that something is lacking an end and thus we indent a " level @@ -422,9 +422,9 @@ function FalconGetIndent(...) " TODO: this does not take into account contrived things such as " module Foo; class Bar; end if s:Match(lnum, s:falcon_indent_keywords) - let ind = msl_ind + &sw + let ind = msl_ind + shiftwidth() if s:Match(lnum, s:end_end_regex) - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind endif @@ -433,7 +433,7 @@ function FalconGetIndent(...) " closing bracket, indent one extra level. if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)') if lnum == p_lnum - let ind = msl_ind + &sw + let ind = msl_ind + shiftwidth() else let ind = msl_ind endif diff --git a/runtime/indent/gitconfig.vim b/runtime/indent/gitconfig.vim index 480c96d1b9..6a670ee271 100644 --- a/runtime/indent/gitconfig.vim +++ b/runtime/indent/gitconfig.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: git config file " Maintainer: Tim Pope -" Last Change: 2016 Aug 29 +" Last Change: 2017 Jun 13 if exists("b:did_indent") finish @@ -20,7 +20,7 @@ if exists("*GetGitconfigIndent") endif function! GetGitconfigIndent() - let sw = exists('*shiftwidth') ? shiftwidth() : &sw + let sw = shiftwidth() let line = getline(prevnonblank(v:lnum-1)) let cline = getline(v:lnum) if line =~ '\\\@ -" Last Change: 2011-12-24 +" Last Change: 2017 Jun 13 if exists("b:did_indent") finish @@ -27,11 +27,11 @@ function! GetGitoliteIndent() let cline = getline(v:lnum) if cline =~ '^\s*\(C\|R\|RW\|RW+\|RWC\|RW+C\|RWD\|RW+D\|RWCD\|RW+CD\|-\)[ \t=]' - return &sw + return shiftwidth() elseif cline =~ '^\s*config\s' - return &sw + return shiftwidth() elseif pline =~ '^\s*repo\s' && cline =~ '^\s*\(#.*\)\?$' - return &sw + return shiftwidth() elseif cline =~ '^\s*#' return indent(prevln) elseif cline =~ '^\s*$' diff --git a/runtime/indent/go.vim b/runtime/indent/go.vim index 412ac871c4..bf9ff75e6c 100644 --- a/runtime/indent/go.vim +++ b/runtime/indent/go.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Go " Maintainer: David Barnett (https://github.com/google/vim-ft-go) -" Last Change: 2014 Aug 16 +" Last Change: 2017 Jun 13 " " TODO: " - function invocations split across lines @@ -23,18 +23,6 @@ if exists('*GoIndent') finish endif -" The shiftwidth() function is relatively new. -" Don't require it to exist. -if exists('*shiftwidth') - function s:sw() abort - return shiftwidth() - endfunction -else - function s:sw() abort - return &shiftwidth - endfunction -endif - function! GoIndent(lnum) let l:prevlnum = prevnonblank(a:lnum-1) if l:prevlnum == 0 @@ -51,17 +39,17 @@ function! GoIndent(lnum) if l:prevl =~ '[({]\s*$' " previous line opened a block - let l:ind += s:sw() + let l:ind += shiftwidth() endif if l:prevl =~# '^\s*\(case .*\|default\):$' " previous line is part of a switch statement - let l:ind += s:sw() + let l:ind += shiftwidth() endif " TODO: handle if the previous line is a label. if l:thisl =~ '^\s*[)}]' " this line closed a block - let l:ind -= s:sw() + let l:ind -= shiftwidth() endif " Colons are tricky. @@ -69,7 +57,7 @@ function! GoIndent(lnum) " We ignore trying to deal with jump labels because (a) they're rare, and " (b) they're hard to disambiguate from a composite literal key. if l:thisl =~# '^\s*\(case .*\|default\):$' - let l:ind -= s:sw() + let l:ind -= shiftwidth() endif return l:ind diff --git a/runtime/indent/haml.vim b/runtime/indent/haml.vim index c3935af9e9..e6416e6f53 100644 --- a/runtime/indent/haml.vim +++ b/runtime/indent/haml.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Haml " Maintainer: Tim Pope -" Last Change: 2016 Aug 29 +" Last Change: 2017 Jun 13 if exists("b:did_indent") finish @@ -37,7 +37,7 @@ function! GetHamlIndent() let line = substitute(line,'^\s\+','','') let indent = indent(lnum) let cindent = indent(v:lnum) - let sw = exists('*shiftwidth') ? shiftwidth() : &sw + let sw = shiftwidth() if cline =~# '\v^-\s*%(elsif|else|when)>' let indent = cindent < indent ? cindent : indent - sw endif diff --git a/runtime/indent/hamster.vim b/runtime/indent/hamster.vim index 93e7db486e..b27a173924 100644 --- a/runtime/indent/hamster.vim +++ b/runtime/indent/hamster.vim @@ -27,13 +27,13 @@ function HamGetIndent(lnum) " Add a shiftwidth to statements following if, else, elseif, " case, select, default, do, until, while, for, start if prevline =~? '^\s*\<\(if\|else\%(if\)\?\|for\|repeat\|do\|while\|sub\)\>' - let ind = ind + &sw + let ind = ind + shiftwidth() endif " Subtract a shiftwidth from else, elseif, end(if|while|for), until let line = getline(v:lnum) if line =~? '^\s*\(else\|elseif\|loop\|until\|end\%(if\|while\|for\|sub\)\)\>' - let ind = ind - &sw + let ind = ind - shiftwidth() endif return ind diff --git a/runtime/indent/hog.vim b/runtime/indent/hog.vim index 02ac7d4d1b..ece587d46f 100644 --- a/runtime/indent/hog.vim +++ b/runtime/indent/hog.vim @@ -47,7 +47,7 @@ function GetHogIndent() " Continuation of a line that wasn't indented let prevline = getline(prevlnum) if prevline =~ '^\k\+.*\\\s*$' - return &sw + return shiftwidth() endif " Continuation of a line that was indented @@ -58,13 +58,13 @@ function GetHogIndent() " Indent the next line if previous line contained a start of a block " definition ('{' or '('). if prevline =~ '^\k\+[^#]*{}\@!\s*$' " TODO || prevline =~ '^\k\+[^#]*()\@!\s*$' - return &sw + return shiftwidth() endif " Match inside of a block if s:IsInBlock(v:lnum) if prevline =~ "^\k\+.*$" - return &sw + return shiftwidth() else return indent(prevlnum) endif diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index 57ba53ecd4..37697841fd 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -2,7 +2,7 @@ " Header: "{{{ " Maintainer: Bram Moolenaar " Original Author: Andy Wokula -" Last Change: 2017 Jan 17 +" Last Change: 2017 Jun 13 " Version: 1.0 " Description: HTML indent script with cached state for faster indenting on a " range of lines. @@ -51,15 +51,6 @@ if exists("*HtmlIndent") && !exists('g:force_reload_html') finish endif -" shiftwidth() exists since patch 7.3.694 -if exists('*shiftwidth') - let s:ShiftWidth = function('shiftwidth') -else - func! s:ShiftWidth() - return &shiftwidth - endfunc -endif - " Allow for line continuation below. let s:cpo_save = &cpo set cpo-=C @@ -123,7 +114,7 @@ func! HtmlIndent_CheckUserSettings() let indone = {"zero": 0 \,"auto": "indent(prevnonblank(v:lnum-1))" - \,"inc": "b:hi_indent.blocktagind + s:ShiftWidth()"} + \,"inc": "b:hi_indent.blocktagind + shiftwidth()"} let script1 = '' if exists("b:html_indent_script1") @@ -358,7 +349,7 @@ func! s:CheckBlockTag(blocktag, ind) endif let b:hi_newstate.blocklnr = v:lnum " save allover indent for the endtag - let b:hi_newstate.blocktagind = b:hi_indent.baseindent + (s:nextrel + s:curind) * s:ShiftWidth() + let b:hi_newstate.blocktagind = b:hi_indent.baseindent + (s:nextrel + s:curind) * shiftwidth() if a:ind == 3 return "SCRIPT" " all except this must be lowercase " line is to be checked again for the type attribute @@ -480,7 +471,7 @@ func! s:FreshState(lnum) let state.blocklnr = stopline " check preceding tags in the line: call s:CountITags(tagline[: stopcol-2]) - let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.blocktagind = indent(stopline) + (s:curind + s:nextrel) * shiftwidth() return state elseif stopline == state.lnum " handle special case: previous line (= state.lnum) contains a @@ -490,7 +481,7 @@ func! s:FreshState(lnum) if !swendtag let [bline, bcol] = searchpos('<'.blocktag[1:].'\>', "bnW") call s:CountITags(tolower(getline(bline)[: bcol-2])) - let state.baseindent = indent(bline) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.baseindent = indent(bline) + (s:curind + s:nextrel) * shiftwidth() return state endif endif @@ -511,7 +502,7 @@ func! s:FreshState(lnum) if found == 2 let state.baseindent = b:hi_indent.baseindent endif - let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * shiftwidth() return state endif @@ -530,7 +521,7 @@ func! s:FreshState(lnum) let text = tolower(getline(comlnum)[: comcol-2]) endif call s:CountITags(text) - let state.baseindent = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth() + let state.baseindent = indent(comlnum) + (s:curind + s:nextrel) * shiftwidth() " TODO check tags that follow "-->" return state endif @@ -550,9 +541,9 @@ func! s:FreshState(lnum) let text = getline(start_lnum) let swendtag = match(text, '^\s*= 0 call s:CountITags(text[: col('.') - 2]) - let state.baseindent += s:nextrel * s:ShiftWidth() + let state.baseindent += s:nextrel * shiftwidth() if !swendtag - let state.baseindent += s:curind * s:ShiftWidth() + let state.baseindent += s:curind * shiftwidth() endif endif return state @@ -565,9 +556,9 @@ func! s:FreshState(lnum) let text = getline(state.lnum) let swendtag = match(text, '^\s*= 0 call s:CountITags(tolower(text)) - let state.baseindent = indent(state.lnum) + s:nextrel * s:ShiftWidth() + let state.baseindent = indent(state.lnum) + s:nextrel * shiftwidth() if !swendtag - let state.baseindent += s:curind * s:ShiftWidth() + let state.baseindent += s:curind * shiftwidth() endif return state endfunc "}}} @@ -646,7 +637,7 @@ func! s:CSSIndent() " add indent after { let brace_counts = HtmlIndent_CountBraces(prev_lnum) - let extra = brace_counts.c_open * s:ShiftWidth() + let extra = brace_counts.c_open * shiftwidth() let prev_text = getline(prev_lnum) let below_end_brace = prev_text =~ '}\s*$' @@ -663,7 +654,7 @@ func! s:CSSIndent() " if the current line is not a comment or starts with @ (used by template " systems) reduce indent if previous line is a continuation line if !prev_hasfield && !prev_special - let extra = -s:ShiftWidth() + let extra = -shiftwidth() endif else let cur_hasfield = curtext =~ '^\s*[a-zA-Z0-9-]\+:' @@ -671,14 +662,14 @@ func! s:CSSIndent() if !cur_hasfield && (prev_hasfield || prev_unfinished) " Continuation line has extra indent if the previous line was not a " continuation line. - let extra = s:ShiftWidth() + let extra = shiftwidth() " Align with @if if prev_text =~ '^\s*@if ' let extra = 4 endif elseif cur_hasfield && !prev_hasfield && !prev_special " less indent below a continuation line - let extra = -s:ShiftWidth() + let extra = -shiftwidth() endif endif endif @@ -699,10 +690,10 @@ func! s:CSSIndent() if special " do not reduce indent below @{ ... } if extra < 0 - let extra += s:ShiftWidth() + let extra += shiftwidth() endif else - let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * s:ShiftWidth() + let extra -= (brace_counts.c_close - (prev_text =~ '^\s*}')) * shiftwidth() endif endif @@ -710,10 +701,10 @@ func! s:CSSIndent() if extra == 0 if brace_counts.p_open > brace_counts.p_close " previous line has more ( than ): add a shiftwidth - let extra = s:ShiftWidth() + let extra = shiftwidth() elseif brace_counts.p_open < brace_counts.p_close " previous line has more ) than (: subtract a shiftwidth - let extra = -s:ShiftWidth() + let extra = -shiftwidth() endif endif @@ -816,7 +807,7 @@ func! s:Alien5() let idx = match(prevtext, '^\s*\zs