diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-12-09 20:43:55 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-12-09 20:43:55 +0100 |
commit | d47d52232bf21036c5c89081458be7eaf2630d24 (patch) | |
tree | 5b7031e52717248256f1d4d4307f241bce046184 | |
parent | 37402ed53475166cd988edbea1269fa4e9918dc4 (diff) |
Update runtime files.
-rw-r--r-- | runtime/autoload/xmlformat.vim | 16 | ||||
-rw-r--r-- | runtime/doc/digraph.txt | 13 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 25 | ||||
-rw-r--r-- | runtime/doc/map.txt | 2 | ||||
-rw-r--r-- | runtime/doc/options.txt | 11 | ||||
-rw-r--r-- | runtime/doc/terminal.txt | 2 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 62 | ||||
-rw-r--r-- | runtime/doc/vim-da.1 | 4 | ||||
-rw-r--r-- | runtime/doc/vim-da.UTF-8.1 | 4 | ||||
-rw-r--r-- | runtime/ftplugin/xml.vim | 8 | ||||
-rw-r--r-- | runtime/indent/cs.vim | 74 | ||||
-rw-r--r-- | runtime/indent/html.vim | 17 | ||||
-rw-r--r-- | runtime/indent/tcl.vim | 50 | ||||
-rw-r--r-- | runtime/indent/testdir/html.in | 26 | ||||
-rw-r--r-- | runtime/indent/testdir/html.ok | 26 | ||||
-rw-r--r-- | runtime/indent/testdir/tcl.in | 19 | ||||
-rw-r--r-- | runtime/indent/testdir/tcl.ok | 19 | ||||
-rw-r--r-- | runtime/indent/testdir/xml.in | 32 | ||||
-rw-r--r-- | runtime/indent/testdir/xml.ok | 32 | ||||
-rw-r--r-- | runtime/mswin.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/apache.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/cs.vim | 39 | ||||
-rw-r--r-- | runtime/syntax/tasm.vim | 4 | ||||
-rw-r--r-- | runtime/tutor/tutor.eo | 10 | ||||
-rw-r--r-- | runtime/tutor/tutor.eo.utf-8 | 10 | ||||
-rw-r--r-- | runtime/tutor/tutor.fr | 16 | ||||
-rw-r--r-- | runtime/tutor/tutor.fr.utf-8 | 16 |
27 files changed, 403 insertions, 142 deletions
diff --git a/runtime/autoload/xmlformat.vim b/runtime/autoload/xmlformat.vim index f227b5ee25..ea89401977 100644 --- a/runtime/autoload/xmlformat.vim +++ b/runtime/autoload/xmlformat.vim @@ -1,9 +1,9 @@ " Vim plugin for formatting XML -" Last Change: Thu, 22 May 2018 21:26:55 +0100 -" Version: 0.1 -" Author: Christian Brabandt <cb@256bit.org> -" Repository: https://github.com/chrisbra/vim-xml-ftplugin -" License: VIM License +" Last Change: Thu, 07 Dec 2018 +" Version: 0.1 +" Author: Christian Brabandt <cb@256bit.org> +" Repository: https://github.com/chrisbra/vim-xml-ftplugin +" License: VIM License " Documentation: see :h xmlformat.txt (TODO!) " --------------------------------------------------------------------- " Load Once: {{{1 @@ -85,7 +85,11 @@ func! s:Trim(item) endfunc " Check if tag is a new opening tag <tag> {{{1 func! s:StartTag(tag) - return a:tag =~? '^\s*<[^/?]' + let is_comment = s:IsComment(a:tag) + return a:tag =~? '^\s*<[^/?]' && !is_comment +endfunc +func! s:IsComment(tag) + return a:tag =~? '<!--' endfunc " Remove one level of indentation {{{1 func! s:DecreaseIndent() diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index 62f23a2f80..14a567651d 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -111,11 +111,14 @@ this, you will have to type <BS> e again. To avoid this don't set the You may have problems using Vim with characters which have a value above 128. For example: You insert ue (u-umlaut) and the editor echoes \334 in Insert -mode. After leaving the Insert mode everything is fine. Note that fmt -removes all characters with a value above 128 from the text being formatted. -On some Unix systems this means you have to define the environment-variable -LC_CTYPE. If you are using csh, then put the following line in your .cshrc: > - setenv LC_CTYPE iso_8859_1 +mode. After leaving the Insert mode everything is fine. On some Unix systems +this means you have to define the environment-variable LC_CTYPE. If you are +using csh, then put the following line in your .cshrc: > + setenv LC_CTYPE en_US.utf8 +(or similar for a different language or country). The value must be a valid +locale on your system, i.e. on Unix-like systems it must be present in the +output of > + locale -a ============================================================================== 3. Default digraphs *digraphs-default* diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 5e6545cbdd..21fc43aaae 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 8.1. Last change: 2018 May 17 +*eval.txt* For Vim version 8.1. Last change: 2018 Dec 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -518,7 +518,7 @@ To loop over the values use the |values()| function: > :endfor If you want both the key and the value use the |items()| function. It returns -a List in which each item is a List with two items, the key and the value: > +a List in which each item is a List with two items, the key and the value: > :for [key, value] in items(mydict) : echo key . ': ' . value :endfor @@ -1088,11 +1088,6 @@ These are INVALID: 3. empty {M} 1e40 missing .{M} - *float-pi* *float-e* -A few useful values to copy&paste: > - :let pi = 3.14159265359 - :let e = 2.71828182846 - Rationale: Before floating point was introduced, the text "123.456" was interpreted as the two numbers "123" and "456", both converted to a string and concatenated, @@ -1101,6 +1096,15 @@ could not find it intentionally being used in Vim scripts, this backwards incompatibility was accepted in favor of being able to use the normal notation for floating point numbers. + *float-pi* *float-e* +A few useful values to copy&paste: > + :let pi = 3.14159265359 + :let e = 2.71828182846 +Or, if you don't want to write them in as floating-point literals, you can +also use functions, like the following: > + :let pi = acos(-1.0) + :let e = exp(1.0) + *floating-point-precision* The precision and range of floating points numbers depends on what "double" means in the library Vim was compiled with. There is no way to change this at @@ -1438,7 +1442,9 @@ Note that this means that filetype plugins don't get a different set of script variables for each buffer. Use local buffer variables instead |b:var|. -Predefined Vim variables: *vim-variable* *v:var* *v:* +PREDEFINED VIM VARIABLES *vim-variable* *v:var* *v:* + *E963* +Some variables can be set by the user, but the type cannot be changed. *v:beval_col* *beval_col-variable* v:beval_col The number of the column, over which the mouse pointer is. @@ -7845,7 +7851,8 @@ str2float({expr}) *str2float()* as when using a floating point number in an expression, see |floating-point-format|. But it's a bit more permissive. E.g., "1e40" is accepted, while in an expression you need to - write "1.0e40". + write "1.0e40". The hexadecimal form "0x123" is also + accepted, but not others, like binary or octal. Text after the number is silently ignored. The decimal point is always '.', no matter what the locale is set to. A comma ends the number: "12,345.67" is converted to diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index e9ad2a06d4..d43afe9dfb 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 8.1. Last change: 2018 May 13 +*map.txt* For Vim version 8.1. Last change: 2018 Dec 08 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 774e782270..b5278f16ba 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -8126,7 +8126,11 @@ A jump table for the options with a short description can be found at |Q_op|. separated by non-keyword characters (white space is preferred). Maximum line length is 510 bytes. - Unfortunately we currently cannot recommend a file to be used here. + An English word list was added to this github issue: + https://github.com/vim/vim/issues/629#issuecomment-443293282 + Unpack thesaurus_pkg.zip, put the thesaurus.txt file somewhere, e.g. + ~/.vim/thesaurus/english.txt, and the 'thesaurus' option to this file + name. To include a comma in a file name precede it with a backslash. Spaces after a comma are ignored, otherwise spaces are included in the file @@ -8432,8 +8436,9 @@ A jump table for the options with a short description can be found at |Q_op|. |t_RV| is set to the escape sequence to request the xterm version number, more intelligent detection process runs. The "xterm2" value will be set if the xterm version is reported to be - from 95 to 276. The "sgr" value will be set if the xterm version is - 277 or higher and when Vim detects Mac Terminal.app or iTerm2. + from 95 to 276. The "sgr" value will be set if Vim detects Mac + Terminal.app, iTerm2 or mintty, and when the xterm version is 277 or + higher. If you do not want 'ttymouse' to be set to "xterm2" or "sgr" automatically, set t_RV to an empty string: > :set t_RV= diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt index 499a2450a6..0db69df7d3 100644 --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -110,7 +110,7 @@ sent to the job running in the terminal. For example, to make F1 switch to Terminal-Normal mode: > tnoremap <F1> <C-W>N You can use Esc, but you need to make sure it won't cause other keys to -break: > +break (cursor keys start with an Esc, so they may break): > tnoremap <Esc> <C-W>N set notimeout ttimeout timeoutlen=100 diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 043e6d57ef..4b4439f55c 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.1. Last change: 2018 May 17 +*todo.txt* For Vim version 8.1. Last change: 2018 Dec 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -38,15 +38,11 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- -Make ":script 40" edit the script listed with number 40. Actually use -":scriptnames". - -Download page: "A 64 bit version" link is wrong, use this one instead: -https://github.com/vim/vim-win32-installer/releases/latest - 'incsearch' with :s: (#3321) - :s/foo using CTRL-G moves to another line, should not happen, or use the correct line (it uses the last but one line) (Lifepillar, Aug 18, #3345) +- :s@pat/tern@ doesn't include "/" in the pattern. (Takahiro Yoshihara, #3637) + pass delim to do_search() ? - Also support range: :/foo/,/bar/delete - Also support for user command, e.g. Cfilter - :%s/foo should take the first match below the cursor line, unless there @@ -105,22 +101,19 @@ Terminal emulator window: - When 'encoding' is not utf-8, or the job is using another encoding, setup conversions. -Users get used to "function!" because they reload a script file. How about -recognizing the script is re-sourced and not giving an error for the first -function that overwrites. Then one can leave out the exclamation mark and -catch actual errors, overwriting a function from another script. +":function" can now silently overwrite the function from the same script. +Do the same for ":command" ? Update for German spell files: https://github.com/chrisbra/vim/compare/5e021c990f8817a50d3264782a5...3b27c92f297540761ebbd92d04fb3 (Christian Brabandt, 2018 Nov 4) -Patch for nsis/README.txt and uninstal.txt (Ken Takata, 2018 Nov 17, #3614) - -Patch to add commandline completion tests. (Dominique, #3622) - 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) +Patch to add configure flags to skip rtl, farsi and arabic support. +(Diego Carrión, #1867) + Key mapping times out when using a timer in Gvim. (Michael Henry, 2018 Sep 9, #3417) @@ -128,9 +121,6 @@ Does not build with MinGW out of the box: - _stat64 is not defined, need to use "struct stat" in vim.h - WINVER conflict, should use 0x0600 by default? -Adding a fold with a marker in a C file doesn't add the comment /* */ if the -line contains a * somewhere. Patch with a fix (Hirohito Higashi, 2018 Nov 22) - Crash in terminal with long multi-byte sequence. (2018 Nov 17, #3619) Dominique cannot reproduce. Update Nov 18. Suggested solution by Yasuhiro Matsumoto, 2018 Nov 18. @@ -138,6 +128,14 @@ Suggested solution by Yasuhiro Matsumoto, 2018 Nov 18. Crash when mixing matchadd and substitute()? (Max Christian Pohle, 2018 May 13, #2910) Can't reproduce? +Patch to simplify nsis installer. (Ken Takata, 2018 Sep 24, was #3479) +Now included in #3501, using MUI2. Use the zip file to get the binary files: +https://github.com/vim/vim/files/2475621/nsis-icons.zip +Ready to include now. + +Patch to add blob type support. (Yasuhiro Matsumoto, 2018 Nov 26, #3638) +Not done yet. + Errors found with random data: heap-buffer-overflow in alist_add (#2472) @@ -147,6 +145,9 @@ mappings no longer work. Create a new terminal for the better solution? Patch to fix that appending makes items to be "recognized". (Yegappan, 2018 Nov 23). Reported by Daniel Hahler, #3633. +Patch to define and manipulate signs with functions. Adds sign groups and +priority. (Yegappan Lakshmanan, #3652) + Improve fallback for menu translations, to avoid having to create lots of files that source the actual file. E.g. menu_da_de -> menu_da Include part of #3242? @@ -175,9 +176,6 @@ C syntax: {} inside () causes following {} to be highlighted as error. More warnings from static analysis: https://lgtm.com/projects/g/vim/vim/alerts/?mode=list -Quickfix accessing free memory. (Dominique, 2018 Oct 13, #3538) -Yegappan will look into it. - Patch for this: (Aron Widforss, 2018 Oct 13, #3539) missing a test. 7 Make 'scrolloff' a global-local option, so that it can be different in the @@ -199,14 +197,12 @@ punctiuation is repeated. (Smylers, 2018 Nov 17, #3621) ":mksession" cannot handle a very long 'runtimepath'. (Timothy Madden, 21 Sep 2018, #3466) Patch from Christian, 2018 Oct 30 (with comments). +Patch to add functions for signs. (Yegappan Lakshmanan, 2018 Nov 24) +obsolete: Patch to add functions for signs. (Christian Brabandt, 2013 Jan 27) + Patch in pull request #2967: Allow white space in sign text. (Ben Jackson) Test fails in AppVeyor. -Patch to simplify nsis installer. (Ken Takata, 2018 Sep 24, was #3479) -Now included in #3501, using MUI2. Use the zip file to get the binary files: -https://github.com/vim/vim/files/2475621/nsis-icons.zip -Still being worked on. - ml_get error: (Israel Chauca Fuentes, 2018 Oct 17, #3550). Patch to convert temp file name. (Yasuhiro Matsumoto, #3520) @@ -227,6 +223,9 @@ Patch to implement 'diffref' option. (#3535) Patch to fix that bracketed paste remains after Vim exits. (2018 Oct 30, #3579) +Patch for lnext/lprev work in specific cases. (Yegappan Lakshmanan, 2018 Dec +4, #3633) + cursorline highlighting not removed after yanking in Visual mode. (Matéo Zanibelli, 2018 Oct 30, #3578) Patch by Christian, Oct 30. @@ -246,6 +245,9 @@ Memory leak in test_terminal: gethostbyname() is old, use getaddrinfo() if available. (#3227) +Patch to add match count and current index "3/44" when using "n" command. +(Christian Brabandt, on issue #453). Only when search string was typed? + matchaddpos() gets slow with many matches. Proposal by Rick Howe, 2018 Jul 19. @@ -288,6 +290,9 @@ Further xdiff changes: Difference between two regexp engines: #3373 +Patch to add ch_listen() (Yasuhiro Matsumoto, 2018 Nov 26, #3639) +What is the practical use for this? + When the last line wraps, selecting with the mouse below that line only includes the first screen line. (2018 Aug 23, #3368) @@ -759,9 +764,6 @@ Is it possible to keep the complete menu open when calling complete()? Memory leak in test97? The string is actually freed. Weird. -Patch to add configure flags to skip rtl, farsi and arabic support. -(Diego Carrión, #1867) - assert_fails() can only check for the first error. Make it possible to have it catch multiple errors and check all of them. @@ -1654,8 +1656,6 @@ Or use expand('<sid>')? Patch to make confirm() display colors. (Christian Brabandt, 2012 Nov 9) -Patch to add functions for signs. (Christian Brabandt, 2013 Jan 27) - Patch to remove flicker from popup menu. (Yasuhiro Matsumoto, 2013 Aug 15) Problem with refresh:always in completion. (Tyler Wade, 2013 Mar 17) diff --git a/runtime/doc/vim-da.1 b/runtime/doc/vim-da.1 index cc272ada35..3437bbcd2d 100644 --- a/runtime/doc/vim-da.1 +++ b/runtime/doc/vim-da.1 @@ -321,13 +321,13 @@ Når N udelades, så åbnes én fanebladsside pr. fil. .TP \-R Skrivebeskyttet tilstand. -'readonly'-valgmuligheden sættes. +\&'readonly'-valgmuligheden sættes. Du kan stadig redigere bufferen, men vil være forhindret i fejlagtigt at overskrive en fil. Hvis du vil overskrive en fil, så tilføj et udråbstegn til Ex-kommandoen, som i ":w!". \-R-tilvalget indebærer også \-n-tilvalget (se ovenfor). -'readonly'-valgmuligheden kan slås fra med ":set noro". +\&'readonly'-valgmuligheden kan slås fra med ":set noro". Se ":help 'readonly'". .TP \-r diff --git a/runtime/doc/vim-da.UTF-8.1 b/runtime/doc/vim-da.UTF-8.1 index 451c30f116..f619e4a054 100644 --- a/runtime/doc/vim-da.UTF-8.1 +++ b/runtime/doc/vim-da.UTF-8.1 @@ -321,13 +321,13 @@ NÃ¥r N udelades, sÃ¥ Ã¥bnes én fanebladsside pr. fil. .TP \-R Skrivebeskyttet tilstand. -'readonly'-valgmuligheden sættes. +\&'readonly'-valgmuligheden sættes. Du kan stadig redigere bufferen, men vil være forhindret i fejlagtigt at overskrive en fil. Hvis du vil overskrive en fil, sÃ¥ tilføj et udrÃ¥bstegn til Ex-kommandoen, som i ":w!". \-R-tilvalget indebærer ogsÃ¥ \-n-tilvalget (se ovenfor). -'readonly'-valgmuligheden kan slÃ¥s fra med ":set noro". +\&'readonly'-valgmuligheden kan slÃ¥s fra med ":set noro". Se ":help 'readonly'". .TP \-r diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim index 573a6ba441..1d43521155 100644 --- a/runtime/ftplugin/xml.vim +++ b/runtime/ftplugin/xml.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file -" Language: xml -" Maintainer: Christian Brabandt <cb@256bit.org> -" Last Changed: May 08th, 2018 -" Repository: https://github.com/chrisbra/vim-xml-ftplugin +" Language: xml +" Maintainer: Christian Brabandt <cb@256bit.org> +" Last Changed: Dec 07th, 2018 +" Repository: https://github.com/chrisbra/vim-xml-ftplugin " Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net> " URL: http://dwsharp.users.sourceforge.net/vim/ftplugin diff --git a/runtime/indent/cs.vim b/runtime/indent/cs.vim index 4a040b6fe2..76c12efecf 100644 --- a/runtime/indent/cs.vim +++ b/runtime/indent/cs.vim @@ -1,15 +1,73 @@ " Vim indent file -" Language: C# -" Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: Fri, 15 Mar 2002 07:53:54 CET +" Language: C# +" Maintainer: Nick Jensen <nickspoon@gmail.com> +" Former Maintainers: Aquila Deus +" Johannes Zellner <johannes@zellner.org> +" Last Change: 2018-11-21 +" Filenames: *.cs +" License: Vim (see :h license) +" Repository: https://github.com/nickspoons/vim-cs +" " Only load this indent file when no other was loaded. -if exists("b:did_indent") - finish +if exists('b:did_indent') + finish endif let b:did_indent = 1 -" C# is like indenting C -setlocal cindent +let s:save_cpo = &cpoptions +set cpoptions&vim -let b:undo_indent = "setl cin<" + +setlocal indentexpr=GetCSIndent(v:lnum) + +function! s:IsCompilerDirective(line) + return a:line =~? '^\s*#' +endf + +function! s:IsAttributeLine(line) + return a:line =~? '^\s*\[[A-Za-z]' && a:line =~? '\]$' +endf + +function! s:FindPreviousNonCompilerDirectiveLine(start_lnum) + for delta in range(0, a:start_lnum) + let lnum = a:start_lnum - delta + let line = getline(lnum) + let is_directive = s:IsCompilerDirective(line) + if !is_directive + return lnum + endif + endfor + return 0 +endf + +function! GetCSIndent(lnum) abort + " Hit the start of the file, use zero indent. + if a:lnum == 0 + return 0 + endif + + let this_line = getline(a:lnum) + + " Compiler directives use zero indent if so configured. + let is_first_col_macro = s:IsCompilerDirective(this_line) && stridx(&l:cinkeys, '0#') >= 0 + if is_first_col_macro + return cindent(a:lnum) + endif + + let lnum = s:FindPreviousNonCompilerDirectiveLine(a:lnum - 1) + let previous_code_line = getline(lnum) + if s:IsAttributeLine(previous_code_line) + let ind = indent(lnum) + return ind + else + return cindent(a:lnum) + endif +endfunction + +let b:undo_indent = 'setlocal indentexpr<' + +let &cpoptions = s:save_cpo +unlet s:save_cpo + +" vim:et:sw=2:sts=2 diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index bece6614b8..1a8177050a 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -216,8 +216,9 @@ endfunc "}}} " Add known tag pairs. " Self-closing tags and tags that are sometimes {{{ " self-closing (e.g., <p>) are not here (when encountering </p> we can find -" the matching <p>, but not the other way around). Known self-closing tags: -" 'p', 'img', 'source'. +" the matching <p>, but not the other way around). +" Known self-closing tags: " 'p', 'img', 'source', 'area', 'keygen', 'track', +" 'wbr'. " Old HTML tags: call s:AddITags(s:indent_tags, [ \ 'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', @@ -232,11 +233,11 @@ call s:AddITags(s:indent_tags, [ " New HTML5 elements: call s:AddITags(s:indent_tags, [ - \ 'area', 'article', 'aside', 'audio', 'bdi', 'canvas', - \ 'command', 'data', 'datalist', 'details', 'embed', 'figcaption', - \ 'figure', 'footer', 'header', 'keygen', 'main', 'mark', 'meter', - \ 'nav', 'output', 'picture', 'progress', 'rp', 'rt', 'ruby', 'section', - \ 'summary', 'svg', 'time', 'track', 'video', 'wbr']) + \ 'article', 'aside', 'audio', 'bdi', 'canvas', 'command', 'data', + \ 'datalist', 'details', 'dialog', 'embed', 'figcaption', 'figure', + \ 'footer', 'header', 'hgroup', 'main', 'mark', 'meter', 'nav', 'output', + \ 'picture', 'progress', 'rp', 'rt', 'ruby', 'section', 'summary', + \ 'svg', 'time', 'video']) " Tags added for web components: call s:AddITags(s:indent_tags, [ @@ -934,7 +935,7 @@ func! s:InsideTag(foundHtmlString) let idx = match(text, '<' . s:tagname . '\s\+\zs\w') endif if idx == -1 - " after just <tag indent one level more + " after just "<tag" indent one level more let idx = match(text, '<' . s:tagname . '$') if idx >= 0 call cursor(lnum, idx) diff --git a/runtime/indent/tcl.vim b/runtime/indent/tcl.vim index e9d61e4366..d77081841d 100644 --- a/runtime/indent/tcl.vim +++ b/runtime/indent/tcl.vim @@ -1,7 +1,8 @@ " Vim indent file -" Language: Tcl -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: Tcl +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Update: Chris Heithoff <chrisheithoff@gmail.com> +" Latest Revision: 2018-12-05 if exists("b:did_indent") finish @@ -28,6 +29,15 @@ function s:prevnonblanknoncomment(lnum) return lnum endfunction +function s:ends_with_backslash(lnum) + let line = getline(a:lnum) + if line =~ '\\\s*$' + return 1 + else + return 0 + endif +endfunction + function s:count_braces(lnum, count_open) let n_open = 0 let n_close = 0 @@ -53,23 +63,39 @@ endfunction function GetTclIndent() let line = getline(v:lnum) - if line =~ '^\s*\*' - return cindent(v:lnum) - elseif line =~ '^\s*}' - return indent(v:lnum) - shiftwidth() - endif + " Get the line number of the previous non-blank or non-comment line. let pnum = s:prevnonblanknoncomment(v:lnum - 1) if pnum == 0 return 0 endif - let ind = indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() + " ..and the previous line before the previous line. + let pnum2 = s:prevnonblanknoncomment(pnum-1) - let pline = getline(pnum) - if pline =~ '}\s*$' - let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * shiftwidth() + " Default indentation is to preserve the previous indentation. + let ind = indent(pnum) + + " ...but if previous line introduces an open brace, then increase current line's indentation + if s:count_braces(pnum, 1) > 0 + let ind += shiftwidth() + else + " Look for backslash line continuation on the previous two lines. + let slash1 = s:ends_with_backslash(pnum) + let slash2 = s:ends_with_backslash(pnum2) + if slash1 && !slash2 + " If the previous line begins a line continuation. + let ind += shiftwidth() + elseif !slash1 && slash2 + " If two lines ago was the end of a line continuation group of lines. + let ind -= shiftwidth() + endif endif + " If the current line begins with a closed brace, then decrease the indentation by one. + if line =~ '^\s*}' + let ind -= shiftwidth() + endif + return ind endfunction diff --git a/runtime/indent/testdir/html.in b/runtime/indent/testdir/html.in new file mode 100644 index 0000000000..9c776d61c6 --- /dev/null +++ b/runtime/indent/testdir/html.in @@ -0,0 +1,26 @@ +" vim: set ft=html sw=4 : + + +" START_INDENT +<div> +<div> +text +</div> +</div> + +<div +class="foo bar"> +text +</div> + +<div class="foo bar" +data="something"> +text +</div> + +<div class="foo +bar"> +text +</div> + +" END_INDENT diff --git a/runtime/indent/testdir/html.ok b/runtime/indent/testdir/html.ok new file mode 100644 index 0000000000..524d57bb6c --- /dev/null +++ b/runtime/indent/testdir/html.ok @@ -0,0 +1,26 @@ +" vim: set ft=html sw=4 : + + +" START_INDENT +<div> + <div> + text + </div> +</div> + +<div + class="foo bar"> + text +</div> + +<div class="foo bar" + data="something"> + text +</div> + +<div class="foo + bar"> + text +</div> + +" END_INDENT diff --git a/runtime/indent/testdir/tcl.in b/runtime/indent/testdir/tcl.in new file mode 100644 index 0000000000..3ef4ebc0a8 --- /dev/null +++ b/runtime/indent/testdir/tcl.in @@ -0,0 +1,19 @@ +# vim: set filetype=tcl shiftwidth=4 tabstop=4: + +# START_INDENT +proc abc {} { +set a 5 +if {[some_cmd]==1} { +foreach i [list {1 2 3}] { +# Does this comment affect anything? +puts $i +} +} +} + +command_with_a_long_time -arg1 "First" \ +-arg2 "Second" \ +-arg3 "Third" + +puts "Move indent back after line continuation is complete" +# END_INDENT
\ No newline at end of file diff --git a/runtime/indent/testdir/tcl.ok b/runtime/indent/testdir/tcl.ok new file mode 100644 index 0000000000..0fb52e782f --- /dev/null +++ b/runtime/indent/testdir/tcl.ok @@ -0,0 +1,19 @@ +# vim: set filetype=tcl shiftwidth=4 tabstop=4: + +# START_INDENT +proc abc {} { + set a 5 + if {[some_cmd]==1} { + foreach i [list {1 2 3}] { + # Does this comment affect anything? + puts $i + } + } +} + +command_with_a_long_time -arg1 "First" \ + -arg2 "Second" \ + -arg3 "Third" + +puts "Move indent back after line continuation is complete" +# END_INDENT diff --git a/runtime/indent/testdir/xml.in b/runtime/indent/testdir/xml.in new file mode 100644 index 0000000000..d184681c86 --- /dev/null +++ b/runtime/indent/testdir/xml.in @@ -0,0 +1,32 @@ +<!-- vim: set ft=xml ts=2 sw=0 sts=-1 et : --> +<!-- START_INDENT --> +<?xml version="1.0" encoding="utf-8"?> +<tag0> + <tag1> +<!-- comment --> +<tag2> + <tag3/> +</tag2> +<!-- text comment --> + +<!-- +text comment +--> +</tag1> +<!-- +text comment +end coment --> +</tag0> +<!-- END_INDENT --> + +<!-- START_INDENT --> +<?xml version="1.0" encoding="utf-8"?> +<tag0> + <tag1> +<!-- comment --> +<tag2> + <tag3/> +</tag2> +</tag1> +</tag0> +<!-- END_INDENT --> diff --git a/runtime/indent/testdir/xml.ok b/runtime/indent/testdir/xml.ok new file mode 100644 index 0000000000..a8e2c92a16 --- /dev/null +++ b/runtime/indent/testdir/xml.ok @@ -0,0 +1,32 @@ +<!-- vim: set ft=xml ts=2 sw=0 sts=-1 et : --> +<!-- START_INDENT --> +<?xml version="1.0" encoding="utf-8"?> +<tag0> + <tag1> + <!-- comment --> + <tag2> + <tag3/> + </tag2> + <!-- text comment --> + + <!-- + text comment + --> + </tag1> + <!-- + text comment + end coment --> +</tag0> +<!-- END_INDENT --> + +<!-- START_INDENT --> +<?xml version="1.0" encoding="utf-8"?> +<tag0> + <tag1> + <!-- comment --> + <tag2> + <tag3/> + </tag2> + </tag1> +</tag0> +<!-- END_INDENT --> diff --git a/runtime/mswin.vim b/runtime/mswin.vim index 5ec21491fe..2b04c1aea3 100644 --- a/runtime/mswin.vim +++ b/runtime/mswin.vim @@ -1,9 +1,9 @@ " Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2017 Oct 28 +" Last Change: 2018 Dec 07 -" bail out if this isn't wanted (mrsvim.vim uses this). +" Bail out if this isn't wanted. if exists("g:skip_loading_mswin") && g:skip_loading_mswin finish endif diff --git a/runtime/syntax/apache.vim b/runtime/syntax/apache.vim index e2315db0d7..71babfba36 100644 --- a/runtime/syntax/apache.vim +++ b/runtime/syntax/apache.vim @@ -3,7 +3,7 @@ " Maintainer: David Necas (Yeti) <yeti@physics.muni.cz> " License: This file can be redistribued and/or modified under the same terms " as Vim itself. -" Last Change: 2014-03-04 +" Last Change: 2018-12-06 " Notes: Last synced with apache-2.2.3, version 1.x is no longer supported " TODO: see particular FIXME's scattered through the file " make it really linewise? @@ -159,7 +159,7 @@ syn keyword apacheOption inherit syn keyword apacheDeclaration BrowserMatch BrowserMatchNoCase SetEnvIf SetEnvIfNoCase syn keyword apacheDeclaration LoadFile LoadModule syn keyword apacheDeclaration CheckSpelling CheckCaseOnly -syn keyword apacheDeclarat |