From 2cdbbe50a4a695004adce50d7502869bb2410928 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 1 Aug 2019 22:45:59 +0200 Subject: [PATCH] vim-patch:63b74a8362b1 Update runtime files. https://github.com/vim/vim/commit/63b74a8362b14576b21d342dc424d0396ca8ea27 --- runtime/autoload/dist/ft.vim | 2 +- runtime/doc/index.txt | 5 +- runtime/doc/options.txt | 12 ++- runtime/doc/tagsrch.txt | 3 +- runtime/filetype.vim | 6 +- runtime/ftplugin/cobol.vim | 5 +- runtime/ftplugin/python.vim | 129 ++++++++++++++++++++------ runtime/indent/cobol.vim | 11 ++- runtime/indent/html.vim | 11 ++- runtime/indent/sh.vim | 4 +- runtime/indent/testdir/html.ok | 6 +- runtime/indent/testdir/xml.ok | 4 +- runtime/indent/xml.vim | 63 +++++++++---- runtime/syntax/cobol.vim | 164 +++++++++++++++++++++++---------- 14 files changed, 312 insertions(+), 113 deletions(-) diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index a97bad3b56..e85ffc763b 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -1,7 +1,7 @@ " Vim functions for file type detection " " Maintainer: Bram Moolenaar -" Last Change: 2019 Jan 18 +" Last Change: 2019 Mar 08 " These functions are moved here from runtime/filetype.vim to make startup " faster. diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 6b80ab1ac2..4cab36a3c8 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1028,10 +1028,11 @@ tag command action in Command-line editing mode ~ command-line from history. |c_CTRL-Q| CTRL-Q same as CTRL-V, unless it's used for terminal control flow -|c_CTRL-R| CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A} +|c_CTRL-R| CTRL-R {regname} insert the contents of a register or object under the cursor as if typed -|c_CTRL-R_CTRL-R| CTRL-R CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A} +|c_CTRL-R_CTRL-R| CTRL-R CTRL-R {regname} +|c_CTRL-R_CTRL-O| CTRL-R CTRL-O {regname} insert the contents of a register or object under the cursor literally CTRL-S (used for terminal control flow) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 707073d158..8881f12f47 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1810,7 +1810,15 @@ A jump table for the options with a short description can be found at |Q_op|. The default value is for C programs. For C++ this value would be useful, to include const type declarations: > ^\(#\s*define\|[a-z]*\s*const\s*[a-z]*\) +< You can also use "\ze" just before the name and continue the pattern + to check what is following. E.g. for Javascript, if a function is + defined with "func_name = function(args)": > + ^\s*\ze\i\+\s*=\s*function( +< If the function is defined with "func_name : function() {...": > + ^\s*\ze\i\+\s*[:]\s*(*function\s*( < When using the ":set" command, you need to double the backslashes! + To avoid that use `:let` with a single quote string: > + let &l:define = '^\s*\ze\k\+\s*=\s*function(' *'delcombine'* *'deco'* *'nodelcombine'* *'nodeco'* 'delcombine' 'deco' boolean (default off) @@ -5974,7 +5982,9 @@ A jump table for the options with a short description can be found at |Q_op|. pages. split If included, split the current window before loading a buffer for a |quickfix| command that display errors. - Otherwise: do not split, use current window. + Otherwise: do not split, use current window (when used + in the quickfix window: the previously used window or + split if there is no other window). vsplit Just like "split" but split vertically. newtab Like "split", but open a new tab page. Overrules "split" when both are present. diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index eec217769a..4890cf3848 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -523,8 +523,7 @@ only supported by new versions of ctags (such as Exuberant ctags). be any identifier. It cannot contain a . {TAB} One character. Note: previous versions allowed any white space here. This has been abandoned to allow spaces in - {tagfile}. It can be re-enabled by including the - |+tag_any_white| feature at compile time. *tag-any-white* + {tagfile}. {tagfile} The file that contains the definition of {tagname}. It can have an absolute or relative path. It may contain environment variables and wildcards (although the use of wildcards is diff --git a/runtime/filetype.vim b/runtime/filetype.vim index b2337aa49b..0a0973e7d3 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: 2019 Feb 07 +" Last Change: 2019 Mar 19 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1613,6 +1613,10 @@ au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl " Systemd unit files au BufNewFile,BufRead */systemd/*.{automount,mount,path,service,socket,swap,target,timer} setf systemd +" Systemd overrides +au BufNewFile,BufRead /etc/systemd/system/*.d/*.conf setf systemd +" Systemd temp files +au BufNewFile,BufRead /etc/systemd/system/*.d/.#* setf systemd " Synopsys Design Constraints au BufNewFile,BufRead *.sdc setf sdc diff --git a/runtime/ftplugin/cobol.vim b/runtime/ftplugin/cobol.vim index 11ad3ad727..d96a1bf281 100644 --- a/runtime/ftplugin/cobol.vim +++ b/runtime/ftplugin/cobol.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: cobol -" Author: Tim Pope -" Last Update: By ZyX: use shiftwidth() +" Maintainer: Ankit Jain +" (formerly Tim Pope ) +" Last Update: By Ankit Jain (changed maintainer) on 22.03.2019 " Insert mode mappings: " Normal mode mappings: < > << >> [[ ]] [] ][ diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 5c4a59b1a9..64c1a87a69 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -3,7 +3,7 @@ " Maintainer: Tom Picton " Previous Maintainer: James Sully " Previous Maintainer: Johannes Zellner -" Last Change: Sun, 15 April 2018 +" Last Change: Sun 17 Mar 2019 " https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif @@ -37,9 +37,10 @@ setlocal suffixesadd=.py setlocal comments=b:#,fb:- setlocal commentstring=#\ %s -setlocal omnifunc=pythoncomplete#Complete if has('python3') - setlocal omnifunc=python3complete#Complete + setlocal omnifunc=python3complete#Complete +elseif has('python') + setlocal omnifunc=pythoncomplete#Complete endif set wildignore+=*.pyc @@ -53,32 +54,34 @@ let b:prev='\v^\s*(class\|def\|async def)>' let b:next_end='\v\S\n*(%$\|^(\s*\n*)*(class\|def\|async def)\|^\S)' let b:prev_end='\v\S\n*(^(\s*\n*)*(class\|def\|async def)\|^\S)' -execute "nnoremap ]] :call Python_jump('n', '". b:next_toplevel."', 'W', v:count1)" -execute "nnoremap [[ :call Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)" -execute "nnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', 0, v:count1)" -execute "nnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)" -execute "nnoremap ]m :call Python_jump('n', '". b:next."', 'W', v:count1)" -execute "nnoremap [m :call Python_jump('n', '". b:prev."', 'Wb', v:count1)" -execute "nnoremap ]M :call Python_jump('n', '". b:next_end."', 'W', 0, v:count1)" -execute "nnoremap [M :call Python_jump('n', '". b:prev_end."', 'Wb', 0, v:count1)" +if !exists('g:no_plugin_maps') && !exists('g:no_python_maps') + execute "nnoremap ]] :call Python_jump('n', '". b:next_toplevel."', 'W', v:count1)" + execute "nnoremap [[ :call Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)" + execute "nnoremap ][ :call Python_jump('n', '". b:next_endtoplevel."', 'W', v:count1, 0)" + execute "nnoremap [] :call Python_jump('n', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)" + execute "nnoremap ]m :call Python_jump('n', '". b:next."', 'W', v:count1)" + execute "nnoremap [m :call Python_jump('n', '". b:prev."', 'Wb', v:count1)" + execute "nnoremap ]M :call Python_jump('n', '". b:next_end."', 'W', v:count1, 0)" + execute "nnoremap [M :call Python_jump('n', '". b:prev_end."', 'Wb', v:count1, 0)" -execute "onoremap ]] :call Python_jump('o', '". b:next_toplevel."', 'W', v:count1)" -execute "onoremap [[ :call Python_jump('o', '". b:prev_toplevel."', 'Wb', v:count1)" -execute "onoremap ][ :call Python_jump('o', '". b:next_endtoplevel."', 'W', 0, v:count1)" -execute "onoremap [] :call Python_jump('o', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)" -execute "onoremap ]m :call Python_jump('o', '". b:next."', 'W', v:count1)" -execute "onoremap [m :call Python_jump('o', '". b:prev."', 'Wb', v:count1)" -execute "onoremap ]M :call Python_jump('o', '". b:next_end."', 'W', 0, v:count1)" -execute "onoremap [M :call Python_jump('o', '". b:prev_end."', 'Wb', 0, v:count1)" + execute "onoremap ]] :call Python_jump('o', '". b:next_toplevel."', 'W', v:count1)" + execute "onoremap [[ :call Python_jump('o', '". b:prev_toplevel."', 'Wb', v:count1)" + execute "onoremap ][ :call Python_jump('o', '". b:next_endtoplevel."', 'W', v:count1, 0)" + execute "onoremap [] :call Python_jump('o', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)" + execute "onoremap ]m :call Python_jump('o', '". b:next."', 'W', v:count1)" + execute "onoremap [m :call Python_jump('o', '". b:prev."', 'Wb', v:count1)" + execute "onoremap ]M :call Python_jump('o', '". b:next_end."', 'W', v:count1, 0)" + execute "onoremap [M :call Python_jump('o', '". b:prev_end."', 'Wb', v:count1, 0)" -execute "xnoremap ]] :call Python_jump('x', '". b:next_toplevel."', 'W', v:count1)" -execute "xnoremap [[ :call Python_jump('x', '". b:prev_toplevel."', 'Wb', v:count1)" -execute "xnoremap ][ :call Python_jump('x', '". b:next_endtoplevel."', 'W', 0, v:count1)" -execute "xnoremap [] :call Python_jump('x', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)" -execute "xnoremap ]m :call Python_jump('x', '". b:next."', 'W', v:count1)" -execute "xnoremap [m :call Python_jump('x', '". b:prev."', 'Wb', v:count1)" -execute "xnoremap ]M :call Python_jump('x', '". b:next_end."', 'W', 0, v:count1)" -execute "xnoremap [M :call Python_jump('x', '". b:prev_end."', 'Wb', 0, v:count1)" + execute "xnoremap ]] :call Python_jump('x', '". b:next_toplevel."', 'W', v:count1)" + execute "xnoremap [[ :call Python_jump('x', '". b:prev_toplevel."', 'Wb', v:count1)" + execute "xnoremap ][ :call Python_jump('x', '". b:next_endtoplevel."', 'W', v:count1, 0)" + execute "xnoremap [] :call Python_jump('x', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)" + execute "xnoremap ]m :call Python_jump('x', '". b:next."', 'W', v:count1)" + execute "xnoremap [m :call Python_jump('x', '". b:prev."', 'Wb', v:count1)" + execute "xnoremap ]M :call Python_jump('x', '". b:next_end."', 'W', v:count1, 0)" + execute "xnoremap [M :call Python_jump('x', '". b:prev_end."', 'Wb', v:count1, 0)" +endif if !exists('*Python_jump') fun! Python_jump(mode, motion, flags, count, ...) range @@ -123,10 +126,80 @@ if !exists('g:pydoc_executable') let g:pydoc_executable = 0 endif endif + +" Windows-specific pydoc setup +if has('win32') || has('win64') + if executable('python') + " available as Tools\scripts\pydoc.py + let g:pydoc_executable = 1 + else + let g:pydoc_executable = 0 + endif +endif + " If "pydoc" was found use it for keywordprg. if g:pydoc_executable - setlocal keywordprg=pydoc + if has('win32') || has('win64') + setlocal keywordprg=python\ -m\ pydoc\ + else + setlocal keywordprg=pydoc + endif endif +" Script for filetype switching to undo the local stuff we may have changed +let b:undo_ftplugin = 'setlocal cinkeys<' + \ . '|setlocal comments<' + \ . '|setlocal commentstring<' + \ . '|setlocal expandtab<' + \ . '|setlocal include<' + \ . '|setlocal includeexpr<' + \ . '|setlocal indentkeys<' + \ . '|setlocal keywordprg<' + \ . '|setlocal omnifunc<' + \ . '|setlocal shiftwidth<' + \ . '|setlocal softtabstop<' + \ . '|setlocal suffixesadd<' + \ . '|setlocal tabstop<' + \ . '|silent! nunmap [M' + \ . '|silent! nunmap [[' + \ . '|silent! nunmap []' + \ . '|silent! nunmap [m' + \ . '|silent! nunmap ]M' + \ . '|silent! nunmap ][' + \ . '|silent! nunmap ]]' + \ . '|silent! nunmap ]m' + \ . '|silent! ounmap [M' + \ . '|silent! ounmap [[' + \ . '|silent! ounmap []' + \ . '|silent! ounmap [m' + \ . '|silent! ounmap ]M' + \ . '|silent! ounmap ][' + \ . '|silent! ounmap ]]' + \ . '|silent! ounmap ]m' + \ . '|silent! xunmap [M' + \ . '|silent! xunmap [[' + \ . '|silent! xunmap []' + \ . '|silent! xunmap [m' + \ . '|silent! xunmap ]M' + \ . '|silent! xunmap ][' + \ . '|silent! xunmap ]]' + \ . '|silent! xunmap ]m' + \ . '|unlet! b:browsefilter' + \ . '|unlet! b:child_match' + \ . '|unlet! b:child_sub' + \ . '|unlet! b:grandparent_match' + \ . '|unlet! b:grandparent_sub' + \ . '|unlet! b:next' + \ . '|unlet! b:next_end' + \ . '|unlet! b:next_endtoplevel' + \ . '|unlet! b:next_toplevel' + \ . '|unlet! b:parent_match' + \ . '|unlet! b:parent_sub' + \ . '|unlet! b:prev' + \ . '|unlet! b:prev_end' + \ . '|unlet! b:prev_endtoplevel' + \ . '|unlet! b:prev_toplevel' + \ . '|unlet! b:undo_ftplugin' + let &cpo = s:keepcpo unlet s:keepcpo diff --git a/runtime/indent/cobol.vim b/runtime/indent/cobol.vim index c08444ac40..590a729df4 100644 --- a/runtime/indent/cobol.vim +++ b/runtime/indent/cobol.vim @@ -1,7 +1,12 @@ " Vim indent file " Language: cobol -" Author: Tim Pope +" Maintainer: Ankit Jain +" (formerly Tim Pope ) " $Id: cobol.vim,v 1.1 2007/05/05 18:08:19 vimboss Exp $ +" Last Update: By Ankit Jain on 22.03.2019 +" Ankit Jain 22.03.2019 Changes & fixes: +" Allow chars in 1st 6 columns +" #C22032019 if exists("b:did_indent") finish @@ -66,7 +71,9 @@ function! GetCobolIndent(lnum) abort let ashft = minshft + 1 let bshft = ashft + 4 " (Obsolete) numbered lines - if getline(a:lnum) =~? '^\s*\d\{6\}\%($\|[ */$CD-]\)' + " #C22032019: Columns 1-6 could have alphabets as well as numbers + "if getline(a:lnum) =~? '^\s*\d\{6\}\%($\|[ */$CD-]\)' + if getline(a:lnum) =~? '^\s*[a-zA-Z0-9]\{6\}\%($\|[ */$CD-]\)' return 0 endif let cline = s:stripped(a:lnum) diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index 1a8177050a..1d2043ae9e 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: 2018 Mar 28 +" Last Change: 2019 Mar 20 " Version: 1.0 " Description: HTML indent script with cached state for faster indenting on a " range of lines. @@ -902,12 +902,19 @@ func! s:InsideTag(foundHtmlString) "{{{ if a:foundHtmlString " Inside an attribute string. - " Align with the previous line or use an external function. + " Align with the opening quote or use an external function. let lnum = v:lnum - 1 if lnum > 1 if exists('b:html_indent_tag_string_func') return b:html_indent_tag_string_func(lnum) endif + " If there is a double quote in the previous line, indent with the + " character after it. + if getline(lnum) =~ '"' + call cursor(lnum, 0) + normal f" + return virtcol('.') + endif return indent(lnum) endif endif diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index c93be31958..0396b4eb94 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -7,6 +7,8 @@ " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-sh-indent " Changelog: +" 20190316 - Make use of searchpairpos for nested if sections +" fixes #11 " 20190201 - Better check for closing if sections " 20180724 - make check for zsh syntax more rigid (needs word-boundaries) " 20180326 - better support for line continuation @@ -115,7 +117,7 @@ function! GetShIndent() " Current line is a endif line, so get indent from start of "if condition" line " TODO: should we do the same for other "end" lines? if curline =~ '^\s*\%(fi\)\s*\%(#.*\)\=$' - let previous_line = search('if.\{-\};\s*then\s*\%(#.*\)\=$', 'bnW') + let previous_line = searchpair('\', '', '\', 'bnW') if previous_line > 0 let ind = indent(previous_line) endif diff --git a/runtime/indent/testdir/html.ok b/runtime/indent/testdir/html.ok index 524d57bb6c..ad819333cc 100644 --- a/runtime/indent/testdir/html.ok +++ b/runtime/indent/testdir/html.ok @@ -9,17 +9,17 @@
+ class="foo bar"> text
+ data="something"> text
+ bar"> text
diff --git a/runtime/indent/testdir/xml.ok b/runtime/indent/testdir/xml.ok index 529198572a..cfdf701c11 100644 --- a/runtime/indent/testdir/xml.ok +++ b/runtime/indent/testdir/xml.ok @@ -10,11 +10,11 @@ diff --git a/runtime/indent/xml.vim b/runtime/indent/xml.vim index 29069bab84..ad22de1d50 100644 --- a/runtime/indent/xml.vim +++ b/runtime/indent/xml.vim @@ -1,9 +1,11 @@ " Language: xml " Repository: https://github.com/chrisbra/vim-xml-ftplugin -" Last Changed: Jan 28, 2019 +" Last Changed: Feb 04, 2019 " Maintainer: Christian Brabandt " Previous Maintainer: Johannes Zellner " Last Change: +" 20190204 - correctly handle wrap tags +" https://github.com/chrisbra/vim-xml-ftplugin/issues/5 " 20190128 - Make sure to find previous tag " https://github.com/chrisbra/vim-xml-ftplugin/issues/4 " 20181116 - Fix indentation when tags start with a colon or an underscore @@ -74,13 +76,20 @@ fun! XmlIndentSynCheck(lnum) endfun " [-- return the sum of indents of a:lnum --] -fun! XmlIndentSum(lnum, style, add) - let line = getline(a:lnum) - if a:style == match(line, '^\s*XmlIndentSum(line, style, add) + if IsXMLContinuation(a:line) && a:style == 0 + " no complete tag, add one additional indent level + " but only for the current line + return a:add + shiftwidth() + elseif HasNoTagEnd(a:line) + " no complete tag, return initial indent + return a:add + endif + if a:style == match(a:line, '^\s*XmlIndentWithPattern(line, b:xml_indent_open) - \ - XmlIndentWithPattern(line, b:xml_indent_close) - \ - XmlIndentWithPattern(line, '.\{-}/>'))) + a:add + \ (XmlIndentWithPattern(a:line, b:xml_indent_open) + \ - XmlIndentWithPattern(a:line, b:xml_indent_close) + \ - XmlIndentWithPattern(a:line, '.\{-}/>'))) + a:add else return a:add endif @@ -89,19 +98,24 @@ endfun " Main indent function fun! XmlIndentGet(lnum, use_syntax_check) " Find a non-empty line above the current line. - let plnum = prevnonblank(a:lnum - 1) - " Hit the start of the file, use zero indent. - if plnum == 0 + if prevnonblank(a:lnum - 1) == 0 + " Hit the start of the file, use zero indent. return 0 endif " Find previous line with a tag (regardless whether open or closed, " but always start restrict the match to a line before the current one + " Note: xml declaration: + " won't be found, as it is not a legal tag name let ptag_pattern = '\%(.\{-}<[/:A-Z_a-z]\)'. '\%(\&\%<'. line('.').'l\)' - let ptag = search(ptag_pattern, 'bnw') + let ptag = search(ptag_pattern, 'bnW') + " no previous tag + if ptag == 0 + return 0 + endif let syn_name = '' if a:use_syntax_check - let check_lnum = XmlIndentSynCheck(plnum) + let check_lnum = XmlIndentSynCheck(ptag) let check_alnum = XmlIndentSynCheck(a:lnum) if check_lnum == 0 || check_alnum == 0 return indent(a:lnum) @@ -113,18 +127,31 @@ fun! XmlIndentGet(lnum, use_syntax_check) return XmlIndentComment(a:lnum) endif + let pline = getline(ptag) + let pind = indent(ptag) " Get indent from previous tag line - let ind = XmlIndentSum(ptag, -1, indent(ptag)) + let ind = XmlIndentSum(pline, -1, pind) + let t_ind = ind " Determine indent from current line - let ind = XmlIndentSum(a:lnum, 0, ind) + let ind = XmlIndentSum(getline(a:lnum), 0, ind) return ind endfun +func! IsXMLContinuation(line) + " Checks, whether or not the line matches a start-of-tag + return a:line !~ '^\s*<' +endfunc + +func! HasNoTagEnd(line) + " Checks whether or not the line matches '>' (so finishes a tag) + return a:line !~ '>\s*$' +endfunc + " return indent for a commented line, " the middle part might be indented on additional level func! XmlIndentComment(lnum) - let ptagopen = search(b:xml_indent_open, 'bnw') - let ptagclose = search(b:xml_indent_close, 'bnw') + let ptagopen = search(b:xml_indent_open, 'bnW') + let ptagclose = search(b:xml_indent_close, 'bnW') if getline(a:lnum) =~ '' " end of comment, same as start of comment - return indent(search('