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/autocmd.txt b/runtime/doc/autocmd.txt index 47afc4bd21..e37fe9e5ce 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -597,7 +597,7 @@ CompleteChanged *CompleteChanged* recursively. Sets these |v:event| keys: - completed_item + completed_item See |complete-items|. height nr of items visible width screen cells row top screen row @@ -648,6 +648,7 @@ CursorMoved After the cursor was moved in Normal or Visual Not triggered when there is typeahead or when an operator is pending. For an example see |match-parens|. + Note: Cannot be skipped with `:noautocmd`. Careful: This is triggered very often, don't do anything that the user does not expect or that is slow. @@ -1050,6 +1051,8 @@ TextChanged After a change was made to the text in the was defined). Not triggered when there is typeahead or when an operator is pending. + Note: This can not be skipped with + `:noautocmd`. Careful: This is triggered very often, don't do anything that the user does not expect or that is slow. @@ -1474,8 +1477,8 @@ If you want the buffer to be unmodified after changing it, reset the instead of ":q!". *autocmd-nested* *E218* -By default, autocommands do not nest. If you use ":e" or ":w" in an -autocommand, Vim does not execute the BufRead and BufWrite autocommands for +By default, autocommands do not nest. For example, if you use ":e" or ":w" in +an autocommand, Vim does not execute the BufRead and BufWrite autocommands for those commands. If you do want this, use the "++nested" flag for those commands in which you want nesting. For example: > :autocmd FileChangedShell *.c ++nested e! @@ -1621,5 +1624,8 @@ following command. Example: > This will write the file without triggering the autocommands defined by the gzip plugin. +Note that some autocommands are not triggered right away, but only later. +This specifically applies to |CursorMoved| and |TextChanged|. + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index ee70e95ab2..2259eddb6a 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -600,11 +600,11 @@ Directory for temporary files is created in the first suitable directory of: For the {pattern} see |pattern|. {string} can be a literal string, or something special; see |sub-replace-special|. - *E939* When [range] and [count] are omitted, replace in the current line only. When [count] is given, replace in [count] lines, starting with the last line in [range]. When [range] is omitted start in the current line. + *E939* [count] must be a positive number. Also see |cmdline-ranges|. diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index 953a65f125..b106e625f2 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -50,6 +50,10 @@ conversion to be available, it might fail. For the NUL character you will see "10". That's because NUL characters are internally represented with a NL character. When you write the file it will become a NUL character. +Example: > + digraph oe 339 +This defines the "oe" digraph for a character that is number 339 in Unicode. + ============================================================================== 2. Using digraphs *digraphs-use* diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 1a5268faf3..57ef380cc5 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2245,6 +2245,7 @@ py3eval({expr}) any evaluate |python3| expression pyxeval({expr}) any evaluate |python_x| expression range({expr} [, {max} [, {stride}]]) List items from {expr} to {max} +readdir({dir} [, {expr}]) List file names in {dir} selected by {expr} readfile({fname} [, {binary} [, {max}]]) List get list of lines from file {fname} reg_executing() Number get the executing register name @@ -2576,9 +2577,9 @@ assert_false({actual} [, {msg}]) *assert_false()* "Expected False but got {actual}" is produced. assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()* - This asserts number values. When {actual} is lower than - {lower} or higher than {upper} an error message is added to - |v:errors|. + This asserts number and |Float| values. When {actual} is lower + than {lower} or higher than {upper} an error message is added + to |v:errors|. Also see |assert-return|. When {msg} is omitted an error in the form "Expected range {lower} - {upper}, but got {actual}" is produced. @@ -3009,7 +3010,7 @@ complete_info([{what}]) completion. See |ins-completion|. The items are: mode Current completion mode name string. - See |completion_info_mode| for the values. + See |complete_info_mode| for the values. pum_visible |TRUE| if popup menu is visible. See |pumvisible()|. items List of completion matches. Each item is a @@ -4631,7 +4632,7 @@ gettabinfo([{arg}]) *gettabinfo()* tabnr tab page number. variables a reference to the dictionary with tabpage-local variables - windows List of |window-ID|s in the tag page. + windows List of |window-ID|s in the tab page. gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* Get the value of a tab-local variable {varname} in tab page @@ -4769,6 +4770,9 @@ glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* If the expansion fails, the result is an empty String or List. + You can also use |readdir()| if you need to do complicated + things, such as limiting the number of matches. + A name for a non-existing file is not included. A symbolic link is only included if it points to an existing file. However, when the {alllinks} argument is present and it is @@ -6341,8 +6345,7 @@ printf({fmt}, {expr1} ...) *printf()* *printf-S* S The text of the String argument is used. If a precision is specified, no more display cells than the - number specified are used. Without the |+multi_byte| - feature works just like 's'. + number specified are used. *printf-f* *E807* f F The Float argument is converted into a string of the @@ -6474,6 +6477,17 @@ readfile({fname} [, {binary} [, {max}]]) the result is an empty list. Also see |writefile()|. + *readdir()* +readdir({directory} [, {expr}]) + Return a list with file and directory names in {directory}. + You can also use |glob()| if you don't need to do complicated + things, such as limiting the number of matches. + + When {expr} is omitted all entries are included. + When {expr} is given, it is evaluated to check what to do: + If {expr} results in -1 then no further entries will + be handled. + reg_executing() *reg_executing()* Returns the single letter name of the register being executed. Returns an empty string when no register is being executed. @@ -7990,10 +8004,10 @@ strcharpart({src}, {start} [, {len}]) *strcharpart()* strdisplaywidth({expr} [, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells - String {expr} occupies on the screen when it starts at {col}. - When {col} is omitted zero is used. Otherwise it is the - screen column where to start. This matters for Tab - characters. + String {expr} occupies on the screen when it starts at {col} + (first column is zero). When {col} is omitted zero is used. + Otherwise it is the screen column where to start. This + matters for Tab characters. The option settings of the current window are used. This matters for anything that's displayed differently, such as 'tabstop' and 'display'. diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index a4a5d6188b..ad834e1f6c 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -599,6 +599,15 @@ your |vimrc|: > let rrst_dynamic_comments = 0 +RESTRUCTUREDTEXT *ft-rst-plugin* + +The following formatting setting are optionally available: > + setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8 + +To enable this behavior, set the following variable in your vimrc: > + let g:rst_style = 1 + + RPM SPEC *ft-spec-plugin* Since the text for this plugin is rather long it has been put in a separate diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 721aa93442..e69497e1ab 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -944,6 +944,11 @@ can sometimes be slow, thus it timeouts after 150 msec. If you notice the indenting isn't correct, you can set a larger timeout in msec: > let g:pyindent_searchpair_timeout = 500 +If looking back for unclosed parenthesis is still too slow, especially during +a copy-paste operation, or if you don't need indenting inside multi-line +parentheses, you can completely disable this feature: > + let g:pyindent_disable_parentheses_indenting = 1 + R *ft-r-indent* diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 03523042c6..da48f7f84d 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -155,6 +155,20 @@ commands in CTRL-X submode *i_CTRL-X_index* |i_CTRL-X_s| CTRL-X s spelling suggestions {not available when compiled without the |+insert_expand| feature} +commands in completion mode (see |popupmenu-keys|) + +|complete_CTRL-E| CTRL-E stop completion and go back to original text +|complete_CTRL-Y| CTRL-Y accept selected match and stop completion + CTRL-L insert one character from the current match + insert currently selected match + delete one character and redo search + CTRL-H same as + select the previous match + select the next match + select a match several entries back + select a match several entries forward + other stop completion and insert the typed character + ============================================================================== 2. Normal mode *normal-index* @@ -555,6 +569,8 @@ tag command action in Normal mode ~ |CTRL-W_gF| CTRL-W g F edit file name under the cursor in a new tab page and jump to the line number following the file name. +|CTRL-W_gt| CTRL-W g t same as `gt`: go to next tab page +|CTRL-W_gT| CTRL-W g T same as `gT`: go to previous tab page |CTRL-W_h| CTRL-W h go to Nth left window (stop at first window) |CTRL-W_i| CTRL-W i split window and jump to declaration of identifier under the cursor @@ -839,6 +855,17 @@ tag char note action in Normal mode ~ |z| z same as "zh" |z| z same as "zl" +============================================================================== +2.6 Operator-pending mode *operator-pending-index* + +These can be used after an operator, but before a {motion} has been entered. + +tag char action in Operator-pending mode ~ +----------------------------------------------------------------------- +|o_v| v force operator to work characterwise +|o_V| V force operator to work linewise +|o_CTRL-V| CTRL-V force operator to work blockwise + ============================================================================== 3. Visual mode *visual-index* @@ -961,7 +988,7 @@ Normal characters are inserted at the current cursor position. "Completion" below refers to context-sensitive completion. It will complete file names, tags, commands etc. as appropriate. -tag command action in Command-line editing mode ~ +tag command action in Command-line editing mode ~ ------------------------------------------------------------------------------ CTRL-@ not used |c_CTRL-A| CTRL-A do completion on the pattern in front of the @@ -1001,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) @@ -1060,7 +1088,7 @@ This is a brief but complete listing of all the ":" commands, without mentioning any arguments. The optional part of the command name is inside []. The commands are sorted on the non-optional part of their name. -tag command action ~ +tag command action ~ ------------------------------------------------------------------------------ |:!| :! filter lines or execute an external command |:!!| :!! repeat last ":!" command @@ -1468,7 +1496,8 @@ tag command action ~ |:sbrewind| :sbr[ewind] split window and go to first file in the buffer list |:scriptnames| :scr[iptnames] list names of all sourced Vim scripts -|:scriptencoding| :scripte[ncoding] encoding used in sourced Vim script +|:scriptencoding| :scripte[ncoding] encoding used in sourced Vim script +|:scriptversion| :scriptv[ersion] version of Vim script used |:scscope| :scs[cope] split window and execute cscope command |:set| :se[t] show or set options |:setfiletype| :setf[iletype] set 'filetype', unless it was set already diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index dccf39b3df..864eea8f7f 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -670,11 +670,13 @@ being disabled. Remove the 'C' flag from the 'cpoptions' option to enable it. This happens when an Ex command with mandatory argument(s) was executed, but no argument has been specified. - *E474* *E475* > + *E474* *E475* *E983* > Invalid argument Invalid argument: {arg} + Duplicate argument: {arg} -An Ex command has been executed, but an invalid argument has been specified. +An Ex command or function has been executed, but an invalid argument has been +specified. *E488* > Trailing characters diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 461fefe903..818bbf9eb7 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -310,7 +310,7 @@ _ [count] - 1 lines downward, on the first non-blank G Goto line [count], default last line, on the first non-blank character |linewise|. If 'startofline' not set, keep the same column. - G is a one of |jump-motions|. + G is one of the |jump-motions|. ** Goto line [count], default last line, on the last @@ -989,7 +989,7 @@ These commands are not marks themselves, but jump to a mark: A "jump" is a command that normally moves the cursor several lines away. If you make the cursor "jump" the position of the cursor before the jump is -remembered. You can return to that position with the "''" and "``" command, +remembered. You can return to that position with the "''" and "``" commands, unless the line containing that position was changed or deleted. The following commands are "jump" commands: "'", "`", "G", "/", "?", "n", "N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag", "L", "M", "H" and the diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index d0ead3c256..a206bec44e 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -324,9 +324,9 @@ Setting the filetype 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. + 'filetype'. This is to be 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* @@ -1810,7 +1810,16 @@ 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) @@ -1880,6 +1889,9 @@ A jump table for the options with a short description can be found at |Q_op|. context:{n} Use a context of {n} lines between a change and a fold that contains unchanged lines. When omitted a context of six lines is used. + When using zero the context is actually one, + since folds require a line in between, also + for a deleted line. See |fold-diff|. iblank Ignore changes where lines are all blank. Adds @@ -5331,7 +5343,8 @@ A jump table for the options with a short description can be found at |Q_op|. O message for reading a file overwrites any previous message. Also for quickfix message (e.g., ":cn"). s don't give "search hit BOTTOM, continuing at TOP" or "search - hit TOP, continuing at BOTTOM" messages + hit TOP, continuing at BOTTOM" messages; when using the search + count do not show "W" after the count message (see S below) t truncate file message at the start if it is too long to fit on the command-line, "<" will appear in the left most column. Ignored in Ex mode. @@ -5603,7 +5616,8 @@ A jump table for the options with a short description can be found at |Q_op|. set spelllang=en_us,nl,medical < This means US English, Dutch and medical words are recognized. Words that are not recognized will be highlighted. - The word list name must not include a comma or dot. Using a dash is + The word list name must consist of alphanumeric characters, a dash or + an underscore. It should not include a comma or dot. Using a dash is recommended to separate the two letter language name from a specification. Thus "en-rare" is used for rare English words. A region name must come last and have the form "_xx", where "xx" is @@ -5971,7 +5985,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/pattern.txt b/runtime/doc/pattern.txt index 5d2c0e97b8..7f6a74e3f6 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1125,7 +1125,7 @@ x A single character, with no special meaning, matches itself The "Func" column shows what library function is used. The implementation depends on the system. Otherwise: (1) Uses islower() for ASCII and Vim builtin rules for other - characters when built with the |+multi_byte| feature. + characters. (2) Uses Vim builtin rules (3) As with (1) but using isupper() */[[=* *[==]* @@ -1201,7 +1201,7 @@ x A single character, with no special meaning, matches itself \%u20AC Matches the character specified with up to four hexadecimal characters. \%U1234abcd Matches the character specified with up to eight hexadecimal - characters. + characters, up to 0x7fffffff ============================================================================== 7. Ignoring case in a pattern */ignorecase* diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index a0e071d4dd..95726324ef 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -3433,7 +3433,7 @@ Example: Clear netrw's marked file list via a mapping on gu > - Click "Add..." - Set External Editor (adjust path as needed, include the quotes and !.! at the end): - "c:\Program Files\Vim\vim70\gvim.exe" !.! + "c:\Program Files\Vim\vim81\gvim.exe" !.! - Check that the filetype in the box below is {asterisk}.{asterisk} (all files), or whatever types you want (cec: change {asterisk} to * ; I had to @@ -3683,8 +3683,8 @@ by obtaining a copy of the latest (often developmental) netrw at: The script is typically installed on systems as something like: > - /usr/local/share/vim/vim7x/plugin/netrwPlugin.vim - /usr/local/share/vim/vim7x/autoload/netrw.vim + /usr/local/share/vim/vim8x/plugin/netrwPlugin.vim + /usr/local/share/vim/vim8x/autoload/netrw.vim (see output of :echo &rtp) < which is loaded automatically at startup (assuming :set nocp). If you diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index 084ad4e521..b6d781c1ca 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -99,10 +99,9 @@ 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 -a character encoding file then it will use the "latin1" print character -encoding file. +'encoding' (if 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 characters to the printing encoding for printing (if 'printencoding' is empty @@ -238,9 +237,9 @@ possible. The following tables show the valid combinations: Japanese JIS_C_1978 x x JIS_X_1983 x x JIS_X_1990 x x x - MSWINDOWS x - KANJITALK6 x - KANJITALK7 x + MSWINDOWS x + KANJITALK6 x + KANJITALK7 x euc-kr cp949 ucs-2 utf-8 ~ Korean KS_X_1992 x diff --git a/runtime/doc/russian.txt b/runtime/doc/russian.txt index 724c4f9454..776630a52b 100644 --- a/runtime/doc/russian.txt +++ b/runtime/doc/russian.txt @@ -52,8 +52,7 @@ automatic installs. Vim also needs to be compiled with |+gettext| feature for user interface items translations to work. After downloading an archive from RuVim project, unpack it into your -$VIMRUNTIME directory. We recommend using UTF-8 archive, if your version of -Vim is compiled with |+multi_byte| feature enabled. +$VIMRUNTIME directory. We recommend using UTF-8 archive. In order to use the Russian documentation, make sure you have set the 'helplang' option to "ru". diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 67917d9617..955861bd2d 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -298,25 +298,25 @@ Exceptions: spell file is used. For example, with these values: - 'runtimepath' is "~/.config/nvim,/usr/share/vim70,~/.config/nvim/after" + 'runtimepath' is "~/.config/nvim,/usr/local/share/nvim/runtime/,~/.config/nvim/after" 'encoding' is "iso-8859-2" 'spelllang' is "pl" Vim will look for: 1. ~/.config/nvim/spell/pl.iso-8859-2.spl -2. /usr/share/vim70/spell/pl.iso-8859-2.spl +2. /usr/local/share/nvim/runtime/spell/pl.iso-8859-2.spl 3. ~/.config/nvim/spell/pl.iso-8859-2.add.spl -4. /usr/share/vim70/spell/pl.iso-8859-2.add.spl +4. /usr/local/share/nvim/runtime/spell/pl.iso-8859-2.add.spl 5. ~/.config/nvim/after/spell/pl.iso-8859-2.add.spl This assumes 1. is not found and 2. is found. If 'encoding' is "latin1" Vim will look for: 1. ~/.config/nvim/spell/pl.latin1.spl -2. /usr/share/vim70/spell/pl.latin1.spl +2. /usr/local/share/nvim/runtime/spell/pl.latin1.spl 3. ~/.config/nvim/after/spell/pl.latin1.spl 4. ~/.config/nvim/spell/pl.ascii.spl -5. /usr/share/vim70/spell/pl.ascii.spl +5. /usr/local/share/nvim/runtime/spell/pl.ascii.spl 6. ~/.config/nvim/after/spell/pl.ascii.spl This assumes none of them are found (Polish doesn't make sense when leaving diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index f63535af11..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 @@ -572,8 +571,7 @@ ignored. (Case is ignored when 'ignorecase' is set and 'tagcase' is The value '2' should be used then: !_TAG_FILE_SORTED2{anything} ~ -The other tag that Vim recognizes, but only when compiled with the -|+multi_byte| feature, is the encoding of the tags file: +The other tag that Vim recognizes is the encoding of the tags file: !_TAG_FILE_ENCODINGutf-8{anything} ~ Here "utf-8" is the encoding used for the tags. Vim will then convert the tag being searched for from 'encoding' to the encoding of the tags file. And when diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index d85be4ccae..e21481af17 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -192,7 +192,7 @@ typing commands at the command-line. \ | wincmd p | diffthis This adds the ":DiffOrig" command. Use this in a modified buffer to see the -differences with the file it was loaded from. See |diff|. +differences with the file it was loaded from. See |diff| and |:DiffOrig|. > set nolangremap diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 2c38c6fef2..a80ab963b1 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -770,6 +770,7 @@ System functions and manipulation of files: systemlist() get the result of a shell command as a list hostname() name of the system readfile() read a file into a List of lines + readdir() get a List of file names in a directory writefile() write a List of lines or Blob into a file Date and Time: *date-functions* *time-functions* diff --git a/runtime/doc/usr_45.txt b/runtime/doc/usr_45.txt index be33f0be6d..1ce6969d37 100644 --- a/runtime/doc/usr_45.txt +++ b/runtime/doc/usr_45.txt @@ -152,12 +152,6 @@ language than the text. language, the default should work fine and you don't need to do anything. The following is only relevant when you want to edit different languages. - Note: - Using different encodings only works when Vim was compiled to handle - it. To find out if it works, use the ":version" command and check the - output for "+multi_byte". If it's there, you are OK. If you see - "-multi_byte" you will have to find another Vim. - USING UNICODE IN THE GUI diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index d908f484c6..beecca2480 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -179,6 +179,12 @@ Command-line editing and history. |cmdline-editing| forward/backward one character. The shifted right/left cursor keys can be used to move forward/backward one word. CTRL-B/CTRL-E can be used to go to the begin/end of the command-line. + {Vi: can only alter the last character in the line} + {Vi: when hitting the command-line is executed. This is + unexpected for most people; therefore it was changed in Vim. But when + the is part of a mapping, the command-line is executed. If you + want the Vi behaviour also when typing , use ":cmap ^V + ^V^M"} |cmdline-history| The command-lines are remembered. The up/down cursor keys can be used to recall previous command-lines. The 'history' option can be set to diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index 252a1ca8b8..2062696a4e 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -103,6 +103,8 @@ gn Search forward for the last used search pattern, like E.g., "dgn" deletes the text of the next match. If Visual mode is active, extends the selection until the end of the next match. + Note: Unlike `n` the search direction does not depend + on the previous search command. *gN* *v_gN* gN Like |gn| but searches backward, like with `N`. diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index ac9e1f48fe..b93945a340 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -807,6 +807,12 @@ CTRL-W gF *CTRL-W_gF* {not available when the |+file_in_path| feature was disabled at compile time} +CTRL-W gt *CTRL-W_gt* + Go to next tab page, same as `gt`. + +CTRL-W gT *CTRL-W_gT* + Go to previous tab page, same as `gT`. + Also see |CTRL-W_CTRL-I|: open window for an included file that includes the keyword under the cursor. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 9c92023e93..6504f610a0 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 Jan 28 +" Last Change: 2019 May 06 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -42,6 +42,8 @@ endif " Function used for patterns that end in a star: don't set the filetype if the " file name matches ft_ignore_pat. +" When using this, the entry should probably be further down below with the +" other StarSetf() calls. func! s:StarSetf(ft) if expand("") !~ g:ft_ignore_pat exe 'setf ' . a:ft @@ -54,6 +56,9 @@ au BufNewFile,BufRead $VIMRUNTIME/doc/*.txt setf help " Abaqus or Trasys au BufNewFile,BufRead *.inp call dist#ft#Check_inp() +" 8th (Firth-derivative) +au BufNewFile,BufRead *.8th setf 8th + " A-A-P recipe au BufNewFile,BufRead *.aap setf aap @@ -88,9 +93,6 @@ au BufNewFile,BufRead build.xml setf ant " Arduino au BufNewFile,BufRead *.ino,*.pde setf arduino -" Apache style config file -au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle') - " Apache config file au BufNewFile,BufRead .htaccess,*/etc/httpd/*.conf setf apache au BufNewFile,BufRead */etc/apache2/sites-*/*.com setf apache @@ -648,7 +650,6 @@ au BufNewFile,BufRead gnashrc,.gnashrc,gnashpluginrc,.gnashpluginrc setf gnash " Gitolite au BufNewFile,BufRead gitolite.conf setf gitolite -au BufNewFile,BufRead */gitolite-admin/conf/* call s:StarSetf('gitolite') au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl " Gnuplot scripts @@ -797,7 +798,6 @@ au BufNewFile,BufRead *.jsp setf jsp " Java Properties resource file (note: doesn't catch font.properties.pl) au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties -au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties') " Jess au BufNewFile,BufRead *.clp setf jess @@ -1455,7 +1455,6 @@ au BufNewFile,BufRead *.decl,*.dcl,*.dec " SGML catalog file au BufNewFile,BufRead catalog setf catalog -au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. " Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts @@ -1610,6 +1609,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 @@ -1738,7 +1741,6 @@ au BufNewFile,BufRead *.sv,*.svh setf systemverilog " VHDL au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl -au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl') " Vim script au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim @@ -1951,6 +1953,7 @@ au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif " More Apache style config files au BufNewFile,BufRead */etc/proftpd/*.conf*,*/etc/proftpd/conf.*/* call s:StarSetf('apachestyle') +au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle') " More Apache config files au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache') @@ -2007,6 +2010,12 @@ au BufNewFile,BufRead *fvwm2rc* " Gedcom au BufNewFile,BufRead */tmp/lltmp* call s:StarSetf('gedcom') +" Git +au BufNewFile,BufRead */.gitconfig.d/*,/etc/gitconfig.d/* call s:StarSetf('gitconfig') + +" Gitolite +au BufNewFile,BufRead */gitolite-admin/conf/* call s:StarSetf('gitolite') + " GTK RC au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc') @@ -2019,6 +2028,9 @@ au! BufNewFile,BufRead *jarg* \| call s:StarSetf('jargon') \|endif +" Java Properties resource file (note: doesn't catch font.properties.pl) +au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties') + " Kconfig au BufNewFile,BufRead Kconfig.* call s:StarSetf('kconfig') @@ -2080,6 +2092,9 @@ au BufRead,BufNewFile *.rdf call dist#ft#Redif() " Remind au BufNewFile,BufRead .reminders* call s:StarSetf('remind') +" SGML catalog file +au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') + " Shell scripts ending in a star au BufNewFile,BufRead .bashrc*,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,bash-fc[-.]*,,PKGBUILD* call dist#ft#SetFileTypeSH("bash") au BufNewFile,BufRead .kshrc* call dist#ft#SetFileTypeSH("ksh") @@ -2091,6 +2106,9 @@ au BufNewFile,BufRead .tcshrc* call dist#ft#SetFileTypeShell("tcsh") " csh scripts ending in a star au BufNewFile,BufRead .login*,.cshrc* call dist#ft#CSH() +" VHDL +au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl') + " Vim script au BufNewFile,BufRead *vimrc* call s:StarSetf('vim') diff --git a/runtime/ftplugin/8th.vim b/runtime/ftplugin/8th.vim new file mode 100644 index 0000000000..14301187d6 --- /dev/null +++ b/runtime/ftplugin/8th.vim @@ -0,0 +1,25 @@ +" Vim ftplugin file +" Language: 8th +" Version: any +" Last Change: 2015/11/08 +" Maintainer: Ron Aaron +" URL: https://8th-dev.com/ +" Filetypes: *.8th +" NOTE: 8th allows any non-whitespace in a name, so you need to do: +" setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 +" This goes with the syntax/8th.vim file. + +" Only do this when not done yet for this buffer +if exists("b:did_8thplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_8thplugin = 1 + +setlocal ts=2 sts=2 sw=2 et +setlocal com=s1:/*,mb:*,ex:*/,:\|,:\\ +setlocal fo=tcrqol +setlocal matchpairs+=\::; +setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 +setlocal suffixesadd=.8th 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/dosbatch.vim b/runtime/ftplugin/dosbatch.vim index dbc02d80f8..070bdc4ba2 100644 --- a/runtime/ftplugin/dosbatch.vim +++ b/runtime/ftplugin/dosbatch.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: MS-DOS .bat files " Maintainer: Mike Williams -" Last Change: 8th May 2012 +" Last Change: 14th April 2019 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -16,6 +16,7 @@ set cpo&vim " BAT comment formatting setlocal comments=b:rem,b:@rem,b:REM,b:@REM,::: +setlocal commentstring=::\ %s setlocal formatoptions-=t formatoptions+=rol " Define patterns for the browse file filter diff --git a/runtime/ftplugin/make.vim b/runtime/ftplugin/make.vim index fb180c0e5f..bfa8703082 100644 --- a/runtime/ftplugin/make.vim +++ b/runtime/ftplugin/make.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Make " Maintainer: Bram Moolenaar -" Last Change: 2013 Apr 22 +" Last Change: 2019 Apr 02 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -27,7 +27,7 @@ setlocal commentstring=#\ %s " Including files. let &l:include = '^\s*include' -" For matchit.vim, suggested by Albert Netymk. +" For matchit.vim, suggested by Albert Netymk and Ken Takata. if exists("loaded_matchit") - let b:match_words = '\:\:\,\:\' + let b:match_words = '^ *ifn\=\(eq\|def\)\>:^ *else\(\s\+ifn\=\(eq\|def\)\)\=\>:^ *endif\>,\:\,^!\s*if\(n\=def\)\=\>:^!\s*else\(if\(n\=def\)\=\)\=\>:^!\s*endif\>' endif diff --git a/runtime/ftplugin/nroff.vim b/runtime/ftplugin/nroff.vim new file mode 100644 index 0000000000..069c02e59a --- /dev/null +++ b/runtime/ftplugin/nroff.vim @@ -0,0 +1,11 @@ +" Vim filetype plugin +" Language: roff(7) +" Maintainer: Chris Spiegel +" Last Change: 2019 Apr 24 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=.\\\"%s diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim index e0d7efe997..d9336421cf 100644 --- a/runtime/ftplugin/ocaml.vim +++ b/runtime/ftplugin/ocaml.vim @@ -392,8 +392,8 @@ endfunction endfun " This variable contain a dictionnary of list. Each element of the dictionnary - " represent an annotation system. An annotation system is a list with : - " - annotation file name as it's key + " represent an annotation system. An annotation system is a list with: + " - annotation file name as its key " - annotation file path as first element of the contained list " - build path as second element of the contained list " - annot_file_last_mod (contain the date of .annot file) as third element 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/ftplugin/rst.vim b/runtime/ftplugin/rst.vim index 8ab56b052a..f0646e9f36 100644 --- a/runtime/ftplugin/rst.vim +++ b/runtime/ftplugin/rst.vim @@ -30,7 +30,7 @@ setlocal formatoptions+=tcroql " " More sophisticated indentation rules should be revisted in the future. -if !exists("g:rst_style") || g:rst_style != 0 +if exists("g:rst_style") && g:rst_style != 0 setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8 endif diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index 4d6fcd9564..1c02a98c7c 100644 --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -400,7 +400,7 @@ endif " Predefined SQL objects what are used by the below mappings using " the ]} style maps. -" This global variable allows the users to override it's value +" This global variable allows the users to override its value " from within their vimrc. " Note, you cannot use \?, since these patterns can be used to search " backwards, you must use \{,1} @@ -486,10 +486,10 @@ if exists('&omnifunc') " OMNI function prior to setting up the SQL OMNI function let b:sql_compl_savefunc = &omnifunc - " Source it to determine it's version + " Source it to determine its version runtime autoload/sqlcomplete.vim " This is used by the sqlcomplete.vim plugin - " Source it for it's global functions + " Source it for its global functions runtime autoload/syntaxcomplete.vim setlocal omnifunc=sqlcomplete#Complete diff --git a/runtime/indent/awk.vim b/runtime/indent/awk.vim index aad73ee71f..e65331977c 100644 --- a/runtime/indent/awk.vim +++ b/runtime/indent/awk.vim @@ -47,7 +47,7 @@ endif function! GetAwkIndent() - " Find previous line and get it's indentation + " Find previous line and get its indentation let prev_lineno = s:Get_prev_line( v:lnum ) if prev_lineno == 0 return 0 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/mma.vim b/runtime/indent/mma.vim index 8298ad98cd..a76fa8ede0 100644 --- a/runtime/indent/mma.vim +++ b/runtime/indent/mma.vim @@ -57,7 +57,7 @@ function GetMmaIndent() if getline(v:lnum) =~ '[^[]*]\s*$' " move to the closing bracket call search(']','bW') - " and find it's partner's indent + " and find its partner's indent let ind = indent(searchpair('\[','',']','bWn')) " same for ( blocks elseif getline(v:lnum) =~ '[^(]*)$' diff --git a/runtime/indent/python.vim b/runtime/indent/python.vim index 7ab3cb9f50..e53987a0de 100644 --- a/runtime/indent/python.vim +++ b/runtime/indent/python.vim @@ -2,7 +2,7 @@ " Language: Python " Maintainer: Bram Moolenaar " Original Author: David Bustos -" Last Change: 2013 Jul 9 +" Last Change: 2019 Feb 21 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -53,58 +53,68 @@ function GetPythonIndent(lnum) return 0 endif - " searchpair() can be slow sometimes, limit the time to 100 msec or what is - " put in g:pyindent_searchpair_timeout - let searchpair_stopline = 0 - let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150) - - " If the previous line is inside parenthesis, use the indent of the starting - " line. - " Trick: use the non-existing "dummy" variable to break out of the loop when - " going too far back. call cursor(plnum, 1) - let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', - \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if parlnum > 0 - let plindent = indent(parlnum) - let plnumstart = parlnum - else + + " Identing inside parentheses can be very slow, regardless of the searchpair() + " timeout, so let the user disable this feature if he doesn't need it + let disable_parentheses_indenting = get(g:, "pyindent_disable_parentheses_indenting", 0) + + if disable_parentheses_indenting == 1 let plindent = indent(plnum) let plnumstart = plnum - endif + else + " searchpair() can be slow sometimes, limit the time to 150 msec or what is + " put in g:pyindent_searchpair_timeout + let searchpair_stopline = 0 + let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150) + " If the previous line is inside parenthesis, use the indent of the starting + " line. + " Trick: use the non-existing "dummy" variable to break out of the loop when + " going too far back. + let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', + \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if parlnum > 0 + let plindent = indent(parlnum) + let plnumstart = parlnum + else + let plindent = indent(plnum) + let plnumstart = plnum + endif - " When inside parenthesis: If at the first line below the parenthesis add - " two 'shiftwidth', otherwise same as previous line. - " i = (a - " + b - " + c) - call cursor(a:lnum, 1) - let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', - \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if p > 0 - if p == plnum - " When the start is inside parenthesis, only indent one 'shiftwidth'. - let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', - \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if pp > 0 - return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) + " When inside parenthesis: If at the first line below the parenthesis add + " two 'shiftwidth', otherwise same as previous line. + " i = (a + " + b + " + c) + call cursor(a:lnum, 1) + let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if p > 0 + if p == plnum + " When the start is inside parenthesis, only indent one 'shiftwidth'. + let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if pp > 0 + return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) + endif + return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2)) endif - return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2)) + if plnumstart == p + return indent(plnum) + endif + return plindent endif - if plnumstart == p - return indent(plnum) - endif - return plindent + endif diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim index 182b07cbaa..83fe4e4fed 100644 --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -39,7 +39,7 @@ endfunction function s:GetYamlIndent() let pline = getline(v:lnum - 1) if pline =~ ':\s*$' - return indent(v:lnum) + &sw + return indent(v:lnum) + shiftwidth() elseif pline =~ '^\s*- ' return indent(v:lnum) + 2 endif diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index c93be31958..148a86ed67 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -3,10 +3,18 @@ " Maintainer: Christian Brabandt " Original Author: Nikolai Weibull " Previous Maintainer: Peter Aronoff -" Latest Revision: 2019-02-02 +" Latest Revision: 2019-04-27 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-sh-indent " Changelog: +" 20190428 - De-indent fi correctly when typing with +" https://github.com/chrisbra/vim-sh-indent/issues/15 +" 20190325 - Indent fi; correctly +" https://github.com/chrisbra/vim-sh-indent/issues/14 +" 20190319 - Indent arrays (only zsh and bash) +" https://github.com/chrisbra/vim-sh-indent/issues/13 +" 20190316 - Make use of searchpairpos for nested if sections +" fixes https://github.com/chrisbra/vim-sh-indent/issues/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 @@ -86,6 +94,12 @@ function! GetShIndent() if line !~ '}\s*\%(#.*\)\=$' let ind += s:indent_value('default') endif + " array (only works for zsh or bash) + elseif s:is_array(line) && line !~ ')\s*$' && (&ft is# 'zsh' || s:is_bash()) + let ind += s:indent_value('continuation-line') + " end of array + elseif curline =~ '^\s*)$' + let ind -= s:indent_value('continuation-line') elseif s:is_continuation_line(line) if pnum == 0 || !s:is_continuation_line(pline) let ind += s:indent_value('continuation-line') @@ -114,8 +128,8 @@ function! GetShIndent() let line = curline " 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') + if curline =~ '^\s*\%(fi\);\?\s*\%(#.*\)\=$' + let previous_line = searchpair('\', '', '\\zs', 'bnW') if previous_line > 0 let ind = indent(previous_line) endif @@ -179,6 +193,10 @@ function! s:is_function_definition(line) \ a:line =~ '^\s*function\s*\w\S\+\s*\%(()\)\?\s*{' endfunction +function! s:is_array(line) + return a:line =~ '^\s*\<\k\+\>=(' +endfunction + function! s:is_case_label(line, pnum) if a:line !~ '^\s*(\=.*)' return 0 @@ -272,5 +290,9 @@ function! s:is_end_expression(line) return a:line =~ '\<\%(fi\|esac\|done\|end\)\>\s*\%(#.*\)\=$' endfunction +function! s:is_bash() + return get(g:, 'is_bash', 0) || get(b:, 'is_bash', 0) +endfunction + let &cpo = s:cpo_save unlet s:cpo_save 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('