# HG changeset patch # User Bram Moolenaar # Date 1553436906 -3600 # Node ID bd7461db24b3b4ea080e0d7fe586c6fe7c17db3a # Parent 9ee6ccf783f37a0803c9f7dd3dbd654b73c6cf10 Update runtime files. commit https://github.com/vim/vim/commit/63b74a8362b14576b21d342dc424d0396ca8ea27 Author: Bram Moolenaar Date: Sun Mar 24 15:09:13 2019 +0100 Update runtime files. diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim --- 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/channel.txt b/runtime/doc/channel.txt --- a/runtime/doc/channel.txt +++ b/runtime/doc/channel.txt @@ -1,4 +1,4 @@ -*channel.txt* For Vim version 8.1. Last change: 2018 Apr 18 +*channel.txt* For Vim version 8.1. Last change: 2019 Mar 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -308,9 +308,10 @@ higher. Command "redraw" ~ -The other commands do not update the screen, so that you can send a sequence -of commands without the cursor moving around. You must end with the "redraw" -command to show any changed text and show the cursor where it belongs. +The other commands do not explicitly update the screen, so that you can send a +sequence of commands without the cursor moving around. A redraw can happen as +a side effect of some commands. You must end with the "redraw" command to +show any changed text and show the cursor where it belongs. The argument is normally an empty string: ["redraw", ""] ~ diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.1. Last change: 2019 Mar 02 +*eval.txt* For Vim version 8.1. Last change: 2019 Mar 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -10337,8 +10337,6 @@ tag_binary Compiled with binary searchi |tag-binary-search|. tag_old_static Compiled with support for old static tags |tag-old-static|. -tag_any_white Compiled with support for any white characters in tags - files |tag-any-white|. tcl Compiled with Tcl interface. termguicolors Compiled with true color in terminal support. terminal Compiled with |terminal| support. diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 8.1. Last change: 2019 Mar 17 +*index.txt* For Vim version 8.1. Last change: 2019 Mar 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1042,10 +1042,11 @@ tag command action in Command-line edi 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 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 8.1. Last change: 2019 Mar 08 +*options.txt* For Vim version 8.1. Last change: 2019 Mar 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2538,7 +2538,15 @@ A jump table for the options with a shor 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) @@ -7682,7 +7690,9 @@ A jump table for the options with a shor 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/tags b/runtime/doc/tags --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -7401,6 +7401,7 @@ love intro.txt /*love* lowercase change.txt /*lowercase* lpc.vim syntax.txt /*lpc.vim* lua if_lua.txt /*lua* +lua-blob if_lua.txt /*lua-blob* lua-buffer if_lua.txt /*lua-buffer* lua-commands if_lua.txt /*lua-commands* lua-dict if_lua.txt /*lua-dict* @@ -9023,7 +9024,6 @@ tabpagenr() eval.txt /*tabpagenr()* tabpagewinnr() eval.txt /*tabpagewinnr()* tag tagsrch.txt /*tag* tag-! tagsrch.txt /*tag-!* -tag-any-white tagsrch.txt /*tag-any-white* tag-binary-search tagsrch.txt /*tag-binary-search* tag-blocks motion.txt /*tag-blocks* tag-commands tagsrch.txt /*tag-commands* @@ -9203,6 +9203,7 @@ test_null_partial() eval.txt /*test_null test_null_string() eval.txt /*test_null_string()* test_option_not_set() eval.txt /*test_option_not_set()* test_override() eval.txt /*test_override()* +test_refcount() eval.txt /*test_refcount()* test_scrollbar() eval.txt /*test_scrollbar()* test_settime() eval.txt /*test_settime()* testing eval.txt /*testing* diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -1,4 +1,4 @@ -*tagsrch.txt* For Vim version 8.1. Last change: 2019 Feb 25 +*tagsrch.txt* For Vim version 8.1. Last change: 2019 Mar 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -558,8 +558,7 @@ only supported by new versions of 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/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.1. Last change: 2019 Mar 14 +*todo.txt* For Vim version 8.1. Last change: 2019 Mar 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -38,16 +38,6 @@ browser use: https://github.com/vim/vim/ *known-bugs* -------------------- Known bugs and current work ----------------------- -Patch to add Farsi handling to arabic.c (Ali Gholami Rudi, 2009 May 2) -Added test, updates, June 23. -Updated for 7.4: http://litcave.rudi.ir/farsi_vim.diff -Remark from Ameretat Reith (2014 Oct 13) with patch on top. -Updated patch from Ameretat Reith, 2019 Mar 1. - -Timer test doesn't work on MS-Windows console, any way to make it work? - -Drop FEAT_TAG_ANYWHITE ? It should not be a compile time option. - 'incsearch' with :s: (#3321) - Get E20 when using command history to get "'<,'>s/a/b" and no Visual area was set. (#3837) @@ -121,6 +111,8 @@ Support for popup widows: Adding "10" to 'spellsuggest' causes spell suggestions to become very slow. (#4087) +Patch to add complete_info() Shougo - #3866. Ready to include. Now #4106 + Problem with Visual yank when 'linebreak' and 'showbreak' are set. Patch with tests, but it's not clear how it is supposed to work. (tommm, 2018 Nov 17) Asked about this, Dec 22. Christian will have a look. @@ -137,6 +129,8 @@ Test doesn't fail without patch? Patch to add ruby cflags. (#4050, fixes #1081) Needs modification. +Patch to add src/README.md. (WenxuanHuang, #4141) Replace README.txt? + Crash when mixing matchadd and substitute()? (Max Christian Pohle, 2018 May 13, #2910) Can't reproduce? @@ -224,6 +218,9 @@ Patch on the issue by Hongbo Liu, 2019 F More warnings from static analysis: https://lgtm.com/projects/g/vim/vim/alerts/?mode=list +Drop FEAT_TAG_OLDSTATIC? Anybody using this format should be able to get a +newer version of ctags. + Still a E315 error when using terminal. (Masato Nishihata, #3959) When using 'k' in 'guioptions' gvim may open with a tiny window. (#3808) @@ -231,9 +228,15 @@ Suggested patch on the issue. nvo-mode mapping works on Windows, not on Linux. (#3678) +Patch to have tutor check $LC_MESSAGES. (#4112) + Patch to fix modify_fname() does not work well with some 'encoding's. (Ken Takata, #4007) +Patch to add more info to OptionSet. Should mention what triggered the change +":set", ":setlocal", ":setglobal", "modeline"; and the old global value. +#4118 + Patch to make vim_getenv() work with wide API. (Ken Takata, #4008) How to make (async) complete function depending on completion type? @@ -315,8 +318,6 @@ Invalid memory access with old regexp en #3405) Introduced by 8.0.1517, which was fixing another memory access error. (Sep 8) -Patch to add complete_info Shougo - #3866. Ready to include. - Patch to make winnr() return the window above/below/beside a window. (Yegappan Lakshmanan, #3993) diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 8.1. Last change: 2019 Jan 17 +*various.txt* For Vim version 8.1. Last change: 2019 Mar 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -443,7 +443,7 @@ N *+syntax* Syntax highlighting |synta *+system()* Unix only: opposite of |+fork| T *+tag_binary* binary searching in tags file |tag-binary-search| N *+tag_old_static* old method for static tags |tag-old-static| -m *+tag_any_white* any white space allowed in tags file |tag-any-white| +m *+tag_any_white* Removed; was to allow any white space in tags files m *+tcl* Tcl interface |tcl| m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn| m *+terminal* Support for terminal window |terminal| diff --git a/runtime/filetype.vim b/runtime/filetype.vim --- 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") @@ -1617,6 +1617,10 @@ au BufNewFile,BufRead */etc/sysctl.conf, " 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 --- 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 --- 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 --- 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 --- 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 --- 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/README.txt b/runtime/indent/testdir/README.txt --- a/runtime/indent/testdir/README.txt +++ b/runtime/indent/testdir/README.txt @@ -82,9 +82,9 @@ RUNNING THE TEST Before running the test, create a FILETYPE.ok file. You can leave it empty at first. -Now run "make test". After Vim has done the indenting you will see a -FILETYPE.fail file. This contains the actual result of indenting, and it's -different from the FILETYPE.ok file. +Now run "make test" from the parent directory. After Vim has done the +indenting you will see a FILETYPE.fail file. This contains the actual result +of indenting, and it's different from the FILETYPE.ok file. Check the contents of the FILETYPE.fail file. If it is perfectly OK, then rename it to overwrite the FILETYPE.ok file. If you now run "make test" again, diff --git a/runtime/indent/testdir/html.ok b/runtime/indent/testdir/html.ok --- 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/runtest.vim b/runtime/indent/testdir/runtest.vim --- a/runtime/indent/testdir/runtest.vim +++ b/runtime/indent/testdir/runtest.vim @@ -7,6 +7,7 @@ if 1 set nocp filetype indent on +syn on set nowrapscan set report=9999 @@ -111,7 +112,6 @@ for fname in glob('testdir/*.in', 1, 1) if failed exe 'write ' . root . '.fail' echoerr 'Test ' . fname . ' FAILED!' - sleep 2 else exe 'write ' . root . '.out' endif diff --git a/runtime/indent/testdir/xml.ok b/runtime/indent/testdir/xml.ok --- 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 --- 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('