aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/CMakeLists.txt43
-rw-r--r--runtime/doc/autocmd.txt2
-rw-r--r--runtime/doc/change.txt6
-rw-r--r--runtime/doc/editing.txt4
-rw-r--r--runtime/doc/eval.txt16
-rw-r--r--runtime/doc/help.txt2
-rw-r--r--runtime/doc/helphelp.txt15
-rw-r--r--runtime/doc/index.txt4
-rw-r--r--runtime/doc/message.txt2
-rw-r--r--runtime/doc/options.txt13
-rw-r--r--runtime/doc/os_win32.txt27
-rw-r--r--runtime/doc/pattern.txt6
-rw-r--r--runtime/doc/quickfix.txt6
-rw-r--r--runtime/doc/quickref.txt3
-rw-r--r--runtime/doc/repeat.txt273
-rw-r--r--runtime/doc/starting.txt13
-rw-r--r--runtime/doc/syntax.txt55
-rw-r--r--runtime/doc/usr_05.txt64
-rw-r--r--runtime/doc/usr_25.txt10
-rw-r--r--runtime/doc/usr_29.txt2
-rw-r--r--runtime/doc/usr_41.txt10
-rw-r--r--runtime/doc/usr_toc.txt11
-rw-r--r--runtime/doc/various.txt3
-rw-r--r--runtime/ftplugin/eiffel.vim96
-rw-r--r--runtime/ftplugin/r.vim3
-rw-r--r--runtime/ftplugin/rhelp.vim3
-rw-r--r--runtime/ftplugin/rmd.vim3
-rw-r--r--runtime/ftplugin/rnoweb.vim3
-rw-r--r--runtime/ftplugin/rrst.vim3
-rw-r--r--runtime/indent/r.vim24
-rw-r--r--runtime/indent/rhelp.vim3
-rw-r--r--runtime/indent/rmd.vim3
-rw-r--r--runtime/indent/rnoweb.vim3
-rw-r--r--runtime/indent/rrst.vim3
-rw-r--r--runtime/indent/sh.vim8
-rw-r--r--runtime/indent/tex.vim249
-rw-r--r--runtime/optwin.vim4
-rw-r--r--runtime/pack/dist/opt/vimball/autoload/vimball.vim (renamed from runtime/autoload/vimball.vim)32
-rw-r--r--runtime/pack/dist/opt/vimball/doc/vimball.txt (renamed from runtime/doc/pi_vimball.txt)2
-rw-r--r--runtime/pack/dist/opt/vimball/plugin/vimballPlugin.vim43
-rw-r--r--runtime/plugin/vimballPlugin.vim40
-rw-r--r--runtime/syntax/c.vim6
-rw-r--r--runtime/syntax/fortran.vim15
-rw-r--r--runtime/syntax/mysql.vim30
-rw-r--r--runtime/syntax/python.vim4
-rw-r--r--runtime/syntax/r.vim62
-rw-r--r--runtime/syntax/rhelp.vim246
-rw-r--r--runtime/syntax/rmd.vim10
-rw-r--r--runtime/syntax/rnoweb.vim33
-rw-r--r--runtime/syntax/rrst.vim8
-rw-r--r--runtime/syntax/sh.vim26
-rw-r--r--runtime/syntax/sshconfig.vim85
-rw-r--r--runtime/syntax/sshdconfig.vim76
-rw-r--r--runtime/syntax/tex.vim76
-rw-r--r--runtime/syntax/vhdl.vim101
-rw-r--r--runtime/syntax/zsh.vim25
-rw-r--r--src/nvim/digraph.c4
-rw-r--r--src/nvim/eval.c8
-rw-r--r--src/nvim/ex_cmds.c251
-rw-r--r--src/nvim/ex_cmds.lua12
-rw-r--r--src/nvim/ex_cmds2.c295
-rw-r--r--src/nvim/ex_docmd.c84
-rw-r--r--src/nvim/ex_getln.c96
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/hardcopy.c3
-rw-r--r--src/nvim/main.c5
-rw-r--r--src/nvim/option.c6
-rw-r--r--src/nvim/option_defs.h149
-rw-r--r--src/nvim/options.lua10
-rw-r--r--src/nvim/spell.c12
-rw-r--r--src/nvim/syntax.c37
-rw-r--r--src/nvim/tag.c5
-rw-r--r--src/nvim/version.c36
-rw-r--r--src/nvim/vim.h9
-rw-r--r--test/functional/legacy/packadd_spec.lua350
75 files changed, 2412 insertions, 880 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index a9de7557e4..66971eccb2 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -2,6 +2,7 @@ set(SYN_VIM_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genvimvim.lua)
set(GENERATED_RUNTIME_DIR ${PROJECT_BINARY_DIR}/runtime)
set(GENERATED_SYN_VIM ${GENERATED_RUNTIME_DIR}/syntax/vim/generated.vim)
set(GENERATED_HELP_TAGS ${GENERATED_RUNTIME_DIR}/doc/tags)
+set(GENERATED_PACKAGE_DIR ${GENERATED_RUNTIME_DIR}/pack/dist/opt)
file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR})
file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax)
@@ -18,6 +19,47 @@ add_custom_command(OUTPUT ${GENERATED_SYN_VIM}
${PROJECT_SOURCE_DIR}/src/nvim/eval.c
)
+if(POLICY CMP0054)
+ cmake_policy(SET CMP0054 OLD)
+endif()
+
+file(GLOB PACKAGES ${PROJECT_SOURCE_DIR}/runtime/pack/dist/opt/*)
+
+set(GENERATED_PACKAGE_TAGS)
+foreach(PACKAGE ${PACKAGES})
+ get_filename_component(PACKNAME ${PACKAGE} NAME)
+ file(GLOB "${PACKNAME}_DOC_FILES" ${PACKAGE}/doc/*.txt)
+ if("${PACKNAME}_DOC_FILES")
+ file(MAKE_DIRECTORY ${GENERATED_PACKAGE_DIR}/${PACKNAME})
+ add_custom_target("${PACKNAME}-tags"
+ COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${PACKAGE} ${GENERATED_PACKAGE_DIR}/${PACKNAME}
+ COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
+ -u NONE -i NONE -e --headless -c "helptags doc" -c quit
+ DEPENDS
+ nvim
+ WORKING_DIRECTORY "${GENERATED_PACKAGE_DIR}/${PACKNAME}"
+ )
+
+ add_custom_command(OUTPUT "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags"
+ DEPENDS
+ "${PACKNAME}-tags"
+ )
+
+ set("${PACKNAME}_DOC_NAMES")
+ foreach(DF "${${PACKNAME}_DOC_FILES}")
+ get_filename_component(F ${DF} NAME)
+ list(APPEND "${PACKNAME}_DOC_NAMES" ${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/${F})
+ endforeach()
+
+ install_helper(
+ FILES ${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags "${${PACKNAME}_DOC_NAMES}"
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/pack/dist/opt/${PACKNAME}/doc)
+
+ list(APPEND GENERATED_PACKAGE_TAGS "${GENERATED_PACKAGE_DIR}/${PACKNAME}/doc/tags")
+ endif()
+endforeach()
+
file(GLOB DOCFILES ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt)
set(BUILDDOCFILES)
@@ -53,6 +95,7 @@ add_custom_target(
DEPENDS
${GENERATED_SYN_VIM}
${GENERATED_HELP_TAGS}
+ ${GENERATED_PACKAGE_TAGS}
)
# CMake is painful here. It will create the destination using the user's
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index 6641732679..dc37ff1d6d 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt* For Vim version 7.4. Last change: 2015 Dec 05
+*autocmd.txt* For Vim version 7.4. Last change: 2016 Mar 26
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index 4565cdf63e..2ccb9188a9 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -1,4 +1,4 @@
-*change.txt* For Vim version 7.4. Last change: 2016 Feb 10
+*change.txt* For Vim version 7.4. Last change: 2016 Mar 08
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -108,7 +108,9 @@ is an error when 'cpoptions' includes the 'E' flag.
*J*
J Join [count] lines, with a minimum of two lines.
Remove the indent and insert up to two spaces (see
- below).
+ below). Fails when on the last line of the buffer.
+ If [count] is too big it is reduce to the number of
+ lines available.
*v_J*
{Visual}J Join the highlighted lines, with a minimum of two
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt
index 69f834b04d..6f85436ab4 100644
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -1,4 +1,4 @@
-*editing.txt* For Vim version 7.4. Last change: 2016 Feb 16
+*editing.txt* For Vim version 7.4. Last change: 2016 Mar 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -358,7 +358,7 @@ These are the common ones:
To avoid the special meaning of the wildcards prepend a backslash. However,
on MS-Windows the backslash is a path separator and "path\[abc]" is still seen
as a wildcard when "[" is in the 'isfname' option. A simple way to avoid this
-is to use "path\[[]abc]". Then the file "path[abc]" literally.
+is to use "path\[[]abc]", this matches the file "path\[abc]".
*starstar-wildcard*
Expanding "**" is possible on Unix, Win32, Mac OS/X and a few other systems.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 3ebfe8da88..0ca41370e9 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2016 Feb 19
+*eval.txt* For Vim version 7.4. Last change: 2016 Apr 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -413,7 +413,8 @@ only appear once. Examples: >
A key is always a String. You can use a Number, it will be converted to a
String automatically. Thus the String '4' and the number 4 will find the same
entry. Note that the String '04' and the Number 04 are different, since the
-Number will be converted to the String '4'.
+Number will be converted to the String '4'. The empty string can be used as a
+key.
A value can be any expression. Using a Dictionary for a value creates a
nested Dictionary: >
@@ -861,11 +862,12 @@ These three can be repeated and mixed. Examples:
expr8 *expr8*
-----
expr8[expr1] item of String or |List| *expr-[]* *E111*
+ *subscript*
If expr8 is a Number or String this results in a String that contains the
expr1'th single byte from expr8. expr8 is used as a String, expr1 as a
Number. This doesn't recognize multi-byte encodings, see |byteidx()| for
-an alternative.
+an alternative, or use `split()` to turn the string into a list of characters.
Index zero gives the first byte. This is like it works in C. Careful:
text column numbers start with one! Example, to get the byte under the
@@ -2155,6 +2157,7 @@ writefile({list}, {fname} [, {flags}])
Number write list of lines to file {fname}
xor({expr}, {expr}) Number bitwise XOR
+
abs({expr}) *abs()*
Return the absolute value of {expr}. When {expr} evaluates to
a |Float| abs() returns a |Float|. When {expr} can be
@@ -2779,6 +2782,7 @@ cursor({list})
When there is one argument {list} this is used as a |List|
with two, three or four item:
+ [{lnum}, {col}]
[{lnum}, {col}, {off}]
[{lnum}, {col}, {off}, {curswant}]
This is like the return value of |getpos()| or |getcurpos()|,
@@ -3207,7 +3211,10 @@ feedkeys({string} [, {mode}]) *feedkeys()*
similar to using ":normal!". You can call feedkeys()
several times without 'x' and then one time with 'x'
(possibly with an empty {string}) to execute all the
- typeahead.
+ typeahead. Note that when Vim ends in Insert mode it
+ will behave as if <Esc> is typed, to avoid getting
+ stuck, waiting for a character to be typed before the
+ script continues.
Return value is always 0.
filereadable({file}) *filereadable()*
@@ -7408,6 +7415,7 @@ unix Unix version of Vim.
user_commands User-defined commands.
vertsplit Compiled with vertically split windows |:vsplit|.
vim_starting True while initial source'ing takes place. |startup|
+ *vim_starting*
virtualedit Compiled with 'virtualedit' option.
visual Compiled with Visual mode.
visualextra Compiled with extra Visual mode commands.
diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt
index 342c475f9b..fc4816a6c8 100644
--- a/runtime/doc/help.txt
+++ b/runtime/doc/help.txt
@@ -1,4 +1,4 @@
-*help.txt* For Vim version 7.4. Last change: 2016 Jan 10
+*help.txt* For Vim version 7.4. Last change: 2016 Mar 31
VIM - main help file
k
diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt
index f3533b8815..ca341af200 100644
--- a/runtime/doc/helphelp.txt
+++ b/runtime/doc/helphelp.txt
@@ -1,4 +1,4 @@
-*helphelp.txt* For Vim version 7.4. Last change: 2014 Sep 19
+*helphelp.txt* For Vim version 7.4. Last change: 2016 Apr 01
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -188,6 +188,9 @@ command: >
*E154* *E150* *E151* *E152* *E153* *E670*
:helpt[ags] [++t] {dir}
Generate the help tags file(s) for directory {dir}.
+ When {dir} is ALL then all "doc" directories in
+ 'runtimepath' will be used.
+
All "*.txt" and "*.??x" files in the directory and
sub-directories are scanned for a help tag definition
in between stars. The "*.??x" files are for
@@ -196,9 +199,11 @@ command: >
sorted.
When there are duplicates an error message is given.
An existing tags file is silently overwritten.
+
The optional "++t" argument forces adding the
"help-tags" tag. This is also done when the {dir} is
equal to $VIMRUNTIME/doc.
+
To rebuild the help tags in the runtime directory
(requires write permission there): >
:helptags $VIMRUNTIME/doc
@@ -249,7 +254,9 @@ The second one finds the English user manual, even when 'helplang' is set to
When using command-line completion for the ":help" command, the "@en"
extension is only shown when a tag exists for multiple languages. When the
-tag only exists for English "@en" is omitted.
+tag only exists for English "@en" is omitted. When the first candidate has an
+"@ab" extension and it matches the first language in 'helplang' "@ab" is also
+omitted.
When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
find the tag in the same language. If not found then 'helplang' will be used
@@ -306,6 +313,10 @@ aligned on a line.
When referring to an existing help tag and to create a hot-link, place the
name between two bars (|) eg. |help-writing|.
+When referring to a Vim command and to create a hot-link, place the
+name between two backticks, eg. inside `:filetype`. You will see this is
+highlighted as a command, like a code block (see below).
+
When referring to a Vim option in the help file, place the option name between
two single quotes, eg. 'statusline'
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index e75031ccef..bd2df5d1e5 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt* For Vim version 7.4. Last change: 2016 Jan 19
+*index.txt* For Vim version 7.4. Last change: 2016 Mar 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1378,6 +1378,8 @@ tag command action ~
|:ounmap| :ou[nmap] like ":unmap" but for Operator-pending mode
|:ounmenu| :ounme[nu] remove menu for Operator-pending mode
|:ownsyntax| :ow[nsyntax] set new local syntax highlight for this window
+|:packadd| :pa[ckadd] add a plugin from 'packpath'
+|:packloadall| :packl[oadall] load all packages under 'packpath'
|:pclose| :pc[lose] close preview window
|:pedit| :ped[it] edit file in the preview window
|:print| :p[rint] print lines
diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt
index 114bb61d99..7ceddeb674 100644
--- a/runtime/doc/message.txt
+++ b/runtime/doc/message.txt
@@ -1,4 +1,4 @@
-*message.txt* For Vim version 7.4. Last change: 2013 Feb 23
+*message.txt* For Vim version 7.4. Last change: 2016 Feb 27
VIM REFERENCE MANUAL by Bram Moolenaar
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 8c2b7786a7..e00f27f9f0 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 7.4. Last change: 2016 Feb 20
+*options.txt* For Vim version 7.4. Last change: 2016 Apr 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2458,8 +2458,8 @@ A jump table for the options with a short description can be found at |Q_op|.
file only, the option is not changed.
When 'binary' is set, the value of 'fileformats' is not used.
- Note that when Vim starts up with an empty buffer this option is not
- used. Set 'fileformat' in your vimrc instead.
+ When Vim starts up with an empty buffer the first item is used. You
+ can overrule this by setting 'fileformat' in your .vimrc.
For systems with a Dos-like <EOL> (<CR><NL>), when reading files that
are ":source"ed and for vimrc files, automatic <EOL> detection may be
@@ -4238,6 +4238,7 @@ A jump table for the options with a short description can be found at |Q_op|.
written. A ":set nomodified" command also resets the original
values to the current values and the 'modified' option will be
reset.
+ Similarly for 'eol' and 'bomb'.
This option is not set when a change is made to the buffer as the
result of a BufNewFile, BufRead/BufReadPost, BufWritePost,
FileAppendPost or VimLeave autocommand event. See |gzip-example| for
@@ -4499,6 +4500,12 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
+ *'packpath'* *'pp'*
+'packpath' 'pp' string (default: see 'runtimepath')
+ {not in Vi}
+ Directories used to find packages. See |packages|.
+
+
*'paragraphs'* *'para'*
'paragraphs' 'para' string (default "IPLPPPQPP TPHPLIPpLpItpplpipbp")
global
diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt
index 3c7ca4e36a..5dc276c9df 100644
--- a/runtime/doc/os_win32.txt
+++ b/runtime/doc/os_win32.txt
@@ -1,4 +1,4 @@
-*os_win32.txt* For Vim version 7.4. Last change: 2014 Sep 25
+*os_win32.txt* For Vim version 7.4. Last change: 2016 Mar 05
VIM REFERENCE MANUAL by George Reilly
@@ -75,6 +75,31 @@ The directory of the Vim executable is appended to $PATH. This is mostly to
make "!xxd" work, as it is in the Tools menu. And it also means that when
executable() returns 1 the executable can actually be executed.
+Quotes in file names *win32-quotes*
+
+Quotes inside a file name (or any other command line argument) can be escaped
+with a backslash. E.g. >
+ vim -c "echo 'foo\"bar'"
+
+Alternatively use three quotes to get one: >
+ vim -c "echo 'foo"""bar'"
+
+The quotation rules are:
+
+1. A `"` starts quotation.
+2. Another `"` or `""` ends quotation. If the quotation ends with `""`, a `"`
+ is produced at the end of the quoted string.
+
+Examples, with [] around an argument:
+ "foo" -> [foo]
+ "foo"" -> [foo"]
+ "foo"bar -> [foobar]
+ "foo" bar -> [foo], [bar]
+ "foo""bar -> [foo"bar]
+ "foo"" bar -> [foo"], [bar]
+ "foo"""bar" -> [foo"bar]
+
+
==============================================================================
3. Using the mouse *win32-mouse*
diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt
index 5897f756d8..0fe6106ec5 100644
--- a/runtime/doc/pattern.txt
+++ b/runtime/doc/pattern.txt
@@ -1,4 +1,4 @@
-*pattern.txt* For Vim version 7.4. Last change: 2016 Jan 03
+*pattern.txt* For Vim version 7.4. Last change: 2016 Apr 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1096,8 +1096,8 @@ x A single character, with no special meaning, matches itself
'/', alphabetic, numeric, '_' or '~'.
These items only work for 8-bit characters, except [:lower:] and
[:upper:] also work for multi-byte characters when using the new
- regexp engine. In the future these items may work for multi-byte
- characters.
+ regexp engine. See |two-engines|. In the future these items may
+ work for multi-byte characters.
*/[[=* *[==]*
- An equivalence class. This means that characters are matched that
have almost the same meaning, e.g., when ignoring accents. This
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index 317226108f..3b54faf18e 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1,4 +1,4 @@
-*quickfix.txt* For Vim version 7.4. Last change: 2016 Jan 21
+*quickfix.txt* For Vim version 7.4. Last change: 2016 Mar 19
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -49,6 +49,10 @@ The following quickfix commands can be used. The location list commands are
similar to the quickfix commands, replacing the 'c' prefix in the quickfix
command with 'l'.
+ *E924*
+If the current window was closed by an |autocommand| while processing a
+location list command, it will be aborted.
+
*:cc*
:cc[!] [nr] Display error [nr]. If [nr] is omitted, the same
error is displayed again. Without [!] this doesn't
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index 8e40628e25..fcfecc02a1 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -1,4 +1,4 @@
-*quickref.txt* For Vim version 7.4. Last change: 2015 Nov 10
+*quickref.txt* For Vim version 7.4. Last change: 2016 Mar 30
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -794,6 +794,7 @@ Short explanation of each option: *option-list*
'omnifunc' 'ofu' function for filetype-specific completion
'opendevice' 'odev' allow reading/writing devices on MS-Windows
'operatorfunc' 'opfunc' function to be called for |g@| operator
+'packpath' 'pp' list of directories used for packages
'paragraphs' 'para' nroff macros that separate paragraphs
'paste' allow pasting text
'pastetoggle' 'pt' key code that causes 'paste' to toggle
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 5b382f95f2..e84bbe5439 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -1,4 +1,4 @@
-*repeat.txt* For Vim version 7.4. Last change: 2016 Feb 12
+*repeat.txt* For Vim version 7.4. Last change: 2016 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -8,12 +8,14 @@ Repeating commands, Vim scripts and debugging *repeating*
Chapter 26 of the user manual introduces repeating |usr_26.txt|.
-1. Single repeats |single-repeat|
-2. Multiple repeats |multi-repeat|
-3. Complex repeats |complex-repeat|
-4. Using Vim scripts |using-scripts|
-5. Debugging scripts |debug-scripts|
-6. Profiling |profiling|
+1. Single repeats |single-repeat|
+2. Multiple repeats |multi-repeat|
+3. Complex repeats |complex-repeat|
+4. Using Vim scripts |using-scripts|
+5. Using Vim packages |packages|
+6. Creating Vim packages |package-create|
+7. Debugging scripts |debug-scripts|
+8. Profiling |profiling|
==============================================================================
1. Single repeats *single-repeat*
@@ -68,8 +70,8 @@ examples.
The global commands work by first scanning through the [range] lines and
marking each line where a match occurs (for a multi-line pattern, only the
start of the match matters).
-In a second scan the [cmd] is executed for each marked line with its line
-number prepended. For ":v" and ":g!" the command is executed for each not
+In a second scan the [cmd] is executed for each marked line, as if the cursor
+was in that line. For ":v" and ":g!" the command is executed for each not
marked line. If a line is deleted its mark disappears.
The default for [range] is the whole buffer (1,$). Use "CTRL-C" to interrupt
the command. If an error message is given for a line, the command for that
@@ -173,10 +175,12 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
commands.
*:ru* *:runtime*
-:ru[ntime][!] {file} ..
+:ru[ntime][!] [where] {file} ..
Read Ex commands from {file} in each directory given
- by 'runtimepath'. There is no error for non-existing
- files. Example: >
+ by 'runtimepath' and/or 'packpath'. There is no error
+ for non-existing files.
+
+ Example: >
:runtime syntax/c.vim
< There can be multiple {file} arguments, separated by
@@ -190,6 +194,15 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
When it is not included only the first found file is
sourced.
+ When [where] is omitted only 'runtimepath' is used.
+ Other values:
+ START search under "start" in 'packpath'
+ OPT search under "opt" in 'packpath'
+ PACK search under "start" and "opt" in
+ 'packpath'
+ ALL first use 'runtimepath', then search
+ under "start" and "opt" in 'packpath'
+
When {file} contains wildcards it is expanded to all
matching files. Example: >
:runtime! plugin/*.vim
@@ -203,6 +216,57 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
When 'verbose' is two or higher, there is a message
about each searched file.
+ *:pa* *:packadd* *E919*
+:pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath'
+ and source any plugin files found. The directory must
+ match:
+ pack/*/opt/{name} ~
+ The directory is added to 'runtimepath' if it wasn't
+ there yet.
+
+ Note that {name} is the directory name, not the name
+ of the .vim file. All the files matching the pattern
+ pack/*/opt/{name}/plugin/**/*.vim ~
+ will be sourced. This allows for using subdirectories
+ below "plugin", just like with plugins in
+ 'runtimepath'.
+
+ If the filetype detection was not enabled yet (this
+ is usually done with a "syntax enable" or "filetype
+ on" command in your .vimrc file), this will also look
+ for "{name}/ftdetect/*.vim" files.
+
+ When the optional ! is added no plugin files or
+ ftdetect scripts are loaded, only the matching
+ directories are added to 'runtimepath'. This is
+ useful in your .vimrc. The plugins will then be
+ loaded during initialization, see |load-plugins|.
+
+ Also see |pack-add|.
+
+ *:packl* *:packloadall*
+:packl[oadall][!] Load all packages in the "start" directory under each
+ entry in 'packpath'.
+
+ First all the directories found are added to
+ 'runtimepath', then the plugins found in the
+ directories are sourced. This allows for a plugin to
+ depend on something of another plugin, e.g. an
+ "autoload" directory. See |packload-two-steps| for
+ how this can be useful.
+
+ This is normally done automatically during startup,
+ after loading your .vimrc file. With this command it
+ can be done earlier.
+
+ Packages will be loaded only once. After this command
+ it won't happen again. When the optional ! is added
+ this command will load packages even when done before.
+
+ An error only causes sourcing the script where it
+ happens to be aborted, further plugins will be loaded.
+ See |packages|.
+
:scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167*
Specify the character encoding used in the script.
The following lines will be converted from [encoding]
@@ -373,7 +437,186 @@ Rationale:
< Therefore the unusual leading backslash is used.
==============================================================================
-5. Debugging scripts *debug-scripts*
+5. Using Vim packages *packages*
+
+A Vim package is a directory that contains one or more plugins. The
+advantages over normal plugins:
+- A package can be downloaded as an archive and unpacked in its own directory.
+ Thus the files are not mixed with files of other plugins. That makes it
+ easy to update and remove.
+- A package can be a git, mercurial, etc. repository. That makes it really
+ easy to update.
+- A package can contain multiple plugins that depend on each other.
+- A package can contain plugins that are automatically loaded on startup and
+ ones that are only loaded when needed with `:packadd`.
+
+
+Using a package and loading automatically ~
+
+Let's assume your Vim files are in the "~/.local/share/nvim/site" directory
+and you want to add a package from a zip archive "/tmp/foopack.zip":
+ % mkdir -p ~/.local/share/nvim/site/pack/foo
+ % cd ~/.local/share/nvim/site/pack/foo
+ % unzip /tmp/foopack.zip
+
+The directory name "foo" is arbitrary, you can pick anything you like.
+
+You would now have these files under ~/.local/share/nvim/site:
+ pack/foo/README.txt
+ pack/foo/start/foobar/plugin/foo.vim
+ pack/foo/start/foobar/syntax/some.vim
+ pack/foo/opt/foodebug/plugin/debugger.vim
+
+When Vim starts up, after processing your .vimrc, it scans all directories in
+'packpath' for plugins under the "pack/*/start" directory. First all those
+directories are added to 'runtimepath'. Then all the plugins are loaded.
+See |packload-two-steps| for how these two steps can be useful.
+
+In the example Vim will find "pack/foo/start/foobar/plugin/foo.vim" and adds
+"~/.local/share/nvim/site/pack/foo/start/foobar" to 'runtimepath'.
+
+If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will
+find the syntax/some.vim file, because its directory is in 'runtimepath'.
+
+Vim will also load ftdetect files, if there are any.
+
+Note that the files under "pack/foo/opt" are not loaded automatically, only the
+ones under "pack/foo/start". See |pack-add| below for how the "opt" directory
+is used.
+
+Loading packages automatically will not happen if loading plugins is disabled,
+see |load-plugins|.
+
+To load packages earlier, so that 'runtimepath' gets updated: >
+ :packloadall
+This also works when loading plugins is disabled. The automatic loading will
+only happen once.
+
+
+Using a single plugin and loading it automatically ~
+
+If you don't have a package but a single plugin, you need to create the extra
+directory level:
+ % mkdir -p ~/.local/share/nvim/site/pack/foo/start/foobar
+ % cd ~/.local/share/nvim/site/pack/foo/start/foobar
+ % unzip /tmp/someplugin.zip
+
+You would now have these files:
+ pack/foo/start/foobar/plugin/foo.vim
+ pack/foo/start/foobar/syntax/some.vim
+
+From here it works like above.
+
+
+Optional plugins ~
+ *pack-add*
+To load an optional plugin from a pack use the `:packadd` command: >
+ :packadd foodebug
+This searches for "pack/*/opt/foodebug" in 'packpath' and will find
+~/.local/share/nvim/site/pack/foo/opt/foodebug/plugin/debugger.vim and source
+it.
+
+This could be done if some conditions are met. For example, depending on
+whether Vim supports a feature or a dependency is missing.
+
+You can also load an optional plugin at startup, by putting this command in
+your |.vimrc|: >
+ :packadd! foodebug
+The extra "!" is so that the plugin isn't loaded with Vim was started with
+|--noplugin|.
+
+It is perfectly normal for a package to only have files in the "opt"
+directory. You then need to load each plugin when you want to use it.
+
+
+Where to put what ~
+
+Since color schemes, loaded with `:colorscheme`, are found below
+"pack/*/start" and "pack/*/opt", you could put them anywhere. We recommend
+you put them below "pack/*/opt", for example
+".vim/pack/mycolors/opt/dark/colors/very_dark.vim".
+
+Filetype plugins should go under "pack/*/start", so that they are always
+found. Unless you have more than one plugin for a file type and want to
+select which one to load with `:packadd`. E.g. depending on the compiler
+version: >
+ if foo_compiler_version > 34
+ packadd foo_new
+ else
+ packadd foo_old
+ endif
+
+The "after" directory is most likely not useful in a package. It's not
+disallowed though.
+
+==============================================================================
+6. Creating Vim packages *package-create*
+
+This assumes you write one or more plugins that you distribute as a package.
+
+If you have two unrelated plugins you would use two packages, so that Vim
+users can chose what they include or not. Or you can decide to use one
+package with optional plugins, and tell the user to add the ones he wants with
+`:packadd`.
+
+Decide how you want to distribute the package. You can create an archive or
+you could use a repository. An archive can be used by more users, but is a
+bit harder to update to a new version. A repository can usually be kept
+up-to-date easily, but it requires a program like "git" to be available.
+You can do both, github can automatically create an archive for a release.
+
+Your directory layout would be like this:
+ start/foobar/plugin/foo.vim " always loaded, defines commands
+ start/foobar/plugin/bar.vim " always loaded, defines commands
+ start/foobar/autoload/foo.vim " loaded when foo command used
+ start/foobar/doc/foo.txt " help for foo.vim
+ start/foobar/doc/tags " help tags
+ opt/fooextra/plugin/extra.vim " optional plugin, defines commands
+ opt/fooextra/autoload/extra.vim " loaded when extra command used
+ opt/fooextra/doc/extra.txt " help for extra.vim
+ opt/fooextra/doc/tags " help tags
+
+This allows for the user to do: >
+ mkdir ~/.local/share/nvim/site/pack/myfoobar
+ cd ~/.local/share/nvim/site/pack/myfoobar
+ git clone https://github.com/you/foobar.git
+
+Here "myfoobar" is a name that the user can choose, the only condition is that
+it differs from other packages.
+
+In your documentation you explain what the plugins do, and tell the user how
+to load the optional plugin: >
+ :packadd! fooextra
+
+You could add this packadd command in one of your plugins, to be executed when
+the optional plugin is needed.
+
+Run the `:helptags` command to generate the doc/tags file. Including this
+generated file in the package means that the user can drop the package in his
+pack directory and the help command works right away. Don't forget to re-run
+the command after changing the plugin help: >
+ :helptags path/start/foobar/doc
+ :helptags path/opt/fooextra/doc
+
+
+Dependencies between plugins ~
+ *packload-two-steps*
+Suppose you have a two plugins that depend on the same functionality. You can
+put the common functionality in an autoload directory, so that it will be
+found automatically. Your package would have these files:
+
+ pack/foo/start/one/plugin/one.vim >
+ call foolib#getit()
+< pack/foo/start/two/plugin/two.vim >
+ call foolib#getit()
+< pack/foo/start/lib/autoload/foolib.vim >
+ func foolib#getit()
+
+This works, because loading packages will first add all found directories to
+'runtimepath' before sourcing the plugins.
+
+==============================================================================
+7. Debugging scripts *debug-scripts*
Besides the obvious messages that you can add to your scripts to find out what
they are doing, Vim offers a debug mode. This allows you to step through a
@@ -484,7 +727,7 @@ Additionally, these commands can be used:
About the additional commands in debug mode:
- There is no command-line completion for them, you get the completion for the
normal Ex commands only.
-- You can shorten them, up to a single character, unless more then one command
+- You can shorten them, up to a single character, unless more than one command
starts with the same letter. "f" stands for "finish", use "fr" for "frame".
- Hitting <CR> will repeat the previous one. When doing another command, this
is reset (because it's not clear what you want to repeat).
@@ -597,7 +840,7 @@ OBSCURE
user, don't use typeahead for debug commands.
==============================================================================
-6. Profiling *profile* *profiling*
+8. Profiling *profile* *profiling*
Profiling means that Vim measures the time that is spent on executing
functions and/or scripts. The |+profile| feature is required for this.
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index ad2649b765..236ed65f46 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -1,4 +1,4 @@
-*starting.txt* For Vim version 7.4. Last change: 2016 Feb 18
+*starting.txt* For Vim version 7.4. Last change: 2016 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -41,6 +41,7 @@ filename One or more file names. The first one will be the current
nvim -- -filename
< All arguments after the "--" will be interpreted as file names,
no other options or "+command" argument can follow.
+ For behavior of quotes on MS-Windows, see |win32-quotes|.
*--*
- This argument can mean two things, depending on whether Ex
@@ -463,6 +464,11 @@ accordingly. Vim proceeds in this order:
commands from the command line have not been executed yet. You can
use "--cmd 'set noloadplugins'" |--cmd|.
+ Packages are loaded. These are plugins, as above, but found in the
+ "start" directory of each entry in 'packpath'. Every plugin directory
+ found is added in 'runtimepath' and then the plugins are sourced. See
+ |packages|.
+
7. Set 'shellpipe' and 'shellredir'
The 'shellpipe' and 'shellredir' options are set according to the
value of the 'shell' option, unless they have been set before.
@@ -498,8 +504,9 @@ accordingly. Vim proceeds in this order:
14. Execute startup commands
If a "-t" flag was given to Vim, the tag is jumped to.
The commands given with the |-c| and |+cmd| arguments are executed.
- The starting flag is reset, has("vim_starting") will now return zero.
If the 'insertmode' option is set, Insert mode is entered.
+ The starting flag is reset, has("vim_starting") will now return zero.
+ The |v:vim_did_enter| variable is set to 1.
The |VimEnter| autocommands are executed.
Some hints on using initializations:
@@ -710,7 +717,7 @@ There are several ways to exit Vim:
- Use `:cquit`. Also when there are changes.
When using `:cquit` or when there was an error message Vim exits with exit
-code 1. Errors can be avoide by using `:silent!`.
+code 1. Errors can be avoided by using `:silent!`.
==============================================================================
6. Saving settings *save-settings*
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 4e4ea39e7c..491e5801c8 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt* For Vim version 7.4. Last change: 2016 Jan 28
+*syntax.txt* For Vim version 7.4. Last change: 2016 Apr 10
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -936,26 +936,27 @@ To disable them use ":unlet". Example: >
:unlet c_comment_strings
Variable Highlight ~
-c_gnu GNU gcc specific items
-c_comment_strings strings and numbers inside a comment
-c_space_errors trailing white space and spaces before a <Tab>
-c_no_trail_space_error ... but no trailing spaces
-c_no_tab_space_error ... but no spaces before a <Tab>
-c_no_bracket_error don't highlight {}; inside [] as errors
-c_no_curly_error don't highlight {}; inside [] and () as errors;
+*c_gnu* GNU gcc specific items
+*c_comment_strings* strings and numbers inside a comment
+*c_space_errors* trailing white space and spaces before a <Tab>
+*c_no_trail_space_error* ... but no trailing spaces
+*c_no_tab_space_error* ... but no spaces before a <Tab>
+*c_no_bracket_error* don't highlight {}; inside [] as errors
+*c_no_curly_error* don't highlight {}; inside [] and () as errors;
except { and } in first column
-c_curly_error highlight a missing }; this forces syncing from the
+*c_curly_error* highlight a missing }; this forces syncing from the
start of the file, can be slow
-c_no_ansi don't do standard ANSI types and constants
-c_ansi_typedefs ... but do standard ANSI types
-c_ansi_constants ... but do standard ANSI constants
-c_no_utf don't highlight \u and \U in strings
-c_syntax_for_h for *.h files use C syntax instead of C++ and use objc
+*c_no_ansi* don't do standard ANSI types and constants
+*c_ansi_typedefs* ... but do standard ANSI types
+*c_ansi_constants* ... but do standard ANSI constants
+*c_no_utf* don't highlight \u and \U in strings
+*c_syntax_for_h* for *.h files use C syntax instead of C++ and use objc
syntax instead of objcpp
-c_no_if0 don't highlight "#if 0" blocks as comments
-c_no_cformat don't highlight %-formats in strings
-c_no_c99 don't highlight C99 standard items
-c_no_c11 don't highlight C11 standard items
+*c_no_if0* don't highlight "#if 0" blocks as comments
+*c_no_cformat* don't highlight %-formats in strings
+*c_no_c99* don't highlight C99 standard items
+*c_no_c11* don't highlight C11 standard items
+*c_no_bsd* don't highlight BSD specific types
When 'foldmethod' is set to "syntax" then /* */ comments and { } blocks will
become a fold. If you don't want comments to become a fold use: >
@@ -2886,7 +2887,7 @@ You may wish to embed languages into sh. I'll give an example courtesy of
Lorance Stinson on how to do this with awk as an example. Put the following
file into $HOME/.config/nvim/after/syntax/sh/awkembed.vim: >
- " AWK Embedding: {{{1
+ " AWK Embedding:
" ==============
" Shamelessly ripped from aspperl.vim by Aaron Hope.
if exists("b:current_syntax")
@@ -3345,6 +3346,13 @@ Note that schemas are not actually limited to plain scalars, but this is the
only difference between schemas defined in YAML specification and the only
difference defined in the syntax file.
+
+ZSH *zsh.vim* *ft-zsh-syntax*
+
+The syntax script for zsh allows for syntax-based folding: >
+
+ :let g:zsh_fold_enable = 1
+
==============================================================================
5. Defining a syntax *:syn-define* *E410*
@@ -4511,9 +4519,9 @@ in their own color.
:colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath'
for the file "colors/{name}.vim". The first one that
is found is loaded.
- To see the name of the currently active color scheme: >
- :colo
-< The name is also stored in the g:colors_name variable.
+ Also searches all plugins in 'packpath', first below
+ "start" and then under "opt".
+
Doesn't work recursively, thus you can't use
":colorscheme" in a color scheme script.
After the color scheme has been loaded the
@@ -5019,6 +5027,9 @@ defaults back: >
:syntax reset
+It is a bit of a wrong name, since it does not reset any syntax items, it only
+affects the highlighting.
+
This doesn't change the colors for the 'highlight' option.
Note that the syntax colors that you set in your vimrc file will also be reset
diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt
index 5aecf33557..f920fd4591 100644
--- a/runtime/doc/usr_05.txt
+++ b/runtime/doc/usr_05.txt
@@ -1,4 +1,4 @@
-*usr_05.txt* For Vim version 7.4. Last change: 2012 Nov 20
+*usr_05.txt* For Vim version 7.4. Last change: 2016 Mar 28
VIM USER MANUAL - by Bram Moolenaar
@@ -12,10 +12,11 @@ Vim's capabilities. Or define your own macros.
|05.1| The vimrc file
|05.2| The example vimrc file explained
|05.3| Simple mappings
-|05.4| Adding a plugin
-|05.5| Adding a help file
-|05.6| The option window
-|05.7| Often used options
+|05.4| Adding a package
+|05.5| Adding a plugin
+|05.6| Adding a help file
+|05.7| The option window
+|05.8| Often used options
Next chapter: |usr_06.txt| Using syntax highlighting
Previous chapter: |usr_04.txt| Making small changes
@@ -245,7 +246,47 @@ The ":map" command (with no arguments) lists your current mappings. At
least the ones for Normal mode. More about mappings in section |40.1|.
==============================================================================
-*05.4* Adding a plugin *add-plugin* *plugin*
+*05.4* Adding a package *add-package* *vimball-install*
+
+A package is a set of files that you can add to Vim. There are two kinds of
+packages: optional and automatically loaded on startup.
+
+The Vim distribution comes with a few packages that you can optionally use.
+For example, the vimball plugin. This plugin supports creating and using
+vimballs (self-installing Vim plugin archives).
+
+To start using the vimball plugin, add one line to your vimrc file: >
+ packadd vimball
+
+That's all! You can also type the command to try it out. Now you can find
+help about this plugin: >
+ :help vimball
+
+This works, because when `:packadd` loaded the plugin it also added the
+package directory in 'runtimepath', so that the help file can be found. The
+tags for vimball's help are already created. If you need to generate the help
+tags for a package, see the `:helptags` command.
+
+You can find packages on the Internet in various places. It usually comes as
+an archive or as a repository. For an archive you can follow these steps:
+ 1. create the package directory: >
+ mkdir -p ~/.local/share/nvim/site/pack/fancy
+< "fancy" can be any name of your liking. Use one that describes the
+ package.
+ 2. unpack the archive in that directory. This assumes the top
+ directory in the archive is "start": >
+ cd ~/.local/share/nvim/site/pack/fancy
+ unzip /tmp/fancy.zip
+< If the archive layout is different make sure that you end up with a
+ path like this:
+ ~/.local/share/nvim/site/pack/fancy/start/fancytext/plugin/fancy.vim ~
+ Here "fancytext" is the name of the package, it can be anything
+ else.
+
+More information about packages can be found here: |packages|.
+
+==============================================================================
+*05.5* Adding a plugin *add-plugin* *plugin*
Vim's functionality can be extended by adding plugins. A plugin is nothing
more than a Vim script file that is loaded automatically when Vim starts. You
@@ -299,10 +340,9 @@ Then copy the file to your plugin directory:
Example for Unix (assuming you didn't have a plugin directory yet): >
mkdir -p ~/.local/share/nvim/site/plugin
- cp /usr/local/share/vim/vim60/macros/justify.vim ~/.local/share/nvim/site/plugin
+ cp /tmp/yourplugin.vim ~/.local/share/nvim/site/plugin
-That's all! Now you can use the commands defined in this plugin to justify
-text.
+That's all! Now you can use the commands defined in this plugin.
Instead of putting plugins directly into the plugin/ directory, you may
better organize them by putting them into subdirectories under plugin/.
@@ -384,7 +424,7 @@ Further reading:
|new-filetype| How to detect a new file type.
==============================================================================
-*05.5* Adding a help file *add-local-help*
+*05.6* Adding a help file *add-local-help*
If you are lucky, the plugin you installed also comes with a help file. We
will explain how to install the help file, so that you can easily find help
@@ -417,7 +457,7 @@ them through the tag.
For writing a local help file, see |write-local-help|.
==============================================================================
-*05.6* The option window
+*05.7* The option window
If you are looking for an option that does what you want, you can search in
the help files here: |options|. Another way is by using this command: >
@@ -456,7 +496,7 @@ border. This is what the 'scrolloff' option does, it specifies an offset
from the window border where scrolling starts.
==============================================================================
-*05.7* Often used options
+*05.8* Often used options
There are an awful lot of options. Most of them you will hardly ever use.
Some of the more useful ones will be mentioned here. Don't forget you can
diff --git a/runtime/doc/usr_25.txt b/runtime/doc/usr_25.txt
index 23d76a8b0f..24420353dd 100644
--- a/runtime/doc/usr_25.txt
+++ b/runtime/doc/usr_25.txt
@@ -1,4 +1,4 @@
-*usr_25.txt* For Vim version 7.4. Last change: 2014 Oct 29
+*usr_25.txt* For Vim version 7.4. Last change: 2016 Mar 28
VIM USER MANUAL - by Bram Moolenaar
@@ -196,12 +196,16 @@ Vim has no built-in way of justifying text. However, there is a neat macro
package that does the job. To use this package, execute the following
command: >
- :runtime macros/justify.vim
+ :packadd justify
+
+Or put this line in your |vimrc|: >
+
+ packadd! justify
This Vim script file defines a new visual command "_j". To justify a block of
text, highlight the text in Visual mode and then execute "_j".
Look in the file for more explanations. To go there, do "gf" on this name:
-$VIMRUNTIME/macros/justify.vim.
+$VIMRUNTIME/pack/dist/opt/justify/plugin/justify.vim.
An alternative is to filter the text through an external program. Example: >
diff --git a/runtime/doc/usr_29.txt b/runtime/doc/usr_29.txt
index e495aad06d..9eb66ce83c 100644
--- a/runtime/doc/usr_29.txt
+++ b/runtime/doc/usr_29.txt
@@ -1,4 +1,4 @@
-*usr_29.txt* For Vim version 7.4. Last change: 2008 Jun 28
+*usr_29.txt* For Vim version 7.4. Last change: 2016 Feb 27
VIM USER MANUAL - by Bram Moolenaar
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index a14e722328..4d3ad49f1f 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1,4 +1,4 @@
-*usr_41.txt* For Vim version 7.4. Last change: 2016 Feb 14
+*usr_41.txt* For Vim version 7.4. Last change: 2016 Apr 12
VIM USER MANUAL - by Bram Moolenaar
@@ -768,6 +768,7 @@ Date and Time: *date-functions* *time-functions*
strftime() convert time to a string
reltime() get the current or elapsed time accurately
reltimestr() convert reltime() result to a string
+ reltimefloat() convert reltime() result to a Float
*buffer-functions* *window-functions* *arg-functions*
Buffers, windows and the argument list:
@@ -889,9 +890,14 @@ Mappings: *mapping-functions*
wildmenumode() check if the wildmode is active
Testing: *test-functions*
- assert_equal() assert that two expressions values are equal
+ assert_equal() assert that two expressions values are equal
+ assert_notequal() assert that two expressions values are not equal
+ assert_match() assert that a pattern matches the value
+ assert_notmatch() assert that a pattern does not match the value
assert_false() assert that an expression is false
assert_true() assert that an expression is true
+ assert_exception() assert that a command throws an exception
+ assert_fails() assert that a function call fails
Various: *various-functions*
mode() get current editing mode
diff --git a/runtime/doc/usr_toc.txt b/runtime/doc/usr_toc.txt
index 77ea462a23..e021b806e3 100644
--- a/runtime/doc/usr_toc.txt
+++ b/runtime/doc/usr_toc.txt
@@ -1,4 +1,4 @@
-*usr_toc.txt* For Vim version 7.4. Last change: 2010 Jul 20
+*usr_toc.txt* For Vim version 7.4. Last change: 2016 Mar 25
VIM USER MANUAL - by Bram Moolenaar
@@ -101,10 +101,11 @@ Read this from start to end to learn the essential commands.
|05.1| The vimrc file
|05.2| The example vimrc file explained
|05.3| Simple mappings
- |05.4| Adding a plugin
- |05.5| Adding a help file
- |05.6| The option window
- |05.7| Often used options
+ |05.4| Adding a package
+ |05.5| Adding a plugin
+ |05.6| Adding a help file
+ |05.7| The option window
+ |05.8| Often used options
|usr_06.txt| Using syntax highlighting
|06.1| Switching it on
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index e6b05e1ab1..eb813866da 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt* For Vim version 7.4. Last change: 2016 Feb 18
+*various.txt* For Vim version 7.4. Last change: 2016 Mar 20
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -375,6 +375,7 @@ B *+termguicolors* 24-bit color in xterm-compatible terminals support
N *+termresponse* support for |t_RV| and |v:termresponse|
N *+textobjects* |text-objects| selection
*+tgetent* non-Unix only: able to use external termcap
+N *+timers* the |timer_start()| function
N *+title* Setting the window 'title' and 'icon'
N *+toolbar* |gui-toolbar|
N *+user_commands* User-defined commands. |user-commands|
diff --git a/runtime/ftplugin/eiffel.vim b/runtime/ftplugin/eiffel.vim
new file mode 100644
index 0000000000..216fdde162
--- /dev/null
+++ b/runtime/ftplugin/eiffel.vim
@@ -0,0 +1,96 @@
+" Vim filetype plugin
+" Language: Eiffel
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2010 Aug 29
+
+if (exists("b:did_ftplugin"))
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+setlocal comments=:--
+setlocal commentstring=--\ %s
+
+setlocal formatoptions-=t formatoptions+=croql
+
+if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
+ let b:browsefilter = "Eiffel Source Files (*.e)\t*.e\n" .
+ \ "Eiffel Control Files (*.ecf, *.ace, *.xace)\t*.ecf;*.ace;*.xace\n" .
+ \ "All Files (*.*)\t*.*\n"
+endif
+
+if exists("loaded_matchit") && !exists("b:match_words")
+ let b:match_ignorecase = 0
+ " Silly \%^ trick to match note at head of pair and in middle prevents
+ " 'g%' wrapping from 'note' to 'end'
+ let b:match_words = '\%^:' .
+ \ '\<\%(^note\|indexing\|class\|^obsolete\|inherit\|insert\|^create\|convert\|feature\|^invariant\)\>:' .
+ \ '^end\>,' .
+ \ '\<\%(do\|deferred\|external\|once\%(\s\+"\)\@!\|check\|debug\|if\|inspect\|from\|across\)\>:' .
+ \ '\%(\%(^\s\+\)\@<=\%(then\|until\|loop\)\|\%(then\|until\|loop\)\s\+[^ -]\|' .
+ \ '\<\%(ensure\%(\s\+then\)\=\|rescue\|_then\|elseif\|else\|when\|\s\@<=invariant\|_until\|_loop\|variant\|_as\|alias\)\>\):' .
+ \ '\s\@<=end\>'
+ let b:match_skip = 's:\<eiffel\%(Comment\|String\|Operator\)\>'
+ noremap [% <Nop>
+ noremap ]% <Nop>
+ vnoremap a% <Nop>
+endif
+
+let b:undo_ftplugin = "setl fo< com< cms<" .
+ \ "| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip"
+
+if !exists("g:no_plugin_maps") && !exists("g:no_eiffel_maps")
+ function! s:DoMotion(pattern, count, flags) abort
+ normal! m'
+ for i in range(a:count)
+ call search(a:pattern, a:flags)
+ endfor
+ endfunction
+
+ let sections = '^\%(note\|indexing\|' .
+ \ '\%(\%(deferred\|expanded\|external\|frozen\)\s\+\)*class\|' .
+ \ 'obsolete\|inherit\|insert\|create\|convert\|feature\|' .
+ \ 'invariant\|end\)\>'
+
+ nnoremap <silent> <buffer> ]] :<C-U>call <SID>DoMotion(sections, v:count1, 'W')<CR>
+ xnoremap <silent> <buffer> ]] :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'W')<CR>
+ nnoremap <silent> <buffer> [[ :<C-U>call <SID>DoMotion(sections, v:count1, 'Wb')<CR>
+ xnoremap <silent> <buffer> [[ :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'Wb')<CR>
+
+ function! s:DoFeatureMotion(count, flags)
+ let view = winsaveview()
+ call cursor(1, 1)
+ let [features_start, _] = searchpos('^feature\>')
+ call search('^\s\+\a') " find the first feature
+ let spaces = indent(line('.'))
+ let [features_end, _] = searchpos('^\%(invariant\|note\|end\)\>')
+ call winrestview(view)
+ call s:DoMotion('\%>' . features_start . 'l\%<' . features_end . 'l^\s*\%' . (spaces + 1) . 'v\zs\a', a:count, a:flags)
+ endfunction
+
+ nnoremap <silent> <buffer> ]m :<C-U>call <SID>DoFeatureMotion(v:count1, 'W')<CR>
+ xnoremap <silent> <buffer> ]m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'W')<CR>
+ nnoremap <silent> <buffer> [m :<C-U>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR>
+ xnoremap <silent> <buffer> [m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR>
+
+ let comment_block_start = '^\%(\s\+--.*\n\)\@<!\s\+--'
+ let comment_block_end = '^\s\+--.*\n\%(\s\+--\)\@!'
+
+ nnoremap <silent> <buffer> ]- :<C-U>call <SID>DoMotion(comment_block_start, 1, 'W')<CR>
+ xnoremap <silent> <buffer> ]- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_start, 1, 'W')<CR>
+ nnoremap <silent> <buffer> [- :<C-U>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR>
+ xnoremap <silent> <buffer> [- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR>
+
+ let b:undo_ftplugin = b:undo_ftplugin .
+ \ "| silent! execute 'unmap <buffer> [[' | silent! execute 'unmap <buffer> ]]'" .
+ \ "| silent! execute 'unmap <buffer> [m' | silent! execute 'unmap <buffer> ]m'" .
+ \ "| silent! execute 'unmap <buffer> [-' | silent! execute 'unmap <buffer> ]-'"
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8
diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim
index 43b208b842..4ea3073922 100644
--- a/runtime/ftplugin/r.vim
+++ b/runtime/ftplugin/r.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: R
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Sun Feb 23, 2014 04:07PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Tue Apr 07, 2015 04:38PM
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim
index 9b72fb42f9..fdac38f3e9 100644
--- a/runtime/ftplugin/rhelp.vim
+++ b/runtime/ftplugin/rhelp.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: R help file
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Wed Jul 09, 2014 06:23PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Tue Apr 07, 2015 04:37PM
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim
index 55723ff396..ec64a07675 100644
--- a/runtime/ftplugin/rmd.vim
+++ b/runtime/ftplugin/rmd.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: R help file
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Wed Jul 09, 2014 06:23PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Tue Apr 07, 2015 04:37PM
" Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann)
" Only do this when not yet done for this buffer
diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim
index baf53d0108..e184399dcb 100644
--- a/runtime/ftplugin/rnoweb.vim
+++ b/runtime/ftplugin/rnoweb.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: Rnoweb
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Wed Jul 09, 2014 06:23PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Tue Apr 07, 2015 04:37PM
" Only do this when not yet done for this buffer
if exists("b:did_ftplugin")
diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim
index 8140169e61..ecfd6e87a1 100644
--- a/runtime/ftplugin/rrst.vim
+++ b/runtime/ftplugin/rrst.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
" Language: reStructuredText documentation format with R code
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Wed Jul 09, 2014 06:23PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Tue Apr 07, 2015 04:38PM
" Original work by Alex Zvoleff
" Only do this when not yet done for this buffer
diff --git a/runtime/indent/r.vim b/runtime/indent/r.vim
index 105f0cd7ad..01f3812ed2 100644
--- a/runtime/indent/r.vim
+++ b/runtime/indent/r.vim
@@ -1,7 +1,8 @@
" Vim indent file
" Language: R
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Thu Mar 26, 2015 05:36PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Thu Feb 18, 2016 06:32AM
" Only load this indent file when no other was loaded.
@@ -32,7 +33,7 @@ if ! exists("g:r_indent_ess_compatible")
let g:r_indent_ess_compatible = 0
endif
if ! exists("g:r_indent_op_pattern")
- let g:r_indent_op_pattern = '\(+\|-\|\*\|/\|=\|\~\|%\)$'
+ let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'
endif
function s:RDelete_quotes(line)
@@ -265,7 +266,7 @@ function GetRIndent()
return 0
endif
- if cline =~ '^\s*{'
+ if cline =~ '^\s*{' && s:Get_paren_balance(cline, '{', '}') > 0
if g:r_indent_ess_compatible && line =~ ')$'
let nlnum = lnum
let nline = line
@@ -283,7 +284,7 @@ function GetRIndent()
endif
" line is an incomplete command:
- if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$'
+ if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' || line =~ '->$'
return indent(lnum) + &sw
endif
@@ -344,7 +345,7 @@ function GetRIndent()
endif
let post_block = 0
- if line =~ '}$'
+ if line =~ '}$' && s:Get_paren_balance(line, '{', '}') < 0
let lnum = s:Get_matching_brace(lnum, '{', '}', 0)
let line = SanitizeRLine(getline(lnum))
if lnum > 0 && line =~ '^\s*{'
@@ -359,14 +360,14 @@ function GetRIndent()
let olnum = s:Get_prev_line(lnum)
let oline = getline(olnum)
if olnum > 0
- if line =~ g:r_indent_op_pattern
- if oline =~ g:r_indent_op_pattern
+ if line =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
+ if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum)
else
return indent(lnum) + &sw
endif
else
- if oline =~ g:r_indent_op_pattern
+ if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
return indent(lnum) - &sw
endif
endif
@@ -471,7 +472,6 @@ function GetRIndent()
endif
let ind = indent(lnum)
- let pind = indent(plnum)
if g:r_indent_align_args == 0 && pb != 0
let ind += pb * &sw
@@ -483,6 +483,12 @@ function GetRIndent()
return ind
endif
+ if plnum > 0
+ let pind = indent(plnum)
+ else
+ let pind = 0
+ endif
+
if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0)
return ind
endif
diff --git a/runtime/indent/rhelp.vim b/runtime/indent/rhelp.vim
index 3b37128b2c..9dc2031cb6 100644
--- a/runtime/indent/rhelp.vim
+++ b/runtime/indent/rhelp.vim
@@ -1,7 +1,8 @@
" Vim indent file
" Language: R Documentation (Help), *.Rd
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Thu Oct 16, 2014 07:07AM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Tue Apr 07, 2015 04:38PM
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim
index 9a8a3cb719..88904405e8 100644
--- a/runtime/indent/rmd.vim
+++ b/runtime/indent/rmd.vim
@@ -1,7 +1,8 @@
" Vim indent file
" Language: Rmd
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Thu Jul 10, 2014 07:11PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Tue Apr 07, 2015 04:38PM
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/rnoweb.vim b/runtime/indent/rnoweb.vim
index d0cad3d8d9..29fa5bc78f 100644
--- a/runtime/indent/rnoweb.vim
+++ b/runtime/indent/rnoweb.vim
@@ -1,7 +1,8 @@
" Vim indent file
" Language: Rnoweb
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Sun Mar 22, 2015 09:28AM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Tue Apr 07, 2015 04:38PM
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/rrst.vim b/runtime/indent/rrst.vim
index 8bfa8344ce..f3ee53e7fb 100644
--- a/runtime/indent/rrst.vim
+++ b/runtime/indent/rrst.vim
@@ -1,7 +1,8 @@
" Vim indent file
" Language: Rrst
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
-" Last Change: Wed Jul 09, 2014 07:33PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Tue Apr 07, 2015 04:38PM
" Only load this indent file when no other was loaded.
diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim
index 2d603b0afa..d05bb3770f 100644
--- a/runtime/indent/sh.vim
+++ b/runtime/indent/sh.vim
@@ -3,7 +3,7 @@
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org>
" Original Author: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2016-01-15
+" Latest Revision: 2016-02-15
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-sh-indent
@@ -12,14 +12,14 @@ if exists("b:did_indent")
endif
let b:did_indent = 1
-let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<'
-
setlocal indentexpr=GetShIndent()
setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,0=end,),0=;;,0=;&
setlocal indentkeys+=0=fin,0=fil,0=fip,0=fir,0=fix
setlocal indentkeys-=:,0#
setlocal nosmartindent
+let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<'
+
if exists("*GetShIndent")
finish
endif
@@ -67,7 +67,7 @@ function! GetShIndent()
if !s:is_case_ended(line)
let ind += s:indent_value('case-statements')
endif
- elseif line =~ '^\s*\<\k\+\>\s*()\s*{' || line =~ '^\s*{'
+ elseif line =~ '^\s*\<\k\+\>\s*()\s*{' || line =~ '^\s*{' || line =~ '^\s*function\s*\w\S\+\s*\%(()\)\?\s*{'
if line !~ '}\s*\%(#.*\)\=$'
let ind += s:indent_value('default')
endif
diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim
index 7e3a351083..0150bb9623 100644
--- a/runtime/indent/tex.vim
+++ b/runtime/indent/tex.vim
@@ -2,10 +2,9 @@
" Language: LaTeX
" Maintainer: YiChao Zhou <broken.zhou AT gmail.com>
" Created: Sat, 16 Feb 2002 16:50:19 +0100
-" Last Change: 2012 Mar 18 19:19:50
-" Version: 0.7
-" Please email me if you found something we can do. Bug report and
-" feature request is welcome.
+" Version: 0.9.2
+" Please email me if you found something I can do. Comments, bug report and
+" feature request are welcome.
" Last Update: {{{
" 25th Sep 2002, by LH :
@@ -41,7 +40,7 @@
" (*) Trust user when in "verbatim" and "lstlisting"
" 2012/03/11 by Zhou Yichao <broken.zhou AT gmail.com>
" (*) Modify "&" so that only indent when current line start with
-" "&".
+" "&".
" 2012/03/12 by Zhou Yichao <broken.zhou AT gmail.com>
" (*) Modify indentkeys.
" 2012/03/18 by Zhou Yichao <broken.zhou AT gmail.com>
@@ -49,6 +48,17 @@
" 2013/05/02 by Zhou Yichao <broken.zhou AT gmail.com>
" (*) Fix problem about GetTeXIndent checker. Thank Albert Netymk
" for reporting this.
+" 2014/06/23 by Zhou Yichao <broken.zhou AT gmail.com>
+" (*) Remove the feature g:tex_indent_and because it is buggy.
+" (*) If there is not any obvious indentation hints, we do not
+" alert our user's current indentation.
+" (*) g:tex_indent_brace now only works if the open brace is the
+" last character of that line.
+" 2014/08/03 by Zhou Yichao <broken.zhou AT gmail.com>
+" (*) Indent current line if last line has larger indentation
+" 2014/08/09 by Zhou Yichao <broken.zhou AT gmail.com>
+" (*) Add missing return value for s:GetEndIndentation(...)
+"
" }}}
" Document: {{{
@@ -60,7 +70,17 @@
" * g:tex_indent_brace
"
" If this variable is unset or non-zero, it will use smartindent-like style
-" for "{}" and "[]"
+" for "{}" and "[]". Now this only works if the open brace is the last
+" character of that line.
+"
+" % Example 1
+" \usetikzlibrary{
+" external
+" }
+"
+" % Example 2
+" \tikzexternalize[
+" prefix=tikz]
"
" * g:tex_indent_items
"
@@ -98,14 +118,6 @@
"
" A list of environment names. separated with '\|', where no indentation is
" required. The default is 'document\|verbatim'.
-"
-" * g:tex_indent_and
-"
-" If this variable is unset or zero, vim will try to align the line with first
-" "&". This is pretty useful when you use environment like table or align.
-" Note that this feature need to search back some line, so vim may become
-" a little slow.
-"
" }}}
" Only define the function once
@@ -126,8 +138,8 @@ endif
if !exists("g:tex_indent_brace")
let g:tex_indent_brace = 1
endif
-if !exists("g:tex_indent_and")
- let g:tex_indent_and = 1
+if !exists("g:tex_max_scan_line")
+ let g:tex_max_scan_line = 60
endif
if g:tex_indent_items
if !exists("g:tex_itemize_env")
@@ -140,10 +152,6 @@ else
let g:tex_items = ''
endif
-if !exists("g:tex_indent_paretheses")
- let g:tex_indent_paretheses = 1
-endif
-
if !exists("g:tex_noindent_env")
let g:tex_noindent_env = 'document\|verbatim\|lstlisting'
endif "}}}
@@ -160,6 +168,7 @@ let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '')
function! GetTeXIndent() " {{{
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
+ let cnum = v:lnum
" Comment line is not what we need.
while lnum != 0 && getline(lnum) =~ '^\s*%'
@@ -171,8 +180,8 @@ function! GetTeXIndent() " {{{
return 0
endif
- let line = substitute(getline(lnum), '%.*', ' ','g') " last line
- let cline = substitute(getline(v:lnum), '%.*', ' ', 'g') " current line
+ let line = substitute(getline(lnum), '\s*%.*', '','g') " last line
+ let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line
" We are in verbatim, so do what our user what.
if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone"
@@ -183,26 +192,12 @@ function! GetTeXIndent() " {{{
end
endif
- " You want to align with "&"
- if g:tex_indent_and
- " Align only when current line start with "&"
- if line =~ '&.*\\\\' && cline =~ '^\s*&'
- return indent(v:lnum) + stridx(line, "&") - stridx(cline, "&")
- endif
-
- " set line & lnum to the line which doesn't contain "&"
- while lnum != 0 && (stridx(line, "&") != -1 || line =~ '^\s*%')
- let lnum = prevnonblank(lnum - 1)
- let line = getline(lnum)
- endwhile
- endif
-
-
if lnum == 0
return 0
endif
let ind = indent(lnum)
+ let stay = 1
" New code for comment: retain the indent of current line
if cline =~ '^\s*%'
@@ -216,77 +211,197 @@ function! GetTeXIndent() " {{{
" ZYC modification : \end after \begin won't cause wrong indent anymore
if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env
let ind = ind + &sw
+ let stay = 0
if g:tex_indent_items
" Add another sw for item-environments
if line =~ g:tex_itemize_env
let ind = ind + &sw
+ let stay = 0
endif
endif
endif
+ if cline =~ '\\end{.*}'
+ let retn = s:GetEndIndentation(v:lnum)
+ if retn != -1
+ return retn
+ endif
+ end
" Subtract a 'shiftwidth' when an environment ends
- if cline =~ '\\end{.*}' && cline !~ g:tex_noindent_env
-
+ if cline =~ '\\end{.*}'
+ \ && cline !~ g:tex_noindent_env
+ \ && cline !~ '\\begin{.*}.*\\end{.*}'
if g:tex_indent_items
" Remove another sw for item-environments
if cline =~ g:tex_itemize_env
let ind = ind - &sw
+ let stay = 0
endif
endif
let ind = ind - &sw
+ let stay = 0
endif
if g:tex_indent_brace
- let sum1 = 0
- for i in range(0, strlen(line)-1)
- if line[i] == "}" || line[i] == "]" ||
- \ strpart(line, i, 7) == '\right)'
- let sum1 = max([0, sum1-1])
- endif
- if line[i] == "{" || line[i] == "[" ||
- \ strpart(line, i, 6) == '\left('
- let sum1 += 1
- endif
- endfor
+ let char = line[strlen(line)-1]
+ if char == '[' || char == '{'
+ let ind += &sw
+ let stay = 0
+ endif
- let sum2 = 0
- for i in reverse(range(0, strlen(cline)-1))
- if cline[i] == "{" || cline[i] == "[" ||
- \ strpart(cline, i, 6) == '\left('
- let sum2 = max([0, sum2-1])
- endif
- if cline[i] == "}" || cline[i] == "]" ||
- \ strpart(cline, i, 7) == '\right)'
- let sum2 += 1
+ let cind = indent(v:lnum)
+ let char = cline[cind]
+ if (char == ']' || char == '}') &&
+ \ s:CheckPairedIsLastCharacter(v:lnum, cind)
+ let ind -= &sw
+ let stay = 0
+ endif
+
+ for i in range(indent(lnum)+1, strlen(line)-1)
+ let char = line[i]
+ if char == ']' || char == '}'
+ if s:CheckPairedIsLastCharacter(lnum, i)
+ let ind -= &sw
+ let stay = 0
+ endif
endif
endfor
-
- let ind += (sum1 - sum2) * &sw
- endif
-
- if g:tex_indent_paretheses
endif
" Special treatment for 'item'
" ----------------------------
if g:tex_indent_items
-
" '\item' or '\bibitem' itself:
if cline =~ g:tex_items
let ind = ind - &sw
+ let stay = 0
endif
-
" lines following to '\item' are intented once again:
if line =~ g:tex_items
let ind = ind + &sw
+ let stay = 0
+ endif
+ endif
+
+ if stay
+ " If there is no obvious indentation hint, we trust our user.
+ if empty(cline)
+ return ind
+ else
+ return max([indent(v:lnum), s:GetLastBeginIndentation(v:lnum)])
+ endif
+ else
+ return ind
+ endif
+endfunction "}}}
+
+function! s:GetLastBeginIndentation(lnum) " {{{
+ let matchend = 1
+ for lnum in range(a:lnum-1, max([a:lnum - g:tex_max_scan_line, 1]), -1)
+ let line = getline(lnum)
+ if line =~ '\\end{.*}'
+ let matchend += 1
+ endif
+ if line =~ '\\begin{.*}'
+ let matchend -= 1
endif
+ if matchend == 0
+ if line =~ g:tex_itemize_env
+ return indent(lnum) + 2 * &sw
+ endif
+ if line =~ g:tex_noindent_env
+ return indent(lnum)
+ endif
+ return indent(lnum) + &sw
+ endif
+ endfor
+ return -1
+endfunction
+
+function! s:GetEndIndentation(lnum) " {{{
+ if getline(a:lnum) =~ '\\begin{.*}.*\\end{.*}'
+ return -1
+ endif
+
+ let min_indent = 100
+ let matchend = 1
+ for lnum in range(a:lnum-1, max([a:lnum-g:tex_max_scan_line, 1]), -1)
+ let line = getline(lnum)
+ if line =~ '\\end{.*}'
+ let matchend += 1
+ endif
+ if line =~ '\\begin{.*}'
+ let matchend -= 1
+ endif
+ if matchend == 0
+ return indent(lnum)
+ endif
+ if !empty(line)
+ let min_indent = min([min_indent, indent(lnum)])
+ endif
+ endfor
+ return min_indent - &sw
+endfunction
+
+" Most of the code is from matchparen.vim
+function! s:CheckPairedIsLastCharacter(lnum, col) "{{{
+ " Get the character under the cursor and check if it's in 'matchpairs'.
+ let c_lnum = a:lnum
+ let c_col = a:col+1
+
+
+ let c = getline(c_lnum)[c_col-1]
+ let plist = split(&matchpairs, '.\zs[:,]')
+ let i = index(plist, c)
+ if i < 0
+ return 0
+ endif
+
+ " Figure out the arguments for searchpairpos().
+ if i % 2 == 0
+ let s_flags = 'nW'
+ let c2 = plist[i + 1]
+ else
+ let s_flags = 'nbW'
+ let c2 = c
+ let c = plist[i - 1]
+ endif
+ if c == '['
+ let c = '\['
+ let c2 = '\]'
+ endif
+
+ " Find the match. When it was just before the cursor move it there for a
+ " moment.
+ let save_cursor = winsaveview()
+ call cursor(c_lnum, c_col)
+
+ " When not in a string or comment ignore matches inside them.
+ " We match "escape" for special items, such as lispEscapeSpecial.
+ let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
+ \ '=~? "string\\|character\\|singlequote\\|escape\\|comment"'
+ execute 'if' s_skip '| let s_skip = 0 | endif'
+
+ let stopline = max([0, c_lnum - g:tex_max_scan_line])
+
+ " Limit the search time to 300 msec to avoid a hang on very long lines.
+ " This fails when a timeout is not supported.
+ try
+ let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 100)
+ catch /E118/
+ endtry
+
+ call winrestview(save_cursor)
+ if m_lnum > 0
+ let line = getline(m_lnum)
+ return strlen(line) == m_col
endif
- return ind
+ return 0
endfunction "}}}
let &cpo = s:cpo_save
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 68444dde01..bfcf4d5294 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2015 Jul 22
+" Last Change: 2016 Mar 19
" If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0
@@ -228,6 +228,8 @@ else
endif
call append("$", "runtimepath\tlist of directories used for runtime files and plugins")
call <SID>OptionG("rtp", &rtp)
+call append("$", "packpath\tlist of directories used for plugin packages")
+call <SID>OptionG("pp", &pp)
call append("$", "helpfile\tname of the main help file")
call <SID>OptionG("hf", &hf)
diff --git a/runtime/autoload/vimball.vim b/runtime/pack/dist/opt/vimball/autoload/vimball.vim
index 9a5a73c3c1..1af6b19c88 100644
--- a/runtime/autoload/vimball.vim
+++ b/runtime/pack/dist/opt/vimball/autoload/vimball.vim
@@ -1,9 +1,9 @@
" vimball.vim : construct a file containing both paths and files
-" Author: Charles E. Campbell, Jr.
-" Date: Jan 17, 2012
-" Version: 35
+" Author: Charles E. Campbell
+" Date: Apr 11, 2016
+" Version: 37
" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
-" Copyright: (c) 2004-2011 by Charles E. Campbell, Jr.
+" Copyright: (c) 2004-2011 by Charles E. Campbell
" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
" (see |copyright|) except use "Vimball" instead of "Vim".
" No warranty, express or implied.
@@ -14,7 +14,7 @@
if &cp || exists("g:loaded_vimball")
finish
endif
-let g:loaded_vimball = "v35"
+let g:loaded_vimball = "v37"
if v:version < 702
echohl WarningMsg
echo "***warning*** this version of vimball needs vim 7.2"
@@ -142,7 +142,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
let lastline= line("$") + 1
if lastline == 2 && getline("$") == ""
- call setline(1,'" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.')
+ call setline(1,'" Vimball Archiver by Charles E. Campbell')
call setline(2,'UseVimball')
call setline(3,'finish')
let lastline= line("$") + 1
@@ -179,7 +179,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range
" remove the evidence
setlocal nomod bh=wipe
exe "tabn ".curtabnr
- exe "tabc ".vbtabnr
+ exe "tabc! ".vbtabnr
" restore options
call vimball#RestoreSettings()
@@ -280,7 +280,7 @@ fun! vimball#Vimball(really,...)
" when AsNeeded/filename is filereadable or was present in VimballRecord
if fname =~ '\<plugin/'
let anfname= substitute(fname,'\<plugin/','AsNeeded/','')
- if filereadable(anfname) || (exists("s:VBRstring") && s:VBRstring =~ anfname)
+ if filereadable(anfname) || (exists("s:VBRstring") && s:VBRstring =~# anfname)
" call Decho("using anfname<".anfname."> instead of <".fname.">")
let fname= anfname
endif
@@ -379,10 +379,10 @@ fun! vimball#Vimball(really,...)
call s:RecordInFile(home)
" restore events, delete tab and buffer
- exe "tabn ".vbtabnr
+ exe "sil! tabn ".vbtabnr
setlocal nomod bh=wipe
- exe "tabn ".curtabnr
- exe "tabc ".vbtabnr
+ exe "sil! tabn ".curtabnr
+ exe "sil! tabc! ".vbtabnr
call vimball#RestoreSettings()
call s:ChgDir(curdir)
@@ -555,7 +555,7 @@ fun! vimball#ShowMesg(level,msg)
set noruler noshowcmd
redraw!
- if &fo =~ '[ta]'
+ if &fo =~# '[ta]'
echomsg "***vimball*** ".a:msg
else
if a:level == s:WARNING || a:level == s:USAGE
@@ -715,7 +715,7 @@ fun! vimball#SaveSettings()
" call Dfunc("SaveSettings()")
let s:makeep = getpos("'a")
let s:regakeep= @a
- if exists("&acd")
+ if exists("+acd")
let s:acdkeep = &acd
endif
let s:eikeep = &ei
@@ -728,7 +728,7 @@ fun! vimball#SaveSettings()
let s:vekeep = &ve
let s:ffkeep = &l:ff
let s:swfkeep = &l:swf
- if exists("&acd")
+ if exists("+acd")
setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf
else
setlocal ei=all ve=all nofen noic report=999 nohid bt= ma lz pm= ff=unix noswf
@@ -743,7 +743,7 @@ endfun
fun! vimball#RestoreSettings()
" call Dfunc("RestoreSettings()")
let @a = s:regakeep
- if exists("&acd")
+ if exists("+acd")
let &acd = s:acdkeep
endif
let &l:fen = s:fenkeep
@@ -760,7 +760,7 @@ fun! vimball#RestoreSettings()
" call Decho("restore mark-a: makeep=".string(makeep))
call setpos("'a",s:makeep)
endif
- if exists("&acd")
+ if exists("+acd")
unlet s:acdkeep
endif
unlet s:regakeep s:eikeep s:fenkeep s:hidkeep s:ickeep s:repkeep s:vekeep s:makeep s:lzkeep s:pmkeep s:ffkeep
diff --git a/runtime/doc/pi_vimball.txt b/runtime/pack/dist/opt/vimball/doc/vimball.txt
index bbc74988ca..9965a216e4 100644
--- a/runtime/doc/pi_vimball.txt
+++ b/runtime/pack/dist/opt/vimball/doc/vimball.txt
@@ -1,4 +1,4 @@
-*pi_vimball.txt* For Vim version 7.4. Last change: 2012 Jan 17
+*vimball.txt* For Vim version 7.4. Last change: 2012 Jan 17
----------------
Vimball Archiver
diff --git a/runtime/pack/dist/opt/vimball/plugin/vimballPlugin.vim b/runtime/pack/dist/opt/vimball/plugin/vimballPlugin.vim
new file mode 100644
index 0000000000..d7473a0296
--- /dev/null
+++ b/runtime/pack/dist/opt/vimball/plugin/vimballPlugin.vim
@@ -0,0 +1,43 @@
+" vimballPlugin : construct a file containing both paths and files
+" Author: Charles E. Campbell
+" Copyright: (c) 2004-2014 by Charles E. Campbell
+" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
+" (see |copyright|) except use "Vimball" instead of "Vim".
+" No warranty, express or implied.
+" *** *** Use At-Your-Own-Risk! *** ***
+"
+" (Rom 2:1 WEB) Therefore you are without excuse, O man, whoever you are who
+" judge. For in that which you judge another, you condemn yourself. For
+" you who judge practice the same things.
+" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
+
+" ---------------------------------------------------------------------
+" Load Once: {{{1
+if &cp || exists("g:loaded_vimballPlugin")
+ finish
+endif
+let g:loaded_vimballPlugin = "v37"
+let s:keepcpo = &cpo
+set cpo&vim
+
+" ------------------------------------------------------------------------------
+" Public Interface: {{{1
+com! -range -complete=file -nargs=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>)
+com! -nargs=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>)
+com! -nargs=0 VimballList call vimball#Vimball(0)
+com! -nargs=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings()
+augroup Vimball
+ au!
+ au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif
+ au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif
+ au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
+ au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|if line('$') > 1|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")|endif
+ au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz let s:origfile=expand("%")|if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if s:origfile!=expand("<afile>")|close|endif
+ au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
+augroup END
+
+" =====================================================================
+" Restoration And Modelines: {{{1
+" vim: fdm=marker
+let &cpo= s:keepcpo
+unlet s:keepcpo
diff --git a/runtime/plugin/vimballPlugin.vim b/runtime/plugin/vimballPlugin.vim
deleted file mode 100644
index 59279774ca..0000000000
--- a/runtime/plugin/vimballPlugin.vim
+++ /dev/null
@@ -1,40 +0,0 @@
-" vimballPlugin : construct a file containing both paths and files
-" Author: Charles E. Campbell, Jr.
-" Copyright: (c) 2004-2010 by Charles E. Campbell, Jr.
-" The VIM LICENSE applies to Vimball.vim, and Vimball.txt
-" (see |copyright|) except use "Vimball" instead of "Vim".
-" No warranty, express or implied.
-" *** *** Use At-Your-Own-Risk! *** ***
-"
-" (Rom 2:1 WEB) Therefore you are without excuse, O man, whoever you are who
-" judge. For in that which you judge another, you condemn yourself. For
-" you who judge practice the same things.
-" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim
-
-" ---------------------------------------------------------------------
-" Load Once: {{{1
-if &cp || exists("g:loaded_vimballPlugin")
- finish
-endif
-let g:loaded_vimballPlugin = "v35"
-let s:keepcpo = &cpo
-set cpo&vim
-
-" ------------------------------------------------------------------------------
-" Public Interface: {{{1
-com! -ra -complete=file -na=+ -bang MkVimball call vimball#MkVimball(<line1>,<line2>,<bang>0,<f-args>)
-com! -na=? -complete=dir UseVimball call vimball#Vimball(1,<f-args>)
-com! -na=0 VimballList call vimball#Vimball(0)
-com! -na=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings()
-au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
-au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip,*.vba.xz if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if expand("%")!=expand("<afile>")|close|endif
-au SourceCmd *.vba if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
-au BufEnter *.vmb,*.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'|setlocal ma ff=unix noma|endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
-au SourceCmd *.vmb.gz,*.vmb.bz2,*.vmb.zip,*.vmb.xz if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|endif|call vimball#Decompress(expand("<amatch>"))|so %|if expand("%")!=expand("<afile>")|close|endif
-au SourceCmd *.vmb if expand("%")!=expand("<afile>") | exe "1sp" fnameescape(expand("<afile>"))|call vimball#Vimball(1)|close|else|call vimball#Vimball(1)|endif
-
-" =====================================================================
-" Restoration And Modelines: {{{1
-" vim: fdm=marker
-let &cpo= s:keepcpo
-unlet s:keepcpo
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index 32b63e09e4..3fe3256059 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2016 Feb 08
+" Last Change: 2016 Apr 10
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -248,6 +248,10 @@ if !exists("c_no_c99") " ISO C99
syn keyword cType _Bool bool _Complex complex _Imaginary imaginary
syn keyword cType int8_t int16_t int32_t int64_t
syn keyword cType uint8_t uint16_t uint32_t uint64_t
+ if !exists("c_no_bsd")
+ " These are BSD specific.
+ syn keyword cType u_int8_t u_int16_t u_int32_t u_int64_t
+ endif
syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t
syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t
syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t
diff --git a/runtime/syntax/fortran.vim b/runtime/syntax/fortran.vim
index 26d063524e..b470e56f60 100644
--- a/runtime/syntax/fortran.vim
+++ b/runtime/syntax/fortran.vim
@@ -1,15 +1,16 @@
" Vim syntax file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
-" Version: 0.96
-" Last Change: 2015 Nov. 30
+" Version: 0.97
+" Last Change: 2016 Feb. 26
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
" Usage: For instructions, do :help fortran-syntax from Vim
" Credits:
-" Version 0.1 was based on the fortran 77 syntax file by Mario Eusebio and
-" Preben Guldberg. Useful suggestions and contributions were made by: Andrej Panjkov,
-" Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile,
+" Version 0.1 (April 2000) was based on the fortran 77 syntax file by Mario Eusebio and
+" Preben Guldberg. Since then, useful suggestions and contributions have been made,
+" in chronological order, by:
+" Andrej Panjkov, Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile,
" Walter Dieudonné, Alexander Wagner, Roman Bertle, Charles Rendleman,
-" Andrew Griffiths, Joe Krahn, Hendrik Merx, and Matt Thompson.
+" Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, and Jan Hermann.
if exists("b:current_syntax")
finish
@@ -407,7 +408,7 @@ if exists("fortran_fold")
else
syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
syn region fortran90Loop transparent fold keepend extend start="\(\<end\s\+\)\@<!\<do\(\s\+\a\|\s*$\)" skip="^\s*[!#].*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
- syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(.\+)\s*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
+ syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(\(.\|&\s*\n\)\+)\(\s\|&\s*\n\)*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
syn region fortranCase transparent fold keepend extend start="\<select\s*case\>" skip="^\s*[!#].*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
endif
endif
diff --git a/runtime/syntax/mysql.vim b/runtime/syntax/mysql.vim
index c01ecc192b..d7cf74710d 100644
--- a/runtime/syntax/mysql.vim
+++ b/runtime/syntax/mysql.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: mysql
" Maintainer: Kenneth J. Pronovici <pronovic@ieee.org>
-" Last Change: $LastChangedDate: 2010-04-22 09:48:02 -0500 (Thu, 22 Apr 2010) $
+" Last Change: $LastChangedDate: 2016-04-11 10:31:04 -0500 (Mon, 11 Apr 2016) $
" Filenames: *.mysql
" URL: ftp://cedar-solutions.com/software/mysql.vim
" Note: The definitions below are taken from the mysql user manual as of April 2002, for version 3.23
@@ -18,7 +18,7 @@ endif
syn case ignore
" General keywords which don't fall into other categories
-syn keyword mysqlKeyword action add after aggregate all alter as asc auto_increment avg avg_row_length
+syn keyword mysqlKeyword action add after aggregate all alter as asc auto_increment avg_row_length
syn keyword mysqlKeyword both by
syn keyword mysqlKeyword cascade change character check checksum column columns comment constraint create cross
syn keyword mysqlKeyword current_date current_time current_timestamp
@@ -30,7 +30,7 @@ syn keyword mysqlKeyword global grant grants group
syn keyword mysqlKeyword having heap high_priority hosts hour hour_minute hour_second
syn keyword mysqlKeyword identified ignore index infile inner insert insert_id into isam
syn keyword mysqlKeyword join
-syn keyword mysqlKeyword key keys kill last_insert_id leading left limit lines load local lock logs long
+syn keyword mysqlKeyword key keys kill last_insert_id leading left limit lines load local lock logs long
syn keyword mysqlKeyword low_priority
syn keyword mysqlKeyword match max_rows middleint min_rows minute minute_second modify month myisam
syn keyword mysqlKeyword natural no
@@ -64,6 +64,9 @@ syn match mysqlNumber "\<0x[abcdefABCDEF0-9]*\>"
" User variables
syn match mysqlVariable "@\a*[A-Za-z0-9]*\([._]*[A-Za-z0-9]\)*"
+" Escaped column names
+syn match mysqlEscaped "`[^`]*`"
+
" Comments (c-style, mysql-style and modified sql-style)
syn region mysqlComment start="/\*" end="\*/"
syn match mysqlComment "#.*"
@@ -84,14 +87,14 @@ syn sync ccomment mysqlComment
" The second problem is that some of these keywords are included in
" function names. For instance, year() is part of the name of the
" dayofyear() function, and the dec keyword (no parenthesis) is part of
-" the name of the decode() function.
+" the name of the decode() function.
-syn keyword mysqlType tinyint smallint mediumint int integer bigint
-syn keyword mysqlType date datetime time bit bool
+syn keyword mysqlType tinyint smallint mediumint int integer bigint
+syn keyword mysqlType date datetime time bit bool
syn keyword mysqlType tinytext mediumtext longtext text
syn keyword mysqlType tinyblob mediumblob longblob blob
-syn region mysqlType start="float\W" end="."me=s-1
-syn region mysqlType start="float$" end="."me=s-1
+syn region mysqlType start="float\W" end="."me=s-1
+syn region mysqlType start="float$" end="."me=s-1
syn region mysqlType start="float(" end=")" contains=mysqlNumber,mysqlVariable
syn region mysqlType start="double\W" end="."me=s-1
syn region mysqlType start="double$" end="."me=s-1
@@ -139,12 +142,12 @@ syn region mysqlFlow start="if(" end=")" contains=ALL
"
" I'm leery of just defining keywords for functions, since according to the MySQL manual:
"
-" Function names do not clash with table or column names. For example, ABS is a
-" valid column name. The only restriction is that for a function call, no spaces
-" are allowed between the function name and the `(' that follows it.
+" Function names do not clash with table or column names. For example, ABS is a
+" valid column name. The only restriction is that for a function call, no spaces
+" are allowed between the function name and the `(' that follows it.
"
-" This means that if I want to highlight function names properly, I have to use a
-" region to define them, not just a keyword. This will probably cause the syntax file
+" This means that if I want to highlight function names properly, I have to use a
+" region to define them, not just a keyword. This will probably cause the syntax file
" to load more slowly, but at least it will be 'correct'.
syn region mysqlFunction start="abs(" end=")" contains=ALL
@@ -154,6 +157,7 @@ syn region mysqlFunction start="ascii(" end=")" contains=ALL
syn region mysqlFunction start="asin(" end=")" contains=ALL
syn region mysqlFunction start="atan(" end=")" contains=ALL
syn region mysqlFunction start="atan2(" end=")" contains=ALL
+syn region mysqlFunction start="avg(" end=")" contains=ALL
syn region mysqlFunction start="benchmark(" end=")" contains=ALL
syn region mysqlFunction start="bin(" end=")" contains=ALL
syn region mysqlFunction start="bit_and(" end=")" contains=ALL
diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim
index 78d35e4c15..2a0ea5de2b 100644
--- a/runtime/syntax/python.vim
+++ b/runtime/syntax/python.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Python
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
-" Last Change: 2015 Sep 15
+" Last Change: 2016 Feb 20
" Credits: Neil Schemenauer <nas@python.ca>
" Dmitry Vasiliev
"
@@ -199,6 +199,8 @@ if !exists("python_no_builtin_highlight")
syn keyword pythonBuiltin ascii bytes exec
" non-essential built-in functions; Python 2 only
syn keyword pythonBuiltin apply buffer coerce intern
+ " avoid highlighting attributes as builtins
+ syn match pythonAttribute /\.\h\w*/hs=s+1 contains=ALLBUT,pythonBuiltin transparent
endif
" From the 'Python Library Reference' class hierarchy at the bottom.
diff --git a/runtime/syntax/r.vim b/runtime/syntax/r.vim
index e48b6686cb..d96bf96acb 100644
--- a/runtime/syntax/r.vim
+++ b/runtime/syntax/r.vim
@@ -5,17 +5,21 @@
" Tom Payne <tom@tompayne.org>
" Contributor: Johannes Ranke <jranke@uni-bremen.de>
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
-" Last Change: Wed Oct 21, 2015 06:33AM
+" Last Change: Thu Mar 10, 2016 12:26PM
" Filenames: *.R *.r *.Rhistory *.Rt
"
" NOTE: The highlighting of R functions is defined in
" runtime files created by a filetype plugin, if installed.
"
" CONFIGURATION:
-" syntax folding can be turned on by
+" Syntax folding can be turned on by
"
" let r_syntax_folding = 1
"
+" ROxygen highlighting can be turned off by
+"
+" let r_hl_roxygen = 0
+"
" Some lines of code were borrowed from Zhuojun Chen.
if exists("b:current_syntax")
@@ -24,9 +28,12 @@ endif
setlocal iskeyword=@,48-57,_,.
-if exists("g:r_syntax_folding")
+if exists("g:r_syntax_folding") && g:r_syntax_folding
setlocal foldmethod=syntax
endif
+if !exists("g:r_hl_roxygen")
+ let g:r_hl_roxygen = 1
+endif
syn case match
@@ -35,18 +42,20 @@ syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*"
" Roxygen
-syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend
-syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey
-syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained
-
-syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword
-
-syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)"
-syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
-syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
-syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
-syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
-syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)"
+if g:r_hl_roxygen
+ syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend
+ syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey
+ syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained
+
+ syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword
+
+ syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)"
+ syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
+ syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
+ syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
+ syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
+ syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)"
+endif
if &filetype == "rhelp"
@@ -159,12 +168,13 @@ syn match rBraceError "[)}]" contained
syn match rCurlyError "[)\]]" contained
syn match rParenError "[\]}]" contained
-" Source list of R functions produced by a filetype plugin (if installed)
-if has("nvim")
- " Nvim-R
+if !exists("g:R_hi_fun")
+ let g:R_hi_fun = 1
+endif
+if g:R_hi_fun
+ " Nvim-R:
runtime R/functions.vim
-else
- " Vim-R-plugin
+ " Vim-R-plugin:
runtime r-plugin/functions.vim
endif
@@ -235,11 +245,13 @@ hi def link rStatement Statement
hi def link rString String
hi def link rStrError Error
hi def link rType Type
-hi def link rOKeyword Title
-hi def link rOBlock Comment
-hi def link rOTitle Title
-hi def link rOCommentKey Comment
-hi def link rOExamples SpecialComment
+if g:r_hl_roxygen
+ hi def link rOKeyword Title
+ hi def link rOBlock Comment
+ hi def link rOTitle Title
+ hi def link rOCommentKey Comment
+ hi def link rOExamples SpecialComment
+endif
let b:current_syntax="r"
diff --git a/runtime/syntax/rhelp.vim b/runtime/syntax/rhelp.vim
index 32c91add48..47c764e296 100644
--- a/runtime/syntax/rhelp.vim
+++ b/runtime/syntax/rhelp.vim
@@ -2,25 +2,21 @@
" Language: R Help File
" Maintainer: Jakson Aquino <jalvesaq@gmail.com>
" Former Maintainer: Johannes Ranke <jranke@uni-bremen.de>
-" Last Change: Wed Jul 09, 2014 10:28PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Sat Feb 06, 2016 11:34AM
" Remarks: - Includes R syntax highlighting in the appropriate
" sections if an r.vim file is in the same directory or in the
" default debian location.
" - There is no Latex markup in equations
" - Thanks to Will Gray for finding and fixing a bug
-" - No support for \if, \ifelse and \out as I don't understand
-" them and have no examples at hand (help welcome).
-" - No support for \var tag within quoted string (dito)
+" - No support for \var tag within quoted string
" Version Clears: {{{1
-" For version 5.x: Clear all syntax items
-" For version 6.x and 7.x: Quit when a syntax file was already loaded
-if version < 600
- syntax clear
-elseif exists("b:current_syntax")
+if exists("b:current_syntax")
finish
endif
+scriptencoding utf-8
setlocal iskeyword=@,48-57,_,.
syn case match
@@ -29,9 +25,11 @@ syn case match
syn region rhelpIdentifier matchgroup=rhelpSection start="\\name{" end="}"
syn region rhelpIdentifier matchgroup=rhelpSection start="\\alias{" end="}"
syn region rhelpIdentifier matchgroup=rhelpSection start="\\pkg{" end="}" contains=rhelpLink
+syn region rhelpIdentifier matchgroup=rhelpSection start="\\CRANpkg{" end="}" contains=rhelpLink
syn region rhelpIdentifier matchgroup=rhelpSection start="\\method{" end="}" contained
syn region rhelpIdentifier matchgroup=rhelpSection start="\\Rdversion{" end="}"
+
" Highlighting of R code using an existing r.vim syntax file if available {{{1
syn include @R syntax/r.vim
@@ -69,76 +67,115 @@ syn match rhelpDelimiter "\\cr"
syn match rhelpDelimiter "\\tab "
" Keywords {{{1
-syn match rhelpKeyword "\\R"
-syn match rhelpKeyword "\\ldots"
+syn match rhelpKeyword "\\R\>"
+syn match rhelpKeyword "\\ldots\>"
+syn match rhelpKeyword "\\sspace\>"
syn match rhelpKeyword "--"
syn match rhelpKeyword "---"
-syn match rhelpKeyword "<"
-syn match rhelpKeyword ">"
-syn match rhelpKeyword "\\ge"
-syn match rhelpKeyword "\\le"
-syn match rhelpKeyword "\\alpha"
-syn match rhelpKeyword "\\beta"
-syn match rhelpKeyword "\\gamma"
-syn match rhelpKeyword "\\delta"
-syn match rhelpKeyword "\\epsilon"
-syn match rhelpKeyword "\\zeta"
-syn match rhelpKeyword "\\eta"
-syn match rhelpKeyword "\\theta"
-syn match rhelpKeyword "\\iota"
-syn match rhelpKeyword "\\kappa"
-syn match rhelpKeyword "\\lambda"
-syn match rhelpKeyword "\\mu"
-syn match rhelpKeyword "\\nu"
-syn match rhelpKeyword "\\xi"
-syn match rhelpKeyword "\\omicron"
-syn match rhelpKeyword "\\pi"
-syn match rhelpKeyword "\\rho"
-syn match rhelpKeyword "\\sigma"
-syn match rhelpKeyword "\\tau"
-syn match rhelpKeyword "\\upsilon"
-syn match rhelpKeyword "\\phi"
-syn match rhelpKeyword "\\chi"
-syn match rhelpKeyword "\\psi"
-syn match rhelpKeyword "\\omega"
-syn match rhelpKeyword "\\Alpha"
-syn match rhelpKeyword "\\Beta"
-syn match rhelpKeyword "\\Gamma"
-syn match rhelpKeyword "\\Delta"
-syn match rhelpKeyword "\\Epsilon"
-syn match rhelpKeyword "\\Zeta"
-syn match rhelpKeyword "\\Eta"
-syn match rhelpKeyword "\\Theta"
-syn match rhelpKeyword "\\Iota"
-syn match rhelpKeyword "\\Kappa"
-syn match rhelpKeyword "\\Lambda"
-syn match rhelpKeyword "\\Mu"
-syn match rhelpKeyword "\\Nu"
-syn match rhelpKeyword "\\Xi"
-syn match rhelpKeyword "\\Omicron"
-syn match rhelpKeyword "\\Pi"
-syn match rhelpKeyword "\\Rho"
-syn match rhelpKeyword "\\Sigma"
-syn match rhelpKeyword "\\Tau"
-syn match rhelpKeyword "\\Upsilon"
-syn match rhelpKeyword "\\Phi"
-syn match rhelpKeyword "\\Chi"
-syn match rhelpKeyword "\\Psi"
-syn match rhelpKeyword "\\Omega"
-" Links {{{1
-syn region rhelpLink matchgroup=rhelpSection start="\\link{" end="}" contained keepend extend
-syn region rhelpLink matchgroup=rhelpSection start="\\link\[.\{-}\]{" end="}" contained keepend extend
-syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend extend
+" Condition Keywords {{{2
+syn match rhelpKeyword "\\if\>"
+syn match rhelpKeyword "\\ifelse\>"
+syn match rhelpKeyword "\\out\>"
+" Examples of usage:
+" \ifelse{latex}{\eqn{p = 5 + 6 - 7 \times 8}}{\eqn{p = 5 + 6 - 7 * 8}}
+" \ifelse{latex}{\out{$\alpha$}}{\ifelse{html}{\out{&alpha;}}{alpha}}
-" Verbatim like {{{1
-if v:version > 703
- syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
- syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
+" Keywords and operators valid only if in math mode {{{2
+syn match rhelpMathOp "<" contained
+syn match rhelpMathOp ">" contained
+syn match rhelpMathOp "+" contained
+syn match rhelpMathOp "-" contained
+syn match rhelpMathOp "=" contained
+
+" Conceal function based on syntax/tex.vim {{{2
+if exists("g:tex_conceal")
+ let s:tex_conceal = g:tex_conceal
else
- syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment
- syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment
+ let s:tex_conceal = 'gm'
endif
+function s:HideSymbol(pat, cchar, hide)
+ if a:hide
+ exe "syn match rhelpMathSymb '" . a:pat . "' contained conceal cchar=" . a:cchar
+ else
+ exe "syn match rhelpMathSymb '" . a:pat . "' contained"
+ endif
+endfunction
+
+" Math symbols {{{2
+if s:tex_conceal =~ 'm'
+ let s:hd = 1
+else
+ let s:hd = 0
+endif
+call s:HideSymbol('\\infty\>', '∞', s:hd)
+call s:HideSymbol('\\ge\>', '≥', s:hd)
+call s:HideSymbol('\\le\>', '≤', s:hd)
+call s:HideSymbol('\\prod\>', 'âˆ', s:hd)
+call s:HideSymbol('\\sum\>', '∑', s:hd)
+syn match rhelpMathSymb "\\sqrt\>" contained
+
+" Greek letters {{{2
+if s:tex_conceal =~ 'g'
+ let s:hd = 1
+else
+ let s:hd = 0
+endif
+call s:HideSymbol('\\alpha\>', 'α', s:hd)
+call s:HideSymbol('\\beta\>', 'β', s:hd)
+call s:HideSymbol('\\gamma\>', 'γ', s:hd)
+call s:HideSymbol('\\delta\>', 'δ', s:hd)
+call s:HideSymbol('\\epsilon\>', 'ϵ', s:hd)
+call s:HideSymbol('\\zeta\>', 'ζ', s:hd)
+call s:HideSymbol('\\eta\>', 'η', s:hd)
+call s:HideSymbol('\\theta\>', 'θ', s:hd)
+call s:HideSymbol('\\iota\>', 'ι', s:hd)
+call s:HideSymbol('\\kappa\>', 'κ', s:hd)
+call s:HideSymbol('\\lambda\>', 'λ', s:hd)
+call s:HideSymbol('\\mu\>', 'μ', s:hd)
+call s:HideSymbol('\\nu\>', 'ν', s:hd)
+call s:HideSymbol('\\xi\>', 'ξ', s:hd)
+call s:HideSymbol('\\pi\>', 'Ï€', s:hd)
+call s:HideSymbol('\\rho\>', 'Ï', s:hd)
+call s:HideSymbol('\\sigma\>', 'σ', s:hd)
+call s:HideSymbol('\\tau\>', 'Ï„', s:hd)
+call s:HideSymbol('\\upsilon\>', 'Ï…', s:hd)
+call s:HideSymbol('\\phi\>', 'Ï•', s:hd)
+call s:HideSymbol('\\chi\>', 'χ', s:hd)
+call s:HideSymbol('\\psi\>', 'ψ', s:hd)
+call s:HideSymbol('\\omega\>', 'ω', s:hd)
+call s:HideSymbol('\\Gamma\>', 'Γ', s:hd)
+call s:HideSymbol('\\Delta\>', 'Δ', s:hd)
+call s:HideSymbol('\\Theta\>', 'Θ', s:hd)
+call s:HideSymbol('\\Lambda\>', 'Λ', s:hd)
+call s:HideSymbol('\\Xi\>', 'Ξ', s:hd)
+call s:HideSymbol('\\Pi\>', 'Π', s:hd)
+call s:HideSymbol('\\Sigma\>', 'Σ', s:hd)
+call s:HideSymbol('\\Upsilon\>', 'Î¥', s:hd)
+call s:HideSymbol('\\Phi\>', 'Φ', s:hd)
+call s:HideSymbol('\\Psi\>', 'Ψ', s:hd)
+call s:HideSymbol('\\Omega\>', 'Ω', s:hd)
+delfunction s:HideSymbol
+" Note: The letters 'omicron', 'Alpha', 'Beta', 'Epsilon', 'Zeta', 'Eta',
+" 'Iota', 'Kappa', 'Mu', 'Nu', 'Omicron', 'Rho', 'Tau' and 'Chi' are listed
+" at src/library/tools/R/Rd2txt.R because they are valid in HTML, although
+" they do not make valid LaTeX code (e.g. &Alpha; versus \Alpha).
+
+" Links {{{1
+syn region rhelpLink matchgroup=rhelpType start="\\link{" end="}" contained keepend extend
+syn region rhelpLink matchgroup=rhelpType start="\\link\[.\{-}\]{" end="}" contained keepend extend
+syn region rhelpLink matchgroup=rhelpType start="\\linkS4class{" end="}" contained keepend extend
+syn region rhelpLink matchgroup=rhelpType start="\\url{" end="}" contained keepend extend
+syn region rhelpLink matchgroup=rhelpType start="\\href{" end="}" contained keepend extend
+syn region rhelpLink matchgroup=rhelpType start="\\figure{" end="}" contained keepend extend
+
+" Verbatim like {{{1
+syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
+syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
+
+" Equation {{{1
+syn region rhelpEquation matchgroup=rhelpType start="\\eqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend
+syn region rhelpEquation matchgroup=rhelpType start="\\deqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend
" Type Styles {{{1
syn match rhelpType "\\emph\>"
@@ -148,12 +185,9 @@ syn match rhelpType "\\sQuote\>"
syn match rhelpType "\\dQuote\>"
syn match rhelpType "\\preformatted\>"
syn match rhelpType "\\kbd\>"
-syn match rhelpType "\\eqn\>"
-syn match rhelpType "\\deqn\>"
syn match rhelpType "\\file\>"
syn match rhelpType "\\email\>"
-syn match rhelpType "\\url\>"
-syn match rhelpType "\\href\>"
+syn match rhelpType "\\enc\>"
syn match rhelpType "\\var\>"
syn match rhelpType "\\env\>"
syn match rhelpType "\\option\>"
@@ -163,6 +197,7 @@ syn match rhelpType "\\renewcommand\>"
syn match rhelpType "\\dfn\>"
syn match rhelpType "\\cite\>"
syn match rhelpType "\\acronym\>"
+syn match rhelpType "\\doi\>"
" rhelp sections {{{1
syn match rhelpSection "\\encoding\>"
@@ -202,9 +237,9 @@ syn match rhelpDelimiter "{\|\[\|(\|)\|\]\|}"
syn match rhelpComment /%.*$/
" Error {{{1
-syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
-syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
-syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
+syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation
+syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation
+syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation
syn match rhelpError /[)\]}]/
syn match rhelpBraceError /[)}]/ contained
syn match rhelpCurlyError /[)\]]/ contained
@@ -213,36 +248,27 @@ syn match rhelpParenError /[\]}]/ contained
syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{"
" Define the default highlighting {{{1
-" For version 5.7 and earlier: only when not done already
-" For version 5.8 and later: only when an item doesn't have highlighting yet
-if version >= 508 || !exists("did_rhelp_syntax_inits")
- if version < 508
- let did_rhelp_syntax_inits = 1
- command -nargs=+ HiLink hi link <args>
- else
- command -nargs=+ HiLink hi def link <args>
- endif
- HiLink rhelpVerbatim String
- HiLink rhelpDelimiter Delimiter
- HiLink rhelpIdentifier Identifier
- HiLink rhelpString String
- HiLink rhelpCodeSpecial Special
- HiLink rhelpKeyword Keyword
- HiLink rhelpDots Keyword
- HiLink rhelpLink Underlined
- HiLink rhelpType Type
- HiLink rhelpSection PreCondit
- HiLink rhelpError Error
- HiLink rhelpBraceError Error
- HiLink rhelpCurlyError Error
- HiLink rhelpParenError Error
- HiLink rhelpPreProc PreProc
- HiLink rhelpDelimiter Delimiter
- HiLink rhelpComment Comment
- HiLink rhelpRComment Comment
- HiLink rhelpSpecialChar SpecialChar
- delcommand HiLink
-endif
+hi def link rhelpVerbatim String
+hi def link rhelpDelimiter Delimiter
+hi def link rhelpIdentifier Identifier
+hi def link rhelpString String
+hi def link rhelpCodeSpecial Special
+hi def link rhelpKeyword Keyword
+hi def link rhelpDots Keyword
+hi def link rhelpLink Underlined
+hi def link rhelpType Type
+hi def link rhelpSection PreCondit
+hi def link rhelpError Error
+hi def link rhelpBraceError Error
+hi def link rhelpCurlyError Error
+hi def link rhelpParenError Error
+hi def link rhelpPreProc PreProc
+hi def link rhelpDelimiter Delimiter
+hi def link rhelpComment Comment
+hi def link rhelpRComment Comment
+hi def link rhelpSpecialChar SpecialChar
+hi def link rhelpMathSymb Special
+hi def link rhelpMathOp Operator
let b:current_syntax = "rhelp"
diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim
index 6f1b847453..4cde7441d3 100644
--- a/runtime/syntax/rmd.vim
+++ b/runtime/syntax/rmd.vim
@@ -1,15 +1,13 @@
" markdown Text with R statements
" Language: markdown with R code chunks
-" Last Change: Wed Jul 09, 2014 10:29PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Sat Feb 06, 2016 06:45AM
"
" CONFIGURATION:
" To highlight chunk headers as R code, put in your vimrc:
" let rmd_syn_hl_chunk = 1
-" for portability
-if version < 600
- syntax clear
-elseif exists("b:current_syntax")
+if exists("b:current_syntax")
finish
endif
@@ -58,6 +56,8 @@ if rmdIsPandoc == 0
if exists("b:current_syntax")
unlet b:current_syntax
endif
+ " Extend cluster
+ syn cluster texMathZoneGroup add=rmdrInline
" Inline
syntax match rmdLaTeXInlDelim "\$"
syntax match rmdLaTeXInlDelim "\\\$"
diff --git a/runtime/syntax/rnoweb.vim b/runtime/syntax/rnoweb.vim
index 7d42395b5c..665acc53e2 100644
--- a/runtime/syntax/rnoweb.vim
+++ b/runtime/syntax/rnoweb.vim
@@ -1,20 +1,14 @@
" Vim syntax file
" Language: R noweb Files
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
-" Last Change: 2009 May 05
-" Version: 0.9
-" SVN: $Id: rnoweb.vim 84 2009-05-03 19:52:47Z ranke $
+" Last Change: Sat Feb 06, 2016 06:47AM
+" Version: 0.9.1
" Remarks: - This file is inspired by the proposal of
-" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
-" http://www.ime.usp.br/~feferraz/en/sweavevim.html
+" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
+" http://www.ime.usp.br/~feferraz/en/sweavevim.html
"
-" Version Clears: {{{1
-" For version 5.x: Clear all syntax items
-" For version 6.x and 7.x: Quit when a syntax file was already loaded
-if version < 600
- syntax clear
-elseif exists("b:current_syntax")
+if exists("b:current_syntax")
finish
endif
@@ -26,21 +20,22 @@ unlet b:current_syntax
syn cluster texMatchGroup add=@rnoweb
syn cluster texMathMatchGroup add=rnowebSexpr
+syn cluster texMathZoneGroup add=rnowebSexpr
syn cluster texEnvGroup add=@rnoweb
syn cluster texFoldGroup add=@rnoweb
-syn cluster texDocGroup add=@rnoweb
-syn cluster texPartGroup add=@rnoweb
-syn cluster texChapterGroup add=@rnoweb
-syn cluster texSectionGroup add=@rnoweb
-syn cluster texSubSectionGroup add=@rnoweb
-syn cluster texSubSubSectionGroup add=@rnoweb
-syn cluster texParaGroup add=@rnoweb
+syn cluster texDocGroup add=@rnoweb
+syn cluster texPartGroup add=@rnoweb
+syn cluster texChapterGroup add=@rnoweb
+syn cluster texSectionGroup add=@rnoweb
+syn cluster texSubSectionGroup add=@rnoweb
+syn cluster texSubSubSectionGroup add=@rnoweb
+syn cluster texParaGroup add=@rnoweb
" Highlighting of R code using an existing r.vim syntax file if available {{{1
syn include @rnowebR syntax/r.vim
syn region rnowebChunk matchgroup=rnowebDelimiter start="^<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend
syn match rnowebChunkReference "^<<.*>>$" contained
-syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR
+syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR contained
" Sweave options command {{{1
syn region rnowebSweaveopts matchgroup=Delimiter start="\\SweaveOpts{" matchgroup=Delimiter end="}"
diff --git a/runtime/syntax/rrst.vim b/runtime/syntax/rrst.vim
index 4667b3a2c1..24d3844df0 100644
--- a/runtime/syntax/rrst.vim
+++ b/runtime/syntax/rrst.vim
@@ -1,16 +1,14 @@
" reStructured Text with R statements
" Language: reST with R code chunks
" Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu
-" Last Change: Wed Jul 09, 2014 10:29PM
+" Homepage: https://github.com/jalvesaq/R-Vim-runtime
+" Last Change: Sat Feb 06, 2016 06:45AM
"
" CONFIGURATION:
" To highlight chunk headers as R code, put in your vimrc:
" let rrst_syn_hl_chunk = 1
-" for portability
-if version < 600
- syntax clear
-elseif exists("b:current_syntax")
+if exists("b:current_syntax")
finish
endif
diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim
index 15a00eb516..6ef5bf0d16 100644
--- a/runtime/syntax/sh.vim
+++ b/runtime/syntax/sh.vim
@@ -2,8 +2,8 @@
" Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
-" Last Change: Feb 16, 2016
-" Version: 144
+" Last Change: Apr 11, 2016
+" Version: 147
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr)
@@ -185,7 +185,7 @@ endif
" Options: {{{1
" ====================
-syn match shOption "\s\zs[-+][-_a-zA-Z0-9#]\+"
+syn match shOption "\s\zs[-+][-_a-zA-Z#@]\+"
syn match shOption "\s\zs--[^ \t$`'"|);]\+"
" File Redirection Highlighted As Operators: {{{1
@@ -317,7 +317,8 @@ syn match shColon '^\s*\zs:'
" String And Character Constants: {{{1
"================================
-syn match shNumber "-\=\<\d\+\>#\="
+syn match shNumber "\<\d\+\>#\="
+syn match shNumber "-\=\.\=\d\+\>#\="
syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained
if exists("b:is_bash")
syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
@@ -538,13 +539,20 @@ endif
" Synchronization: {{{1
" ================
-if !exists("sh_minlines")
- let sh_minlines = 200
+if !exists("g:sh_minlines")
+ let s:sh_minlines = 200
+else
+ let s:sh_minlines= g:sh_minlines
endif
-if !exists("sh_maxlines")
- let sh_maxlines = 2 * sh_minlines
+if !exists("g:sh_maxlines")
+ let s:sh_maxlines = 2*s:sh_minlines
+ if s:sh_maxlines < 25
+ let s:sh_maxlines= 25
+ endif
+else
+ let s:sh_maxlines= g:sh_maxlines
endif
-exec "syn sync minlines=" . sh_minlines . " maxlines=" . sh_maxlines
+exec "syn sync minlines=" . s:sh_minlines . " maxlines=" . s:sh_maxlines
syn sync match shCaseEsacSync grouphere shCaseEsac "\<case\>"
syn sync match shCaseEsacSync groupthere shCaseEsac "\<esac\>"
syn sync match shDoSync grouphere shDo "\<do\>"
diff --git a/runtime/syntax/sshconfig.vim b/runtime/syntax/sshconfig.vim
index ef2ca07976..44b3c67a96 100644
--- a/runtime/syntax/sshconfig.vim
+++ b/runtime/syntax/sshconfig.vim
@@ -4,8 +4,8 @@
" Maintainer: Dominik Fischer <d dot f dot fischer at web dot de>
" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de>
" Contributor: Karsten Hopp <karsten@redhat.com>
-" Last Change: 2016 Jan 15
-" SSH Version: 7.1
+" Last Change: 2016 Mar 1
+" SSH Version: 7.2
"
" Setup
@@ -40,26 +40,57 @@ syn keyword sshconfigYesNo yes no ask
syn keyword sshconfigYesNo any auto
syn keyword sshconfigYesNo force autoask none
-syn keyword sshconfigCipher 3des blowfish
-syn keyword sshconfigCiphers aes128-cbc 3des-cbc blowfish blowfish-cbc cast128-cbc
-syn keyword sshconfigCiphers aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr
-syn keyword sshconfigCiphers arcfour arcfour128 arcfour256 cast128-cbc
+syn keyword sshconfigCipher 3des blowfish
-syn keyword sshconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96
-syn keyword sshconfigMAC hmac-md5-96
-syn keyword sshconfigMAC hmac-sha2-256 hmac-sha2-256-96 hmac-sha2-512
-syn keyword sshconfigMAC hmac-sha2-512-96
+syn keyword sshconfigCiphers 3des-cbc
+syn keyword sshconfigCiphers blowfish-cbc
+syn keyword sshconfigCiphers cast128-cbc
+syn keyword sshconfigCiphers arcfour
+syn keyword sshconfigCiphers arcfour128
+syn keyword sshconfigCiphers arcfour256
+syn keyword sshconfigCiphers aes128-cbc
+syn keyword sshconfigCiphers aes192-cbc
+syn keyword sshconfigCiphers aes256-cbc
+syn match sshconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>"
+syn keyword sshconfigCiphers aes128-ctr
+syn keyword sshconfigCiphers aes192-ctr
+syn keyword sshconfigCiphers aes256-ctr
+syn match sshconfigCiphers "\<aes128-gcm@openssh\.com\>"
+syn match sshconfigCiphers "\<aes256-gcm@openssh\.com\>"
+syn match sshconfigCiphers "\<chacha20-poly1305@openssh\.com\>"
+
+syn keyword sshconfigMAC hmac-sha1
+syn keyword sshconfigMAC mac-sha1-96
+syn keyword sshconfigMAC mac-sha2-256
+syn keyword sshconfigMAC mac-sha2-512
+syn keyword sshconfigMAC mac-md5
+syn keyword sshconfigMAC mac-md5-96
+syn keyword sshconfigMAC mac-ripemd160
+syn match sshconfigMAC "\<hmac-ripemd160@openssh\.com\>"
syn match sshconfigMAC "\<umac-64@openssh\.com\>"
+syn match sshconfigMAC "\<umac-128@openssh\.com\>"
+syn match sshconfigMAC "\<hmac-sha1-etm@openssh\.com\>"
+syn match sshconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>"
+syn match sshconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>"
+syn match sshconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>"
+syn match sshconfigMAC "\<hmac-md5-etm@openssh\.com\>"
+syn match sshconfigMAC "\<hmac-md5-96-etm@openssh\.com\>"
+syn match sshconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>"
+syn match sshconfigMAC "\<umac-64-etm@openssh\.com\>"
+syn match sshconfigMAC "\<umac-128-etm@openssh\.com\>"
-syn keyword sshconfigHostKeyAlg ssh-rsa ssh-dss
-syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>"
-syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>"
-syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>"
-syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v01@openssh\.com\>"
-syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v01@openssh\.com\>"
-syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v00@openssh\.com\>"
-syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v00@openssh\.com\>"
-syn keyword sshconfigHostKeyAlg ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521
+syn keyword sshconfigHostKeyAlgo ssh-ed25519
+syn match sshconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>"
+syn keyword sshconfigHostKeyAlgo ssh-rsa
+syn keyword sshconfigHostKeyAlgo ssh-dss
+syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp256
+syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp384
+syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp521
+syn match sshconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>"
+syn match sshconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>"
+syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>"
+syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>"
+syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>"
syn keyword sshconfigPreferredAuth hostbased publickey password gssapi-with-mic
syn keyword sshconfigPreferredAuth keyboard-interactive
@@ -78,11 +109,14 @@ syn match sshconfigIPQoS "cs[0-7]"
syn keyword sshconfigIPQoS ef lowdelay throughput reliability
syn keyword sshconfigKbdInteractive bsdauth pam skey
-syn keyword sshconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521
-syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256
-syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1
-syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1
-syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1
+syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1
+syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1
+syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1
+syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256
+syn keyword sshconfigKexAlgo ecdh-sha2-nistp256
+syn keyword sshconfigKexAlgo ecdh-sha2-nistp384
+syn keyword sshconfigKexAlgo ecdh-sha2-nistp521
+syn match sshconfigKexAlgo "\<curve25519-sha256@libssh\.org\>"
syn keyword sshconfigTunnel point-to-point ethernet
@@ -111,6 +145,7 @@ syn keyword sshconfigKeyword CanonicalDomains
syn keyword sshconfigKeyword CanonicalizeFallbackLocal
syn keyword sshconfigKeyword CanonicalizeHostname
syn keyword sshconfigKeyword CanonicalizeMaxDots
+syn keyword sshconfigKeyword CertificateFile
syn keyword sshconfigKeyword ChallengeResponseAuthentication
syn keyword sshconfigKeyword CheckHostIP
syn keyword sshconfigKeyword Cipher
@@ -212,7 +247,7 @@ if version >= 508 || !exists("did_sshconfig_syntax_inits")
HiLink sshconfigCipher sshconfigEnum
HiLink sshconfigCiphers sshconfigEnum
HiLink sshconfigMAC sshconfigEnum
- HiLink sshconfigHostKeyAlg sshconfigEnum
+ HiLink sshconfigHostKeyAlgo sshconfigEnum
HiLink sshconfigLogLevel sshconfigEnum
HiLink sshconfigSysLogFacility sshconfigEnum
HiLink sshconfigAddressFamily sshconfigEnum
diff --git a/runtime/syntax/sshdconfig.vim b/runtime/syntax/sshdconfig.vim
index 4203047d2c..6b7b98d893 100644
--- a/runtime/syntax/sshdconfig.vim
+++ b/runtime/syntax/sshdconfig.vim
@@ -6,8 +6,8 @@
" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de>
" Contributor: Karsten Hopp <karsten@redhat.com>
" Originally: 2009-07-09
-" Last Change: 2016 Jan 12
-" SSH Version: 7.1
+" Last Change: 2016 Mar 1
+" SSH Version: 7.2
"
" Setup
@@ -47,15 +47,55 @@ syn keyword sshdconfigTcpForwarding local remote
syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only
-syn keyword sshdconfigCipher aes128-cbc 3des-cbc blowfish-cbc cast128-cbc
-syn keyword sshdconfigCipher aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr
-syn keyword sshdconfigCipher arcfour arcfour128 arcfour256 cast128-cbc
-
-syn keyword sshdconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96
-syn keyword sshdconfigMAC hmac-md5-96
-syn keyword sshdconfigMAC hmac-sha2-256 hmac-sha256-96 hmac-sha2-512
-syn keyword sshdconfigMAC hmac-sha2-512-96
+syn keyword sshdconfigCiphers 3des-cbc
+syn keyword sshdconfigCiphers blowfish-cbc
+syn keyword sshdconfigCiphers cast128-cbc
+syn keyword sshdconfigCiphers arcfour
+syn keyword sshdconfigCiphers arcfour128
+syn keyword sshdconfigCiphers arcfour256
+syn keyword sshdconfigCiphers aes128-cbc
+syn keyword sshdconfigCiphers aes192-cbc
+syn keyword sshdconfigCiphers aes256-cbc
+syn match sshdconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>"
+syn keyword sshdconfigCiphers aes128-ctr
+syn keyword sshdconfigCiphers aes192-ctr
+syn keyword sshdconfigCiphers aes256-ctr
+syn match sshdconfigCiphers "\<aes128-gcm@openssh\.com\>"
+syn match sshdconfigCiphers "\<aes256-gcm@openssh\.com\>"
+syn match sshdconfigCiphers "\<chacha20-poly1305@openssh\.com\>"
+
+syn keyword sshdconfigMAC hmac-sha1
+syn keyword sshdconfigMAC mac-sha1-96
+syn keyword sshdconfigMAC mac-sha2-256
+syn keyword sshdconfigMAC mac-sha2-512
+syn keyword sshdconfigMAC mac-md5
+syn keyword sshdconfigMAC mac-md5-96
+syn keyword sshdconfigMAC mac-ripemd160
+syn match sshdconfigMAC "\<hmac-ripemd160@openssh\.com\>"
syn match sshdconfigMAC "\<umac-64@openssh\.com\>"
+syn match sshdconfigMAC "\<umac-128@openssh\.com\>"
+syn match sshdconfigMAC "\<hmac-sha1-etm@openssh\.com\>"
+syn match sshdconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>"
+syn match sshdconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>"
+syn match sshdconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>"
+syn match sshdconfigMAC "\<hmac-md5-etm@openssh\.com\>"
+syn match sshdconfigMAC "\<hmac-md5-96-etm@openssh\.com\>"
+syn match sshdconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>"
+syn match sshdconfigMAC "\<umac-64-etm@openssh\.com\>"
+syn match sshdconfigMAC "\<umac-128-etm@openssh\.com\>"
+
+syn keyword sshdconfigHostKeyAlgo ssh-ed25519
+syn match sshdconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>"
+syn keyword sshdconfigHostKeyAlgo ssh-rsa
+syn keyword sshdconfigHostKeyAlgo ssh-dss
+syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp256
+syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp384
+syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp521
+syn match sshdconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>"
+syn match sshdconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>"
+syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>"
+syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>"
+syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>"
syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only
@@ -73,11 +113,14 @@ syn match sshdconfigIPQoS "af4[123]"
syn match sshdconfigIPQoS "cs[0-7]"
syn keyword sshdconfigIPQoS ef lowdelay throughput reliability
-syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521
-syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256
-syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1
-syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1
-syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1
+syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1
+syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1
+syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1
+syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256
+syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256
+syn keyword sshdconfigKexAlgo ecdh-sha2-nistp384
+syn keyword sshdconfigKexAlgo ecdh-sha2-nistp521
+syn match sshdconfigKexAlgo "\<curve25519-sha256@libssh\.org\>"
syn keyword sshdconfigTunnel point-to-point ethernet
@@ -215,8 +258,9 @@ if version >= 508 || !exists("did_sshdconfig_syntax_inits")
HiLink sshdconfigPrivilegeSeparation sshdconfigEnum
HiLink sshdconfigTcpForwarding sshdconfigEnum
HiLink sshdconfigRootLogin sshdconfigEnum
- HiLink sshdconfigCipher sshdconfigEnum
+ HiLink sshdconfigCiphers sshdconfigEnum
HiLink sshdconfigMAC sshdconfigEnum
+ HiLink sshdconfigHostKeyAlgo sshdconfigEnum
HiLink sshdconfigRootLogin sshdconfigEnum
HiLink sshdconfigLogLevel sshdconfigEnum
HiLink sshdconfigSysLogFacility sshdconfigEnum
diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim
index 40013b5b99..d6d5dd81ee 100644
--- a/runtime/syntax/tex.vim
+++ b/runtime/syntax/tex.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: TeX
" Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM>
-" Last Change: Jan 20, 2016
-" Version: 91
+" Last Change: Apr 11, 2016
+" Version: 94
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
"
" Notes: {{{1
@@ -83,10 +83,14 @@ else
let s:tex_conceal= g:tex_conceal
endif
if !exists("g:tex_superscripts")
- let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]"
+ let s:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]"
+else
+ let s:tex_superscripts= g:tex_superscripts
endif
if !exists("g:tex_subscripts")
- let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]"
+ let s:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]"
+else
+ let s:tex_subscripts= g:tex_subscripts
endif
" Determine whether or not to use "*.sty" mode {{{1
@@ -200,7 +204,7 @@ if !exists("g:tex_no_math")
endif
" Try to flag {} and () mismatches: {{{1
-if s:tex_fast =~ 'm'
+if s:tex_fast =~# 'm'
if !s:tex_no_error
syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" transparent contains=@texMatchGroup,texError
syn region texMatcher matchgroup=Delimiter start="\[" end="]" transparent contains=@texMatchGroup,texError,@NoSpell
@@ -217,7 +221,7 @@ endif
if !s:tex_no_error
syn match texError "[}\])]"
endif
-if s:tex_fast =~ 'M'
+if s:tex_fast =~# 'M'
if !exists("g:tex_no_math")
if !s:tex_no_error
syn match texMathError "}" contained
@@ -260,14 +264,14 @@ syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$"
" \begin{}/\end{} section markers: {{{1
syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName
-if s:tex_fast =~ 'm'
+if s:tex_fast =~# 'm'
syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment
syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@NoSpell
endif
" \documentclass, \documentstyle, \usepackage: {{{1
syn match texDocType "\\documentclass\>\|\\documentstyle\>\|\\usepackage\>" nextgroup=texBeginEndName,texDocTypeArgs
-if s:tex_fast =~ 'm'
+if s:tex_fast =~# 'm'
syn region texDocTypeArgs matchgroup=Delimiter start="\[" end="]" contained nextgroup=texBeginEndName contains=texComment,@NoSpell
endif
@@ -281,7 +285,7 @@ syn match texInput "\\input\s\+[a-zA-Z/.0-9_^]\+"hs=s+7 contains=texStatemen
syn match texInputFile "\\include\(graphics\|list\)\=\(\[.\{-}\]\)\=\s*{.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
syn match texInputFile "\\\(epsfig\|input\|usepackage\)\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt
syn match texInputCurlies "[{}]" contained
-if s:tex_fast =~ 'm'
+if s:tex_fast =~# 'm'
syn region texInputFileOpt matchgroup=Delimiter start="\[" end="\]" contained contains=texComment
endif
@@ -296,7 +300,7 @@ syn match texTypeStyle "\\sc\>"
syn match texTypeStyle "\\tt\>"
" Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1
-if s:tex_conceal !~ 'b'
+if s:tex_conceal !~# 'b'
syn match texTypeStyle "\\textbf\>"
syn match texTypeStyle "\\textit\>"
endif
@@ -349,7 +353,7 @@ syn match texSpaceCode "\\\(math\|cat\|del\|lc\|sf\|uc\)code`"me=e-1 nextgroup=
syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained
" Sections, subsections, etc: {{{1
-if s:tex_fast =~ 'p'
+if s:tex_fast =~# 'p'
if !s:tex_nospell
TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell
TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell
@@ -376,8 +380,8 @@ if s:tex_fast =~ 'p'
endif
" particular support for bold and italic {{{1
-if s:tex_fast =~ 'b'
- if s:tex_conceal =~ 'b'
+if s:tex_fast =~# 'b'
+ if s:tex_conceal =~# 'b'
if !exists("g:tex_nospell") || !g:tex_nospell
syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup,@Spell
syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup,@Spell
@@ -414,7 +418,7 @@ if !exists("g:tex_no_math")
let foldcmd= ""
endif
exe "syn cluster texMathZones add=".grpname
- if s:tex_fast =~ 'M'
+ if s:tex_fast =~# 'M'
exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd
exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
@@ -424,7 +428,7 @@ if !exists("g:tex_no_math")
let grpname = "texMathZone".a:sfx.'S'
let syncname = "texSyncMathZone".a:sfx.'S'
exe "syn cluster texMathZones add=".grpname
- if s:tex_fast =~ 'M'
+ if s:tex_fast =~# 'M'
exe 'syn region '.grpname.' start='."'".'\\begin\s*{\s*'.a:mathzone.'\*\s*}'."'".' end='."'".'\\end\s*{\s*'.a:mathzone.'\*\s*}'."'".' keepend contains=@texMathZoneGroup'.foldcmd
exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
exe 'syn sync match '.syncname.' grouphere '.grpname.' "\\begin\s*{\s*'.a:mathzone.'\*\s*}"'
@@ -448,8 +452,8 @@ if !exists("g:tex_no_math")
call TexNewMathZone("L","xxalignat",0)
" Inline Math Zones: {{{2
- if s:tex_fast =~ 'M'
- if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'd'
+ if s:tex_fast =~# 'M'
+ if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~# 'd'
syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
@@ -466,7 +470,7 @@ if !exists("g:tex_no_math")
syn match texMathOper "[_^=]" contained
" Text Inside Math Zones: {{{2
- if s:tex_fast =~ 'M'
+ if s:tex_fast =~# 'M'
if !exists("g:tex_nospell") || !g:tex_nospell
syn region texMathText matchgroup=texStatement start='\\\(\(inter\)\=text\|mbox\)\s*{' end='}' contains=@texFoldGroup,@Spell
else
@@ -476,7 +480,7 @@ if !exists("g:tex_no_math")
" \left..something.. and \right..something.. support: {{{2
syn match texMathDelimBad contained "\S"
- if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~ 'm'
+ if has("conceal") && &enc == 'utf-8' && s:tex_conceal =~# 'm'
syn match texMathDelim contained "\\left\\{\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar={
syn match texMathDelim contained "\\right\\}\>" skipwhite nextgroup=texMathDelimSet1,texMathDelimSet2,texMathDelimBad contains=texMathSymbol cchar=}
let s:texMathDelimList=[
@@ -541,7 +545,7 @@ if !exists("g:tex_no_math")
syn match texOnlyMath "[_^]"
endif
syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S"
-if s:tex_conceal !~ 'S'
+if s:tex_conceal !~# 'S'
syn match texSpecialChar '\\glq\>' contained conceal cchar=‚
syn match texSpecialChar '\\grq\>' contained conceal cchar=‘
syn match texSpecialChar '\\glqq\>' contained conceal cchar=„
@@ -568,13 +572,13 @@ else
" allows syntax-folding of 2 or more contiguous comment lines
" single-line comments are not folded
syn match texComment "%.*$" contains=@texCommentGroup
- if s:tex_fast =~ 'c'
+ if s:tex_fast =~# 'c'
TexFold syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' contains=@texCommentGroup
TexFold syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell
endif
else
syn match texComment "%.*$" contains=@texCommentGroup
- if s:tex_fast =~ 'c'
+ if s:tex_fast =~# 'c'
syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell
endif
endif
@@ -583,7 +587,7 @@ endif
" Separate lines used for verb` and verb# so that the end conditions {{{1
" will appropriately terminate.
" If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there.
-if s:tex_fast =~ 'v'
+if s:tex_fast =~# 'v'
if exists("g:tex_verbspell") && g:tex_verbspell
syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell
" listings package:
@@ -614,7 +618,7 @@ if s:tex_fast =~ 'v'
endif
" Tex Reference Zones: {{{1
-if s:tex_fast =~ 'r'
+if s:tex_fast =~# 'r'
syn region texZone matchgroup=texStatement start="@samp{" end="}\|%stopzone\>" contains=@texRefGroup
syn region texRefZone matchgroup=texStatement start="\\nocite{" end="}\|%stopzone\>" contains=@texRefGroup
syn region texRefZone matchgroup=texStatement start="\\bibliography{" end="}\|%stopzone\>" contains=@texRefGroup
@@ -628,13 +632,13 @@ syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
" Handle newcommand, newenvironment : {{{1
syn match texNewCmd "\\newcommand\>" nextgroup=texCmdName skipwhite skipnl
-if s:tex_fast =~ 'V'
+if s:tex_fast =~# 'V'
syn region texCmdName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texCmdArgs,texCmdBody skipwhite skipnl
syn region texCmdArgs contained matchgroup=Delimiter start="\["rs=s+1 end="]" nextgroup=texCmdBody skipwhite skipnl
syn region texCmdBody contained matchgroup=Delimiter start="{"rs=s+1 skip="\\\\\|\\[{}]" matchgroup=Delimiter end="}" contains=@texCmdGroup
endif
syn match texNewEnv "\\newenvironment\>" nextgroup=texEnvName skipwhite skipnl
-if s:tex_fast =~ 'V'
+if s:tex_fast =~# 'V'
syn region texEnvName contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvBgn skipwhite skipnl
syn region texEnvBgn contained matchgroup=Delimiter start="{"rs=s+1 end="}" nextgroup=texEnvEnd skipwhite skipnl contains=@texEnvGroup
syn region texEnvEnd contained matchgroup=Delimiter start="{"rs=s+1 end="}" skipwhite skipnl contains=@texEnvGroup
@@ -660,11 +664,11 @@ syn match texString "\(``\|''\|,,\)"
" makeatletter -- makeatother sections
if !s:tex_no_error
- if s:tex_fast =~ 'S'
+ if s:tex_fast =~# 'S'
syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained
endif
syn match texStyleStatement "\\[a-zA-Z@]\+" contained
- if s:tex_fast =~ 'S'
+ if s:tex_fast =~# 'S'
syn region texStyleMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texStyleGroup,texError contained
syn region texStyleMatcher matchgroup=Delimiter start="\[" end="]" contains=@texStyleGroup,texError contained
endif
@@ -675,7 +679,7 @@ if has("conceal") && &enc == 'utf-8'
" Math Symbols {{{2
" (many of these symbols were contributed by Björn Winckler)
- if s:tex_conceal =~ 'm'
+ if s:tex_conceal =~# 'm'
let s:texMathList=[
\ ['|' , '‖'],
\ ['aleph' , 'ℵ'],
@@ -956,7 +960,7 @@ if has("conceal") && &enc == 'utf-8'
" \ ['uminus' , 'X']
" \ ['uplus' , 'X']
for texmath in s:texMathList
- if texmath[0] =~ '\w$'
+ if texmath[0] =~# '\w$'
exe "syn match texMathSymbol '\\\\".texmath[0]."\\>' contained conceal cchar=".texmath[1]
else
exe "syn match texMathSymbol '\\\\".texmath[0]."' contained conceal cchar=".texmath[1]
@@ -995,7 +999,7 @@ if has("conceal") && &enc == 'utf-8'
endif
" Greek {{{2
- if s:tex_conceal =~ 'g'
+ if s:tex_conceal =~# 'g'
fun! s:Greek(group,pat,cchar)
exe 'syn match '.a:group." '".a:pat."' contained conceal cchar=".a:cchar
endfun
@@ -1042,14 +1046,14 @@ if has("conceal") && &enc == 'utf-8'
endif
" Superscripts/Subscripts {{{2
- if s:tex_conceal =~ 's'
- if s:tex_fast =~ 's'
+ if s:tex_conceal =~# 's'
+ if s:tex_fast =~# 's'
syn region texSuperscript matchgroup=Delimiter start='\^{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSuperscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
syn region texSubscript matchgroup=Delimiter start='_{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher
endif
" s:SuperSub:
fun! s:SuperSub(group,leader,pat,cchar)
- if a:pat =~ '^\\' || (a:leader == '\^' && a:pat =~ g:tex_superscripts) || (a:leader == '_' && a:pat =~ g:tex_subscripts)
+ if a:pat =~# '^\\' || (a:leader == '\^' && a:pat =~# s:tex_superscripts) || (a:leader == '_' && a:pat =~# s:tex_subscripts)
" call Decho("SuperSub: group<".a:group."> leader<".a:leader."> pat<".a:pat."> cchar<".a:cchar.">")
exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
exe 'syn match '.a:group."s '".a:pat ."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
@@ -1154,7 +1158,7 @@ if has("conceal") && &enc == 'utf-8'
endif
" Accented characters: {{{2
- if s:tex_conceal =~ 'a'
+ if s:tex_conceal =~# 'a'
if b:tex_stylish
syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
@@ -1169,7 +1173,7 @@ if has("conceal") && &enc == 'utf-8'
let i= i + 1
continue
endif
- if accent =~ '\a'
+ if accent =~# '\a'
exe "syn match texAccent '".'\\'.accent.'\(\s*{'.a:chr.'}\|\s\+'.a:chr.'\)'."' conceal cchar=".a:{i}
else
exe "syn match texAccent '".'\\'.accent.'\s*\({'.a:chr.'}\|'.a:chr.'\)'."' conceal cchar=".a:{i}
diff --git a/runtime/syntax/vhdl.vim b/runtime/syntax/vhdl.vim
index 916bd9635d..32503823ee 100644
--- a/runtime/syntax/vhdl.vim
+++ b/runtime/syntax/vhdl.vim
@@ -1,14 +1,10 @@
" Vim syntax file
-" Language: VHDL
-" Maintainer: Daniel Kho <daniel.kho@tauhop.com>
+" Language: VHDL [VHSIC (Very High Speed Integrated Circuit) Hardware Description Language]
+" Maintainer: Daniel Kho <daniel.kho@tauhop.com>
" Previous Maintainer: Czo <Olivier.Sirol@lip6.fr>
-" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn>
-" Last Changed: 2015 Dec 4 by Daniel Kho
+" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn>
+" Last Changed: 2016 Mar 05 by Daniel Kho
-" VHSIC (Very High Speed Integrated Circuit) Hardware Description Language
-
-" For version 5.x: Clear all syntax items
-" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
@@ -56,17 +52,40 @@ syn keyword vhdlStatement note warning error failure
syn match vhdlStatement "\<\(if\|else\)\>"
syn match vhdlError "\<else\s\+if\>"
-" Predefined VHDL types
-syn keyword vhdlType bit bit_vector
-syn keyword vhdlType character boolean integer real time
-syn keyword vhdlType boolean_vector integer_vector real_vector time_vector
-syn keyword vhdlType string severity_level
-" Predefined standard ieee VHDL types
-syn keyword vhdlType positive natural signed unsigned
-syn keyword vhdlType unresolved_signed unresolved_unsigned u_signed u_unsigned
-syn keyword vhdlType line text
-syn keyword vhdlType std_logic std_logic_vector
-syn keyword vhdlType std_ulogic std_ulogic_vector
+" Types and type qualifiers
+" Predefined standard VHDL types
+syn match vhdlType "\<bit\>\'\="
+syn match vhdlType "\<boolean\>\'\="
+syn match vhdlType "\<natural\>\'\="
+syn match vhdlType "\<positive\>\'\="
+syn match vhdlType "\<integer\>\'\="
+syn match vhdlType "\<real\>\'\="
+syn match vhdlType "\<time\>\'\="
+
+syn match vhdlType "\<bit_vector\>\'\="
+syn match vhdlType "\<boolean_vector\>\'\="
+syn match vhdlType "\<integer_vector\>\'\="
+syn match vhdlType "\<real_vector\>\'\="
+syn match vhdlType "\<time_vector\>\'\="
+
+syn match vhdlType "\<character\>\'\="
+syn match vhdlType "\<string\>\'\="
+"syn keyword vhdlType severity_level
+syn keyword vhdlType line
+syn keyword vhdlType text
+
+" Predefined standard IEEE VHDL types
+syn match vhdlType "\<std_ulogic\>\'\="
+syn match vhdlType "\<std_logic\>\'\="
+syn match vhdlType "\<std_ulogic_vector\>\'\="
+syn match vhdlType "\<std_logic_vector\>\'\="
+syn match vhdlType "\<unresolved_signed\>\'\="
+syn match vhdlType "\<unresolved_unsigned\>\'\="
+syn match vhdlType "\<u_signed\>\'\="
+syn match vhdlType "\<u_unsigned\>\'\="
+syn match vhdlType "\<signed\>\'\="
+syn match vhdlType "\<unsigned\>\'\="
+
" array attributes
syn match vhdlAttribute "\'high"
@@ -191,15 +210,23 @@ syn case ignore
syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell
syn match vhdlComment "\(^\|\s\)--.*" contains=vhdlTodo,vhdlFixme,@Spell
+" Standard IEEE P1076.6 preprocessor directives (metacomments).
+syn match vhdlPreProc "/\*\s*rtl_synthesis\s\+\(on\|off\)\s*\*/"
+syn match vhdlPreProc "\(^\|\s\)--\s*rtl_synthesis\s\+\(on\|off\)\s*"
+syn match vhdlPreProc "/\*\s*rtl_syn\s\+\(on\|off\)\s*\*/"
+syn match vhdlPreProc "\(^\|\s\)--\s*rtl_syn\s\+\(on\|off\)\s*"
+
" Industry-standard directives. These are not standard VHDL, but are commonly
" used in the industry.
syn match vhdlPreProc "/\*\s*synthesis\s\+translate_\(on\|off\)\s*\*/"
"syn match vhdlPreProc "/\*\s*simulation\s\+translate_\(on\|off\)\s*\*/"
+syn match vhdlPreProc "/\*\s*pragma\s\+translate_\(on\|off\)\s*\*/"
syn match vhdlPreProc "/\*\s*pragma\s\+synthesis_\(on\|off\)\s*\*/"
syn match vhdlPreProc "/\*\s*synopsys\s\+translate_\(on\|off\)\s*\*/"
syn match vhdlPreProc "\(^\|\s\)--\s*synthesis\s\+translate_\(on\|off\)\s*"
"syn match vhdlPreProc "\(^\|\s\)--\s*simulation\s\+translate_\(on\|off\)\s*"
+syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+translate_\(on\|off\)\s*"
syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+synthesis_\(on\|off\)\s*"
syn match vhdlPreProc "\(^\|\s\)--\s*synopsys\s\+translate_\(on\|off\)\s*"
@@ -216,24 +243,24 @@ if version >= 508 || !exists("did_vhdl_syntax_inits")
else
command -nargs=+ HiLink hi def link <args>
endif
-
- HiLink vhdlSpecial Special
- HiLink vhdlStatement Statement
- HiLink vhdlCharacter Character
- HiLink vhdlString String
- HiLink vhdlVector Number
- HiLink vhdlBoolean Number
- HiLink vhdlTodo Todo
- HiLink vhdlFixme Fixme
- HiLink vhdlComment Comment
- HiLink vhdlNumber Number
- HiLink vhdlTime Number
- HiLink vhdlType Type
- HiLink vhdlOperator Operator
- HiLink vhdlError Error
- HiLink vhdlAttribute Special
- HiLink vhdlPreProc PreProc
-
+
+ HiLink vhdlSpecial Special
+ HiLink vhdlStatement Statement
+ HiLink vhdlCharacter Character
+ HiLink vhdlString String
+ HiLink vhdlVector Number
+ HiLink vhdlBoolean Number
+ HiLink vhdlTodo Todo
+ HiLink vhdlFixme Fixme
+ HiLink vhdlComment Comment
+ HiLink vhdlNumber Number
+ HiLink vhdlTime Number
+ HiLink vhdlType Type
+ HiLink vhdlOperator Operator
+ HiLink vhdlError Error
+ HiLink vhdlAttribute Special
+ HiLink vhdlPreProc PreProc
+
delcommand HiLink
endif
diff --git a/runtime/syntax/zsh.vim b/runtime/syntax/zsh.vim
index 25d4cd4936..0d385a35d0 100644
--- a/runtime/syntax/zsh.vim
+++ b/runtime/syntax/zsh.vim
@@ -2,7 +2,7 @@
" Language: Zsh shell script
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2016-01-25
+" Latest Revision: 2016-02-15
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-zsh
@@ -13,20 +13,29 @@ endif
let s:cpo_save = &cpo
set cpo&vim
-setlocal iskeyword+=-
-setlocal foldmethod=syntax
+if v:version > 704 || (v:version == 704 && has("patch1142"))
+ syn iskeyword @,48-57,_,192-255,#,-
+else
+ setlocal iskeyword+=-
+endif
+if get(g:, 'zsh_fold_enable', 0)
+ setlocal foldmethod=syntax
+endif
syn keyword zshTodo contained TODO FIXME XXX NOTE
syn region zshComment oneline start='\%(^\|\s*\)#' end='$'
- \ contains=zshTodo,@Spell
+ \ contains=zshTodo,@Spell fold
+
+syn region zshComment start='^\s*#' end='^\%(\s*#\)\@!'
+ \ contains=zshTodo,@Spell fold
syn match zshPreProc '^\%1l#\%(!\|compdef\|autoload\).*$'
syn match zshQuoted '\\.'
syn region zshString matchgroup=zshStringDelimiter start=+"+ end=+"+
- \ contains=zshQuoted,@zshDerefs,@zshSubst
-syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+
+ \ contains=zshQuoted,@zshDerefs,@zshSubst fold
+syn region zshString matchgroup=zshStringDelimiter start=+'+ end=+'+ fold
" XXX: This should probably be more precise, but Zsh seems a bit confused about it itself
syn region zshPOSIXString matchgroup=zshStringDelimiter start=+\$'+
\ end=+'+ contains=zshQuoted
@@ -46,7 +55,7 @@ syn keyword zshException always
syn keyword zshKeyword function nextgroup=zshKSHFunction skipwhite
-syn match zshKSHFunction contained '\k\+'
+syn match zshKSHFunction contained '\w\S\+'
syn match zshFunction '^\s*\k\+\ze\s*()'
syn match zshOperator '||\|&&\|;\|&!\='
@@ -317,6 +326,8 @@ syn region zshMathSubst matchgroup=zshSubstDelim transparent
\ @zshDerefs,zshString keepend fold
syn region zshBrackets contained transparent start='{' skip='\\}'
\ end='}' fold
+syn region zshBrackets transparent start='{' skip='\\}'
+ \ end='}' contains=TOP fold
syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}'
\ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString fold
syn region zshOldSubst matchgroup=zshSubstDelim start=+`+ skip=+\\`+
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 9525024c1b..aad145b3e5 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1757,12 +1757,12 @@ char_u* keymap_init(void)
vim_snprintf(buf, buflen, "keymap/%s_%s.vim",
curbuf->b_p_keymap, p_enc);
- if (source_runtime((char_u *)buf, FALSE) == FAIL) {
+ if (source_runtime((char_u *)buf, 0) == FAIL) {
// try finding "keymap/'keymap'.vim" in 'runtimepath'
vim_snprintf(buf, buflen, "keymap/%s.vim",
curbuf->b_p_keymap);
- if (source_runtime((char_u *)buf, FALSE) == FAIL) {
+ if (source_runtime((char_u *)buf, 0) == FAIL) {
xfree(buf);
return (char_u *)N_("E544: Keymap file not found");
}
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 9a86c5765c..591ed50cfd 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -10782,6 +10782,7 @@ static void f_has(typval_T *argvars, typval_T *rettv)
"mouse",
"multi_byte",
"multi_lang",
+ "packages",
"path_extra",
"persistent_undo",
"postscript",
@@ -20497,9 +20498,10 @@ script_autoload (
tofree = NULL;
}
- /* Try loading the package from $VIMRUNTIME/autoload/<name>.vim */
- if (source_runtime(scriptname, FALSE) == OK)
- ret = TRUE;
+ // Try loading the package from $VIMRUNTIME/autoload/<name>.vim
+ if (source_runtime(scriptname, 0) == OK) {
+ ret = true;
+ }
}
xfree(tofree);
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index d0661b6b9b..da64533708 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -4796,122 +4796,15 @@ void ex_viusage(exarg_T *eap)
}
-/*
- * ":helptags"
- */
-void ex_helptags(exarg_T *eap)
-{
- garray_T ga;
- int len;
- char_u lang[2];
- expand_T xpc;
- char_u *dirname;
- char_u ext[5];
- char_u fname[8];
- int filecount;
- char_u **files;
- int add_help_tags = FALSE;
-
- /* Check for ":helptags ++t {dir}". */
- if (STRNCMP(eap->arg, "++t", 3) == 0 && ascii_iswhite(eap->arg[3])) {
- add_help_tags = TRUE;
- eap->arg = skipwhite(eap->arg + 3);
- }
-
- ExpandInit(&xpc);
- xpc.xp_context = EXPAND_DIRECTORIES;
- dirname = ExpandOne(&xpc, eap->arg, NULL,
- WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
- if (dirname == NULL || !os_isdir(dirname)) {
- EMSG2(_("E150: Not a directory: %s"), eap->arg);
- xfree(dirname);
- return;
- }
-
- /* Get a list of all files in the help directory and in subdirectories. */
- STRCPY(NameBuff, dirname);
- add_pathsep((char *)NameBuff);
- STRCAT(NameBuff, "**");
-
- // Note: We cannot just do `&NameBuff` because it is a statically sized array
- // so `NameBuff == &NameBuff` according to C semantics.
- char_u *buff_list[1] = {NameBuff};
- if (gen_expand_wildcards(1, buff_list, &filecount, &files,
- EW_FILE|EW_SILENT) == FAIL
- || filecount == 0) {
- EMSG2("E151: No match: %s", NameBuff);
- xfree(dirname);
- return;
- }
-
- /* Go over all files in the directory to find out what languages are
- * present. */
- ga_init(&ga, 1, 10);
- for (int i = 0; i < filecount; ++i) {
- len = (int)STRLEN(files[i]);
- if (len <= 4) {
- continue;
- }
- if (STRICMP(files[i] + len - 4, ".txt") == 0) {
- /* ".txt" -> language "en" */
- lang[0] = 'e';
- lang[1] = 'n';
- } else if (files[i][len - 4] == '.'
- && ASCII_ISALPHA(files[i][len - 3])
- && ASCII_ISALPHA(files[i][len - 2])
- && TOLOWER_ASC(files[i][len - 1]) == 'x') {
- /* ".abx" -> language "ab" */
- lang[0] = TOLOWER_ASC(files[i][len - 3]);
- lang[1] = TOLOWER_ASC(files[i][len - 2]);
- } else
- continue;
-
- int j;
- /* Did we find this language already? */
- for (j = 0; j < ga.ga_len; j += 2)
- if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0)
- break;
- if (j == ga.ga_len) {
- /* New language, add it. */
- ga_grow(&ga, 2);
- ((char_u *)ga.ga_data)[ga.ga_len++] = lang[0];
- ((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
- }
- }
-
- /*
- * Loop over the found languages to generate a tags file for each one.
- */
- for (int j = 0; j < ga.ga_len; j += 2) {
- STRCPY(fname, "tags-xx");
- fname[5] = ((char_u *)ga.ga_data)[j];
- fname[6] = ((char_u *)ga.ga_data)[j + 1];
- if (fname[5] == 'e' && fname[6] == 'n') {
- /* English is an exception: use ".txt" and "tags". */
- fname[4] = NUL;
- STRCPY(ext, ".txt");
- } else {
- /* Language "ab" uses ".abx" and "tags-ab". */
- STRCPY(ext, ".xxx");
- ext[1] = fname[5];
- ext[2] = fname[6];
- }
- helptags_one(dirname, ext, fname, add_help_tags);
- }
-
- ga_clear(&ga);
- FreeWild(filecount, files);
-
- xfree(dirname);
-}
-
-static void
-helptags_one (
- char_u *dir, /* doc directory */
- char_u *ext, /* suffix, ".txt", ".itx", ".frx", etc. */
- char_u *tagfname, /* "tags" for English, "tags-fr" for French. */
- int add_help_tags /* add "help-tags" tag */
-)
+/// Generate tags in one help directory
+///
+/// @param dir Path to the doc directory
+/// @param ext Suffix of the help files (".txt", ".itx", ".frx", etc.)
+/// @param tagname Name of the tags file ("tags" for English, "tags-fr" for
+/// French)
+/// @param add_help_tags Whether to add the "help-tags" tag
+static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname,
+ bool add_help_tags)
{
FILE *fd_tags;
FILE *fd;
@@ -5111,6 +5004,132 @@ helptags_one (
fclose(fd_tags); /* there is no check for an error... */
}
+/// Generate tags in one help directory, taking care of translations.
+static void do_helptags(char_u *dirname, bool add_help_tags)
+{
+ int len;
+ garray_T ga;
+ char_u lang[2];
+ char_u ext[5];
+ char_u fname[8];
+ int filecount;
+ char_u **files;
+
+ // Get a list of all files in the help directory and in subdirectories.
+ STRCPY(NameBuff, dirname);
+ add_pathsep((char *)NameBuff);
+ STRCAT(NameBuff, "**");
+
+ // Note: We cannot just do `&NameBuff` because it is a statically sized array
+ // so `NameBuff == &NameBuff` according to C semantics.
+ char_u *buff_list[1] = {NameBuff};
+ if (gen_expand_wildcards(1, buff_list, &filecount, &files,
+ EW_FILE|EW_SILENT) == FAIL
+ || filecount == 0) {
+ EMSG2("E151: No match: %s", NameBuff);
+ xfree(dirname);
+ return;
+ }
+
+ /* Go over all files in the directory to find out what languages are
+ * present. */
+ int j;
+ ga_init(&ga, 1, 10);
+ for (int i = 0; i < filecount; i++) {
+ len = (int)STRLEN(files[i]);
+ if (len <= 4) {
+ continue;
+ }
+ if (STRICMP(files[i] + len - 4, ".txt") == 0) {
+ /* ".txt" -> language "en" */
+ lang[0] = 'e';
+ lang[1] = 'n';
+ } else if (files[i][len - 4] == '.'
+ && ASCII_ISALPHA(files[i][len - 3])
+ && ASCII_ISALPHA(files[i][len - 2])
+ && TOLOWER_ASC(files[i][len - 1]) == 'x') {
+ /* ".abx" -> language "ab" */
+ lang[0] = TOLOWER_ASC(files[i][len - 3]);
+ lang[1] = TOLOWER_ASC(files[i][len - 2]);
+ } else
+ continue;
+
+ // Did we find this language already?
+ for (j = 0; j < ga.ga_len; j += 2) {
+ if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0) {
+ break;
+ }
+ }
+ if (j == ga.ga_len) {
+ // New language, add it.
+ ga_grow(&ga, 2);
+ ((char_u *)ga.ga_data)[ga.ga_len++] = lang[0];
+ ((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
+ }
+ }
+
+ /*
+ * Loop over the found languages to generate a tags file for each one.
+ */
+ for (j = 0; j < ga.ga_len; j += 2) {
+ STRCPY(fname, "tags-xx");
+ fname[5] = ((char_u *)ga.ga_data)[j];
+ fname[6] = ((char_u *)ga.ga_data)[j + 1];
+ if (fname[5] == 'e' && fname[6] == 'n') {
+ /* English is an exception: use ".txt" and "tags". */
+ fname[4] = NUL;
+ STRCPY(ext, ".txt");
+ } else {
+ /* Language "ab" uses ".abx" and "tags-ab". */
+ STRCPY(ext, ".xxx");
+ ext[1] = fname[5];
+ ext[2] = fname[6];
+ }
+ helptags_one(dirname, ext, fname, add_help_tags);
+ }
+
+ ga_clear(&ga);
+ FreeWild(filecount, files);
+}
+
+ static void
+helptags_cb(char_u *fname, void *cookie)
+{
+ do_helptags(fname, *(bool *)cookie);
+}
+
+/*
+ * ":helptags"
+ */
+void ex_helptags(exarg_T *eap)
+{
+ expand_T xpc;
+ char_u *dirname;
+ bool add_help_tags = false;
+
+ /* Check for ":helptags ++t {dir}". */
+ if (STRNCMP(eap->arg, "++t", 3) == 0 && ascii_iswhite(eap->arg[3])) {
+ add_help_tags = true;
+ eap->arg = skipwhite(eap->arg + 3);
+ }
+
+ if (STRCMP(eap->arg, "ALL") == 0) {
+ do_in_path(p_rtp, (char_u *)"doc", DIP_ALL + DIP_DIR,
+ helptags_cb, &add_help_tags);
+ } else {
+ ExpandInit(&xpc);
+ xpc.xp_context = EXPAND_DIRECTORIES;
+ dirname = ExpandOne(&xpc, eap->arg, NULL,
+ WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
+ if (dirname == NULL || !os_isdir(dirname)) {
+ EMSG2(_("E150: Not a directory: %s"), eap->arg);
+ } else {
+ do_helptags(dirname, add_help_tags);
+ }
+ xfree(dirname);
+ }
+}
+
struct sign
{
sign_T *sn_next; /* next sign in list */
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua
index 6c58879d58..76191d5a56 100644
--- a/src/nvim/ex_cmds.lua
+++ b/src/nvim/ex_cmds.lua
@@ -1849,6 +1849,18 @@ return {
func='ex_print',
},
{
+ command='packadd',
+ flags=bit.bor(BANG, FILE1, NEEDARG, TRLBAR, SBOXOK, CMDWIN),
+ addr_type=ADDR_LINES,
+ func='ex_packadd',
+ },
+ {
+ command='packloadall',
+ flags=bit.bor(BANG, TRLBAR, SBOXOK, CMDWIN),
+ addr_type=ADDR_LINES,
+ func='ex_packloadall',
+ },
+ {
command='pclose',
flags=bit.bor(BANG, TRLBAR),
addr_type=ADDR_LINES,
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 40074f726c..b56b1cf013 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -2237,7 +2237,7 @@ void ex_compiler(exarg_T *eap)
do_unlet((char_u *)"b:current_compiler", true);
snprintf((char *)buf, bufsize, "compiler/%s.vim", eap->arg);
- if (source_runtime(buf, true) == FAIL) {
+ if (source_runtime(buf, DIP_ALL) == FAIL) {
EMSG2(_("E666: compiler not supported: %s"), eap->arg);
}
xfree(buf);
@@ -2263,10 +2263,29 @@ void ex_compiler(exarg_T *eap)
}
}
-/// ":runtime {name}"
+/// ":runtime [what] {name}"
void ex_runtime(exarg_T *eap)
{
- source_runtime(eap->arg, eap->forceit);
+ char_u *arg = eap->arg;
+ char_u *p = skiptowhite(arg);
+ ptrdiff_t len = p - arg;
+ int flags = eap->forceit ? DIP_ALL : 0;
+
+ if (STRNCMP(arg, "START", len) == 0) {
+ flags += DIP_START + DIP_NORTP;
+ arg = skipwhite(arg + len);
+ } else if (STRNCMP(arg, "OPT", len) == 0) {
+ flags += DIP_OPT + DIP_NORTP;
+ arg = skipwhite(arg + len);
+ } else if (STRNCMP(arg, "PACK", len) == 0) {
+ flags += DIP_START + DIP_OPT + DIP_NORTP;
+ arg = skipwhite(arg + len);
+ } else if (STRNCMP(arg, "ALL", len) == 0) {
+ flags += DIP_START + DIP_OPT;
+ arg = skipwhite(arg + len);
+ }
+
+ source_runtime(arg, flags);
}
@@ -2277,28 +2296,25 @@ static void source_callback(char_u *fname, void *cookie)
/// Source the file "name" from all directories in 'runtimepath'.
/// "name" can contain wildcards.
-/// When "all" is true, source all files, otherwise only the first one.
+/// When "flags" has DIP_ALL: source all files, otherwise only the first one.
+///
/// return FAIL when no file could be sourced, OK otherwise.
-int source_runtime(char_u *name, int all)
+int source_runtime(char_u *name, int flags)
{
- return do_in_runtimepath(name, all, source_callback, NULL);
+ return do_in_runtimepath(name, flags, source_callback, NULL);
}
-/// Find "name" in 'runtimepath'. When found, invoke the callback function for
-/// it: callback(fname, "cookie")
-/// When "all" is true repeat for all matches, otherwise only the first one is
-/// used.
-/// Returns OK when at least one match found, FAIL otherwise.
-/// If "name" is NULL calls callback for each entry in runtimepath. Cookie is
-/// passed by reference in this case, setting it to NULL indicates that callback
-/// has done its job.
-int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
- void *cookie)
+/// Find the file "name" in all directories in "path" and invoke
+/// "callback(fname, cookie)".
+/// "name" can contain wildcards.
+/// When "flags" has DIP_ALL: source all files, otherwise only the first one.
+/// When "flags" has DIP_DIR: find directories instead of files.
+/// When "flags" has DIP_ERR: give an error message if there is no match.
+///
+/// return FAIL when no file could be sourced, OK otherwise.
+int do_in_path(char_u *path, char_u *name, int flags,
+ DoInRuntimepathCB callback, void *cookie)
{
- char_u *rtp;
- char_u *np;
- char_u *buf;
- char_u *rtp_copy;
char_u *tail;
int num_files;
char_u **files;
@@ -2307,19 +2323,19 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
// Make a copy of 'runtimepath'. Invoking the callback may change the
// value.
- rtp_copy = vim_strsave(p_rtp);
- buf = xmallocz(MAXPATHL);
+ char_u *rtp_copy = vim_strsave(path);
+ char_u *buf = xmallocz(MAXPATHL);
{
if (p_verbose > 1 && name != NULL) {
verbose_enter();
smsg(_("Searching for \"%s\" in \"%s\""),
- (char *)name, (char *)p_rtp);
+ (char *)name, (char *)path);
verbose_leave();
}
// Loop over all entries in 'runtimepath'.
- rtp = rtp_copy;
- while (*rtp != NUL && (all || !did_one)) {
+ char_u *rtp = rtp_copy;
+ while (*rtp != NUL && ((flags & DIP_ALL) || !did_one)) {
// Copy the path from 'runtimepath' to buf[].
copy_option_part(&rtp, buf, MAXPATHL, ",");
if (name == NULL) {
@@ -2332,8 +2348,8 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
tail = buf + STRLEN(buf);
// Loop over all patterns in "name"
- np = name;
- while (*np != NUL && (all || !did_one)) {
+ char_u *np = name;
+ while (*np != NUL && ((flags & DIP_ALL) || !did_one)) {
// Append the pattern from "name" to buf[].
assert(MAXPATHL >= (tail - buf));
copy_option_part(&np, tail, (size_t)(MAXPATHL - (tail - buf)),
@@ -2347,11 +2363,12 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
// Expand wildcards, invoke the callback for each match.
if (gen_expand_wildcards(1, &buf, &num_files, &files,
- EW_FILE) == OK) {
+ (flags & DIP_DIR) ? EW_DIR
+ : EW_FILE) == OK) {
for (i = 0; i < num_files; i++) {
(*callback)(files[i], cookie);
did_one = true;
- if (!all) {
+ if (!(flags & DIP_ALL)) {
break;
}
}
@@ -2363,16 +2380,228 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
}
xfree(buf);
xfree(rtp_copy);
- if (p_verbose > 0 && !did_one && name != NULL) {
- verbose_enter();
- smsg(_("not found in 'runtimepath': \"%s\""), name);
- verbose_leave();
+ if (!did_one && name != NULL) {
+ char *basepath = path == p_rtp ? "runtimepath" : "packpath";
+
+ if (flags & DIP_ERR) {
+ EMSG3(_(e_dirnotf), basepath, name);
+ } else if (p_verbose > 0) {
+ verbose_enter();
+ smsg(_("not found in '%s': \"%s\""), basepath, name);
+ verbose_leave();
+ }
}
return did_one ? OK : FAIL;
}
+/// Find "name" in 'runtimepath'. When found, invoke the callback function for
+/// it: callback(fname, "cookie")
+/// When "flags" has DIP_ALL repeat for all matches, otherwise only the first
+/// one is used.
+/// Returns OK when at least one match found, FAIL otherwise.
+/// If "name" is NULL calls callback for each entry in runtimepath. Cookie is
+/// passed by reference in this case, setting it to NULL indicates that callback
+/// has done its job.
+int do_in_runtimepath(char_u *name, int flags, DoInRuntimepathCB callback,
+ void *cookie)
+{
+ int done = FAIL;
+
+ if ((flags & DIP_NORTP) == 0) {
+ done = do_in_path(p_rtp, name, flags, callback, cookie);
+ }
+
+ if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_START)) {
+ char *start_dir = "pack/*/start/*/%s"; // NOLINT
+ size_t len = STRLEN(start_dir) + STRLEN(name);
+ char_u *s = xmallocz(len);
+
+ vim_snprintf((char *)s, len, start_dir, name);
+ done = do_in_path(p_pp, s, flags, callback, cookie);
+
+ xfree(s);
+ }
+
+ if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_OPT)) {
+ char *opt_dir = "pack/*/opt/*/%s"; // NOLINT
+ size_t len = STRLEN(opt_dir) + STRLEN(name);
+ char_u *s = xmallocz(len);
+
+ vim_snprintf((char *)s, len, opt_dir, name);
+ done = do_in_path(p_pp, s, flags, callback, cookie);
+
+ xfree(s);
+ }
+
+ return done;
+}
+
+// Expand wildcards in "pat" and invoke do_source() for each match.
+static void source_all_matches(char_u *pat)
+{
+ int num_files;
+ char_u **files;
+
+ if (gen_expand_wildcards(1, &pat, &num_files, &files, EW_FILE) == OK) {
+ for (int i = 0; i < num_files; i++) {
+ (void)do_source(files[i], false, DOSO_NONE);
+ }
+ FreeWild(num_files, files);
+ }
+}
+
+// used for "cookie" of add_pack_plugin()
+static int APP_ADD_DIR;
+static int APP_LOAD;
+static int APP_BOTH;
+
+static void add_pack_plugin(char_u *fname, void *cookie)
+{
+ char_u *p4, *p3, *p2, *p1, *p;
+ char_u *new_rtp;
+ char_u *ffname = (char_u *)fix_fname((char *)fname);
+
+ if (ffname == NULL) {
+ return;
+ }
+
+ if (cookie != &APP_LOAD && strstr((char *)p_rtp, (char *)ffname) == NULL) {
+ // directory is not yet in 'runtimepath', add it
+ p4 = p3 = p2 = p1 = get_past_head(ffname);
+ for (p = p1; *p; mb_ptr_adv(p)) {
+ if (vim_ispathsep_nocolon(*p)) {
+ p4 = p3; p3 = p2; p2 = p1; p1 = p;
+ }
+ }
+
+ // now we have:
+ // rtp/pack/name/start/name
+ // p4 p3 p2 p1
+ //
+ // find the part up to "pack" in 'runtimepath'
+ char_u c = *p4;
+ *p4 = NUL;
+
+ // Find "ffname" in "p_rtp", ignoring '/' vs '\' differences
+ size_t fname_len = STRLEN(ffname);
+ char_u *insp = p_rtp;
+ for (;;) {
+ if (vim_fnamencmp(insp, ffname, fname_len) == 0) {
+ break;
+ }
+ insp = vim_strchr(insp, ',');
+ if (insp == NULL) {
+ break;
+ }
+ insp++;
+ }
+
+ if (insp == NULL) {
+ // not found, append at the end
+ insp = p_rtp + STRLEN(p_rtp);
+ } else {
+ // append after the matching directory.
+ insp += STRLEN(ffname);
+ while (*insp != NUL && *insp != ',') {
+ insp++;
+ }
+ }
+ *p4 = c;
+
+ // check if rtp/pack/name/start/name/after exists
+ char *afterdir = concat_fnames((char *)ffname, "after", true);
+ size_t afterlen = 0;
+ if (os_isdir((char_u *)afterdir)) {
+ afterlen = STRLEN(afterdir) + 1; // add one for comma
+ }
+
+ size_t oldlen = STRLEN(p_rtp);
+ size_t addlen = STRLEN(ffname) + 1; // add one for comma
+ new_rtp = try_malloc(oldlen + addlen + afterlen + 1); // add one for NUL
+ if (new_rtp == NULL) {
+ goto theend;
+ }
+ uintptr_t keep = (uintptr_t)(insp - p_rtp);
+ memmove(new_rtp, p_rtp, keep);
+ new_rtp[keep] = ',';
+ memmove(new_rtp + keep + 1, ffname, addlen);
+ if (p_rtp[keep] != NUL) {
+ memmove(new_rtp + keep + addlen, p_rtp + keep,
+ oldlen - keep + 1);
+ }
+ if (afterlen > 0) {
+ STRCAT(new_rtp, ",");
+ STRCAT(new_rtp, afterdir);
+ }
+ set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
+ xfree(new_rtp);
+ xfree(afterdir);
+ }
+
+ if (cookie != &APP_ADD_DIR) {
+ static const char *plugpat = "%s/plugin/*.vim"; // NOLINT
+ static const char *ftpat = "%s/ftdetect/*.vim"; // NOLINT
+
+ size_t len = STRLEN(ffname) + STRLEN(ftpat);
+ char_u *pat = try_malloc(len + 1);
+ if (pat == NULL) {
+ goto theend;
+ }
+ vim_snprintf((char *)pat, len, plugpat, ffname);
+ source_all_matches(pat);
+
+ char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes");
+
+ // If runtime/filetype.vim wasn't loaded yet, the scripts will be
+ // found when it loads.
+ if (eval_to_number(cmd) > 0) {
+ do_cmdline_cmd("augroup filetypedetect");
+ vim_snprintf((char *)pat, len, ftpat, ffname);
+ source_all_matches(pat);
+ do_cmdline_cmd("augroup END");
+ }
+ xfree(cmd);
+ xfree(pat);
+ }
+
+theend:
+ xfree(ffname);
+}
+
+static bool did_source_packages = false;
+
+// ":packloadall"
+// Find plugins in the package directories and source them.
+void ex_packloadall(exarg_T *eap)
+{
+ if (!did_source_packages || (eap != NULL && eap->forceit)) {
+ did_source_packages = true;
+
+ // First do a round to add all directories to 'runtimepath', then load
+ // the plugins. This allows for plugins to use an autoload directory
+ // of another plugin.
+ do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, // NOLINT
+ add_pack_plugin, &APP_ADD_DIR);
+ do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR, // NOLINT
+ add_pack_plugin, &APP_LOAD);
+ }
+}
+
+/// ":packadd[!] {name}"
+void ex_packadd(exarg_T *eap)
+{
+ static const char *plugpat = "pack/*/opt/%s"; // NOLINT
+
+ size_t len = STRLEN(plugpat) + STRLEN(eap->arg);
+ char *pat = (char *)xmallocz(len);
+ vim_snprintf(pat, len, plugpat, eap->arg);
+ do_in_path(p_pp, (char_u *)pat, DIP_ALL + DIP_DIR + DIP_ERR, add_pack_plugin,
+ eap->forceit ? &APP_ADD_DIR : &APP_BOTH);
+ xfree(pat);
+}
+
/// ":options"
void ex_options(exarg_T *eap)
{
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ad17d4dcbd..9bc7ec39da 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -3316,6 +3316,11 @@ set_one_cmd_context (
xp->xp_pattern = arg;
break;
+ case CMD_packadd:
+ xp->xp_context = EXPAND_PACKADD;
+ xp->xp_pattern = arg;
+ break;
+
#ifdef HAVE_WORKING_LIBINTL
case CMD_language:
p = skiptowhite(arg);
@@ -4660,41 +4665,42 @@ static struct {
char *name;
} command_complete[] =
{
- {EXPAND_AUGROUP, "augroup"},
- {EXPAND_BEHAVE, "behave"},
- {EXPAND_BUFFERS, "buffer"},
- {EXPAND_COLORS, "color"},
- {EXPAND_COMMANDS, "command"},
- {EXPAND_COMPILER, "compiler"},
- {EXPAND_CSCOPE, "cscope"},
- {EXPAND_USER_DEFINED, "custom"},
- {EXPAND_USER_LIST, "customlist"},
- {EXPAND_DIRECTORIES, "dir"},
- {EXPAND_ENV_VARS, "environment"},
- {EXPAND_EVENTS, "event"},
- {EXPAND_EXPRESSION, "expression"},
- {EXPAND_FILES, "file"},
- {EXPAND_FILES_IN_PATH, "file_in_path"},
- {EXPAND_FILETYPE, "filetype"},
- {EXPAND_FUNCTIONS, "function"},
- {EXPAND_HELP, "help"},
- {EXPAND_HIGHLIGHT, "highlight"},
- {EXPAND_HISTORY, "history"},
+ { EXPAND_AUGROUP, "augroup" },
+ { EXPAND_BEHAVE, "behave" },
+ { EXPAND_BUFFERS, "buffer" },
+ { EXPAND_COLORS, "color" },
+ { EXPAND_COMMANDS, "command" },
+ { EXPAND_COMPILER, "compiler" },
+ { EXPAND_CSCOPE, "cscope" },
+ { EXPAND_USER_DEFINED, "custom" },
+ { EXPAND_USER_LIST, "customlist" },
+ { EXPAND_DIRECTORIES, "dir" },
+ { EXPAND_ENV_VARS, "environment" },
+ { EXPAND_EVENTS, "event" },
+ { EXPAND_EXPRESSION, "expression" },
+ { EXPAND_FILES, "file" },
+ { EXPAND_FILES_IN_PATH, "file_in_path" },
+ { EXPAND_FILETYPE, "filetype" },
+ { EXPAND_FUNCTIONS, "function" },
+ { EXPAND_HELP, "help" },
+ { EXPAND_HIGHLIGHT, "highlight" },
+ { EXPAND_HISTORY, "history" },
#ifdef HAVE_WORKING_LIBINTL
- {EXPAND_LOCALES, "locale"},
+ { EXPAND_LOCALES, "locale" },
#endif
- {EXPAND_MAPPINGS, "mapping"},
- {EXPAND_MENUS, "menu"},
- {EXPAND_OWNSYNTAX, "syntax"},
- {EXPAND_SYNTIME, "syntime"},
- {EXPAND_SETTINGS, "option"},
- {EXPAND_SHELLCMD, "shellcmd"},
- {EXPAND_SIGN, "sign"},
- {EXPAND_TAGS, "tag"},
- {EXPAND_TAGS_LISTFILES, "tag_listfiles"},
- {EXPAND_USER, "user"},
- {EXPAND_USER_VARS, "var"},
- {0, NULL}
+ { EXPAND_MAPPINGS, "mapping" },
+ { EXPAND_MENUS, "menu" },
+ { EXPAND_OWNSYNTAX, "syntax" },
+ { EXPAND_SYNTIME, "syntime" },
+ { EXPAND_SETTINGS, "option" },
+ { EXPAND_PACKADD, "packadd" },
+ { EXPAND_SHELLCMD, "shellcmd" },
+ { EXPAND_SIGN, "sign" },
+ { EXPAND_TAGS, "tag" },
+ { EXPAND_TAGS_LISTFILES, "tag_listfiles" },
+ { EXPAND_USER, "user" },
+ { EXPAND_USER_VARS, "var" },
+ { 0, NULL }
};
static void uc_list(char_u *name, size_t name_len)
@@ -9330,14 +9336,14 @@ static void ex_filetype(exarg_T *eap)
}
if (STRCMP(arg, "on") == 0 || STRCMP(arg, "detect") == 0) {
if (*arg == 'o' || !filetype_detect) {
- source_runtime((char_u *)FILETYPE_FILE, true);
+ source_runtime((char_u *)FILETYPE_FILE, DIP_ALL);
filetype_detect = kTrue;
if (plugin) {
- source_runtime((char_u *)FTPLUGIN_FILE, true);
+ source_runtime((char_u *)FTPLUGIN_FILE, DIP_ALL);
filetype_plugin = kTrue;
}
if (indent) {
- source_runtime((char_u *)INDENT_FILE, true);
+ source_runtime((char_u *)INDENT_FILE, DIP_ALL);
filetype_indent = kTrue;
}
}
@@ -9348,15 +9354,15 @@ static void ex_filetype(exarg_T *eap)
} else if (STRCMP(arg, "off") == 0) {
if (plugin || indent) {
if (plugin) {
- source_runtime((char_u *)FTPLUGOF_FILE, true);
+ source_runtime((char_u *)FTPLUGOF_FILE, DIP_ALL);
filetype_plugin = kFalse;
}
if (indent) {
- source_runtime((char_u *)INDOFF_FILE, true);
+ source_runtime((char_u *)INDOFF_FILE, DIP_ALL);
filetype_indent = kFalse;
}
} else {
- source_runtime((char_u *)FTOFF_FILE, true);
+ source_runtime((char_u *)FTOFF_FILE, DIP_ALL);
filetype_detect = kFalse;
}
} else
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 65144dace8..cd28554970 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -3440,6 +3440,7 @@ addstar (
|| context == EXPAND_COMPILER
|| context == EXPAND_OWNSYNTAX
|| context == EXPAND_FILETYPE
+ || context == EXPAND_PACKADD
|| (context == EXPAND_TAGS && fname[0] == '/'))
retval = vim_strnsave(fname, len);
else {
@@ -3794,23 +3795,27 @@ ExpandFromContext (
|| xp->xp_context == EXPAND_TAGS_LISTFILES)
return expand_tags(xp->xp_context == EXPAND_TAGS, pat, num_file, file);
if (xp->xp_context == EXPAND_COLORS) {
- char *directories[] = {"colors", NULL};
- return ExpandRTDir(pat, num_file, file, directories);
+ char *directories[] = { "colors", NULL };
+ return ExpandRTDir(pat, DIP_START + DIP_OPT, num_file, file, directories);
}
if (xp->xp_context == EXPAND_COMPILER) {
- char *directories[] = {"compiler", NULL};
- return ExpandRTDir(pat, num_file, file, directories);
+ char *directories[] = { "compiler", NULL };
+ return ExpandRTDir(pat, 0, num_file, file, directories);
}
if (xp->xp_context == EXPAND_OWNSYNTAX) {
- char *directories[] = {"syntax", NULL};
- return ExpandRTDir(pat, num_file, file, directories);
+ char *directories[] = { "syntax", NULL };
+ return ExpandRTDir(pat, 0, num_file, file, directories);
}
if (xp->xp_context == EXPAND_FILETYPE) {
- char *directories[] = {"syntax", "indent", "ftplugin", NULL};
- return ExpandRTDir(pat, num_file, file, directories);
+ char *directories[] = { "syntax", "indent", "ftplugin", NULL };
+ return ExpandRTDir(pat, 0, num_file, file, directories);
}
- if (xp->xp_context == EXPAND_USER_LIST)
+ if (xp->xp_context == EXPAND_USER_LIST) {
return ExpandUserList(xp, num_file, file);
+ }
+ if (xp->xp_context == EXPAND_PACKADD) {
+ return ExpandPackAddDir(pat, num_file, file);
+ }
regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0);
if (regmatch.regprog == NULL)
@@ -4190,12 +4195,16 @@ static int ExpandUserList(expand_T *xp, int *num_file, char_u ***file)
return OK;
}
-/*
- * Expand color scheme, compiler or filetype names:
- * 'runtimepath'/{dirnames}/{pat}.vim
- * "dirnames" is an array with one or more directory names.
- */
-static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file, char *dirnames[])
+/// Expand color scheme, compiler or filetype names.
+/// Search from 'runtimepath':
+/// 'runtimepath'/{dirnames}/{pat}.vim
+/// When "flags" has DIP_START: search also from 'start' of 'packpath':
+/// 'packpath'/pack/ * /start/ * /{dirnames}/{pat}.vim
+/// When "flags" has DIP_OPT: search also from 'opt' of 'packpath':
+/// 'packpath'/pack/ * /opt/ * /{dirnames}/{pat}.vim
+/// "dirnames" is an array with one or more directory names.
+static int ExpandRTDir(char_u *pat, int flags, int *num_file, char_u ***file,
+ char *dirnames[])
{
*num_file = 0;
*file = NULL;
@@ -4212,6 +4221,26 @@ static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file, char *dirname
xfree(s);
}
+ if (flags & DIP_START) {
+ for (int i = 0; dirnames[i] != NULL; i++) {
+ size_t size = STRLEN(dirnames[i]) + pat_len + 22;
+ char_u *s = xmalloc(size);
+ snprintf((char *)s, size, "pack/*/start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
+ globpath(p_pp, s, &ga, 0);
+ xfree(s);
+ }
+ }
+
+ if (flags & DIP_OPT) {
+ for (int i = 0; dirnames[i] != NULL; i++) {
+ size_t size = STRLEN(dirnames[i]) + pat_len + 20;
+ char_u *s = xmalloc(size);
+ snprintf((char *)s, size, "pack/*/opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
+ globpath(p_pp, s, &ga, 0);
+ xfree(s);
+ }
+ }
+
for (int i = 0; i < ga.ga_len; i++) {
char_u *match = ((char_u **)ga.ga_data)[i];
char_u *s = match;
@@ -4241,6 +4270,43 @@ static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file, char *dirname
return OK;
}
+/// Expand loadplugin names:
+/// 'packpath'/pack/ * /opt/{pat}
+static int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file)
+{
+ garray_T ga;
+
+ *num_file = 0;
+ *file = NULL;
+ size_t pat_len = STRLEN(pat);
+ ga_init(&ga, (int)sizeof(char *), 10);
+
+ size_t buflen = pat_len + 26;
+ char_u *s = xmalloc(buflen);
+ snprintf((char *)s, buflen, "pack/*/opt/%s*", pat); // NOLINT
+ globpath(p_pp, s, &ga, 0);
+ xfree(s);
+
+ for (int i = 0; i < ga.ga_len; i++) {
+ char_u *match = ((char_u **)ga.ga_data)[i];
+ s = path_tail(match);
+ char_u *e = s + STRLEN(s);
+ memmove(match, s, e - s + 1);
+ }
+
+ if (GA_EMPTY(&ga)) {
+ return FAIL;
+ }
+
+ // Sort and remove duplicates which can happen when specifying multiple
+ // directories in dirnames.
+ ga_remove_duplicate_strings(&ga);
+
+ *file = ga.ga_data;
+ *num_file = ga.ga_len;
+ return OK;
+}
+
/// Expand `file` for all comma-separated directories in `path`.
/// Adds matches to `ga`.
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 7f91903106..ed9862a264 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1223,6 +1223,8 @@ EXTERN char_u e_invalpat[] INIT(= N_(
EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
+EXTERN char_u e_dirnotf[] INIT(= N_(
+ "E919: Directory not found in '%s': \"%s\""));
EXTERN char_u e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index 916d27a964..1c9b8e18ef 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -1526,8 +1526,7 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
vim_strcat(buffer, (char_u *)name, MAXPATHL);
vim_strcat(buffer, (char_u *)".ps", MAXPATHL);
resource->filename[0] = NUL;
- retval = (do_in_runtimepath(buffer, FALSE, prt_resource_name,
- resource->filename)
+ retval = (do_in_runtimepath(buffer, 0, prt_resource_name, resource->filename)
&& resource->filename[0] != NUL);
xfree(buffer);
return retval;
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 5cd1dbb467..64b5de8663 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1241,8 +1241,11 @@ static void set_window_layout(mparm_T *paramp)
static void load_plugins(void)
{
if (p_lpl) {
- source_runtime((char_u *)"plugin/**/*.vim", TRUE);
+ source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL); // NOLINT
TIME_MSG("loading plugins");
+
+ ex_packloadall(NULL);
+ TIME_MSG("loading packages");
}
}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index a844c4ed80..81f57522b3 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3187,8 +3187,9 @@ did_set_string_option (
for (p = q; *p != NUL; ++p)
if (vim_strchr((char_u *)"_.,", *p) != NULL)
break;
- vim_snprintf((char *)fname, 200, "spell/%.*s.vim", (int)(p - q), q);
- source_runtime(fname, TRUE);
+ vim_snprintf((char *)fname, sizeof(fname), "spell/%.*s.vim",
+ (int)(p - q), q);
+ source_runtime(fname, DIP_ALL);
}
}
@@ -5839,6 +5840,7 @@ set_context_in_set_cmd (
if (p == (char_u *)&p_bdir
|| p == (char_u *)&p_dir
|| p == (char_u *)&p_path
+ || p == (char_u *)&p_pp
|| p == (char_u *)&p_rtp
|| p == (char_u *)&p_cdpath
|| p == (char_u *)&p_vdir
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index b1a2b00bdb..8d6f42e088 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -456,80 +456,81 @@ EXTERN int p_hid; // 'hidden'
// Use P_HID to check if a buffer is to be hidden when it is no longer
// visible in a window.
# define P_HID(buf) (buf_hide(buf))
-EXTERN char_u *p_hl; /* 'highlight' */
-EXTERN int p_hls; /* 'hlsearch' */
-EXTERN long p_hi; /* 'history' */
-EXTERN int p_hkmap; /* 'hkmap' */
-EXTERN int p_hkmapp; /* 'hkmapp' */
-EXTERN int p_fkmap; /* 'fkmap' */
-EXTERN int p_altkeymap; /* 'altkeymap' */
-EXTERN int p_arshape; /* 'arabicshape' */
-EXTERN int p_icon; /* 'icon' */
-EXTERN char_u *p_iconstring; /* 'iconstring' */
-EXTERN int p_ic; /* 'ignorecase' */
-EXTERN int p_is; /* 'incsearch' */
-EXTERN int p_im; /* 'insertmode' */
-EXTERN char_u *p_isf; /* 'isfname' */
-EXTERN char_u *p_isi; /* 'isident' */
-EXTERN char_u *p_isp; /* 'isprint' */
-EXTERN int p_js; /* 'joinspaces' */
-EXTERN char_u *p_kp; /* 'keywordprg' */
-EXTERN char_u *p_km; /* 'keymodel' */
-EXTERN char_u *p_langmap; /* 'langmap'*/
-EXTERN int p_lnr; /* 'langnoremap'*/
-EXTERN char_u *p_lm; /* 'langmenu' */
-EXTERN char_u *p_lispwords; /* 'lispwords' */
-EXTERN long p_ls; /* 'laststatus' */
-EXTERN long p_stal; /* 'showtabline' */
-EXTERN char_u *p_lcs; /* 'listchars' */
-
-EXTERN int p_lz; /* 'lazyredraw' */
-EXTERN int p_lpl; /* 'loadplugins' */
-EXTERN int p_magic; /* 'magic' */
-EXTERN char_u *p_mef; /* 'makeef' */
-EXTERN char_u *p_mp; /* 'makeprg' */
-EXTERN char_u *p_cc; /* 'colorcolumn' */
-EXTERN int p_cc_cols[256]; /* array for 'colorcolumn' columns */
-EXTERN long p_mat; /* 'matchtime' */
-EXTERN long p_mco; /* 'maxcombine' */
-EXTERN long p_mfd; /* 'maxfuncdepth' */
-EXTERN long p_mmd; /* 'maxmapdepth' */
-EXTERN long p_mm; /* 'maxmem' */
-EXTERN long p_mmp; /* 'maxmempattern' */
-EXTERN long p_mmt; /* 'maxmemtot' */
-EXTERN long p_mis; /* 'menuitems' */
-EXTERN char_u *p_msm; /* 'mkspellmem' */
-EXTERN long p_mls; /* 'modelines' */
-EXTERN char_u *p_mouse; /* 'mouse' */
-EXTERN char_u *p_mousem; /* 'mousemodel' */
-EXTERN long p_mouset; /* 'mousetime' */
-EXTERN int p_more; /* 'more' */
-EXTERN char_u *p_opfunc; /* 'operatorfunc' */
-EXTERN char_u *p_para; /* 'paragraphs' */
-EXTERN int p_paste; /* 'paste' */
-EXTERN char_u *p_pt; /* 'pastetoggle' */
-EXTERN char_u *p_pex; /* 'patchexpr' */
-EXTERN char_u *p_pm; /* 'patchmode' */
-EXTERN char_u *p_path; /* 'path' */
-EXTERN char_u *p_cdpath; /* 'cdpath' */
-EXTERN long p_rdt; /* 'redrawtime' */
-EXTERN int p_remap; /* 'remap' */
-EXTERN long p_re; /* 'regexpengine' */
-EXTERN long p_report; /* 'report' */
-EXTERN long p_pvh; /* 'previewheight' */
-EXTERN int p_ari; /* 'allowrevins' */
-EXTERN int p_ri; /* 'revins' */
-EXTERN int p_ru; /* 'ruler' */
-EXTERN char_u *p_ruf; /* 'rulerformat' */
-EXTERN char_u *p_rtp; /* 'runtimepath' */
-EXTERN long p_sj; /* 'scrolljump' */
-EXTERN long p_so; /* 'scrolloff' */
-EXTERN char_u *p_sbo; /* 'scrollopt' */
-EXTERN char_u *p_sections; /* 'sections' */
-EXTERN int p_secure; /* 'secure' */
-EXTERN char_u *p_sel; /* 'selection' */
-EXTERN char_u *p_slm; /* 'selectmode' */
-EXTERN char_u *p_ssop; /* 'sessionoptions' */
+EXTERN char_u *p_hl; // 'highlight'
+EXTERN int p_hls; // 'hlsearch'
+EXTERN long p_hi; // 'history'
+EXTERN int p_hkmap; // 'hkmap'
+EXTERN int p_hkmapp; // 'hkmapp'
+EXTERN int p_fkmap; // 'fkmap'
+EXTERN int p_altkeymap; // 'altkeymap'
+EXTERN int p_arshape; // 'arabicshape'
+EXTERN int p_icon; // 'icon'
+EXTERN char_u *p_iconstring; // 'iconstring'
+EXTERN int p_ic; // 'ignorecase'
+EXTERN int p_is; // 'incsearch'
+EXTERN int p_im; // 'insertmode'
+EXTERN char_u *p_isf; // 'isfname'
+EXTERN char_u *p_isi; // 'isident'
+EXTERN char_u *p_isp; // 'isprint'
+EXTERN int p_js; // 'joinspaces'
+EXTERN char_u *p_kp; // 'keywordprg'
+EXTERN char_u *p_km; // 'keymodel'
+EXTERN char_u *p_langmap; // 'langmap'*/
+EXTERN int p_lnr; // 'langnoremap'*/
+EXTERN char_u *p_lm; // 'langmenu'
+EXTERN char_u *p_lispwords; // 'lispwords'
+EXTERN long p_ls; // 'laststatus'
+EXTERN long p_stal; // 'showtabline'
+EXTERN char_u *p_lcs; // 'listchars'
+
+EXTERN int p_lz; // 'lazyredraw'
+EXTERN int p_lpl; // 'loadplugins'
+EXTERN int p_magic; // 'magic'
+EXTERN char_u *p_mef; // 'makeef'
+EXTERN char_u *p_mp; // 'makeprg'
+EXTERN char_u *p_cc; // 'colorcolumn'
+EXTERN int p_cc_cols[256]; // array for 'colorcolumn' columns
+EXTERN long p_mat; // 'matchtime'
+EXTERN long p_mco; // 'maxcombine'
+EXTERN long p_mfd; // 'maxfuncdepth'
+EXTERN long p_mmd; // 'maxmapdepth'
+EXTERN long p_mm; // 'maxmem'
+EXTERN long p_mmp; // 'maxmempattern'
+EXTERN long p_mmt; // 'maxmemtot'
+EXTERN long p_mis; // 'menuitems'
+EXTERN char_u *p_msm; // 'mkspellmem'
+EXTERN long p_mls; // 'modelines'
+EXTERN char_u *p_mouse; // 'mouse'
+EXTERN char_u *p_mousem; // 'mousemodel'
+EXTERN long p_mouset; // 'mousetime'
+EXTERN int p_more; // 'more'
+EXTERN char_u *p_opfunc; // 'operatorfunc'
+EXTERN char_u *p_para; // 'paragraphs'
+EXTERN int p_paste; // 'paste'
+EXTERN char_u *p_pt; // 'pastetoggle'
+EXTERN char_u *p_pex; // 'patchexpr'
+EXTERN char_u *p_pm; // 'patchmode'
+EXTERN char_u *p_path; // 'path'
+EXTERN char_u *p_cdpath; // 'cdpath'
+EXTERN long p_rdt; // 'redrawtime'
+EXTERN int p_remap; // 'remap'
+EXTERN long p_re; // 'regexpengine'
+EXTERN long p_report; // 'report'
+EXTERN long p_pvh; // 'previewheight'
+EXTERN int p_ari; // 'allowrevins'
+EXTERN int p_ri; // 'revins'
+EXTERN int p_ru; // 'ruler'
+EXTERN char_u *p_ruf; // 'rulerformat'
+EXTERN char_u *p_pp; // 'packpath'
+EXTERN char_u *p_rtp; // 'runtimepath'
+EXTERN long p_sj; // 'scrolljump'
+EXTERN long p_so; // 'scrolloff'
+EXTERN char_u *p_sbo; // 'scrollopt'
+EXTERN char_u *p_sections; // 'sections'
+EXTERN int p_secure; // 'secure'
+EXTERN char_u *p_sel; // 'selection'
+EXTERN char_u *p_slm; // 'selectmode'
+EXTERN char_u *p_ssop; // 'sessionoptions'
EXTERN unsigned ssop_flags;
# ifdef IN_OPTION_C
/* Also used for 'viewoptions'! */
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index 218e34f595..d19af4f73f 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -1640,6 +1640,16 @@ return {
defaults={if_true={vi=""}}
},
{
+ full_name='packpath', abbreviation='pp',
+ type='string', list='onecomma', scope={'global'},
+ deny_duplicates=true,
+ secure=true,
+ vi_def=true,
+ expand=true,
+ varname='p_pp',
+ defaults={if_true={vi=''}}
+ },
+ {
full_name='paragraphs', abbreviation='para',
type='string', scope={'global'},
vi_def=true,
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index fba6fac821..610fb660e7 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -2317,16 +2317,14 @@ static void spell_load_lang(char_u *lang)
for (round = 1; round <= 2; ++round) {
// Find the first spell file for "lang" in 'runtimepath' and load it.
vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
- "spell/%s.%s.spl",
- lang, spell_enc());
- r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
+ "spell/%s.%s.spl", lang, spell_enc());
+ r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl);
if (r == FAIL && *sl.sl_lang != NUL) {
// Try loading the ASCII version.
vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
- "spell/%s.ascii.spl",
- lang);
- r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
+ "spell/%s.ascii.spl", lang);
+ r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl);
if (r == FAIL && *sl.sl_lang != NUL && round == 1
&& apply_autocmds(EVENT_SPELLFILEMISSING, lang,
@@ -2354,7 +2352,7 @@ static void spell_load_lang(char_u *lang)
} else if (sl.sl_slang != NULL) {
// At least one file was loaded, now load ALL the additions.
STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl");
- do_in_runtimepath(fname_enc, TRUE, spell_load_cb, &sl);
+ do_in_runtimepath(fname_enc, DIP_ALL, spell_load_cb, &sl);
}
}
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 05141eaf1e..27855184df 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -4207,9 +4207,10 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
current_syn_inc_tag = ++running_syn_inc_tag;
prev_toplvl_grp = curwin->w_s->b_syn_topgrp;
curwin->w_s->b_syn_topgrp = sgl_id;
- if (source ? do_source(eap->arg, FALSE, DOSO_NONE) == FAIL
- : source_runtime(eap->arg, TRUE) == FAIL)
+ if (source ? do_source(eap->arg, false, DOSO_NONE) == FAIL
+ : source_runtime(eap->arg, DIP_ALL) == FAIL) {
EMSG2(_(e_notopen), eap->arg);
+ }
curwin->w_s->b_syn_topgrp = prev_toplvl_grp;
current_syn_inc_tag = prev_syn_inc_tag;
}
@@ -6023,12 +6024,12 @@ init_highlight (
if (get_var_value((char_u *)"g:syntax_on") != NULL) {
static int recursive = 0;
- if (recursive >= 5)
+ if (recursive >= 5) {
EMSG(_("E679: recursive loop loading syncolor.vim"));
- else {
- ++recursive;
- (void)source_runtime((char_u *)"syntax/syncolor.vim", TRUE);
- --recursive;
+ } else {
+ recursive++;
+ (void)source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL);
+ recursive--;
}
}
}
@@ -6041,22 +6042,24 @@ int load_colors(char_u *name)
{
char_u *buf;
int retval = FAIL;
- static int recursive = FALSE;
+ static int recursive = false;
- /* When being called recursively, this is probably because setting
- * 'background' caused the highlighting to be reloaded. This means it is
- * working, thus we should return OK. */
- if (recursive)
+ // When being called recursively, this is probably because setting
+ // 'background' caused the highlighting to be reloaded. This means it is
+ // working, thus we should return OK.
+ if (recursive) {
return OK;
+ }
- recursive = TRUE;
- buf = xmalloc(STRLEN(name) + 12);
- sprintf((char *)buf, "colors/%s.vim", name);
- retval = source_runtime(buf, FALSE);
+ recursive = true;
+ size_t buflen = STRLEN(name) + 12;
+ buf = xmalloc(buflen);
+ snprintf((char *)buf, buflen, "colors/%s.vim", name);
+ retval = source_runtime(buf, DIP_START + DIP_OPT);
xfree(buf);
apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf);
- recursive = FALSE;
+ recursive = false;
ui_refresh();
return retval;
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 5d15196784..dfecfb776d 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -2023,9 +2023,8 @@ get_tagfname (
if (first) {
ga_clear_strings(&tag_fnames);
ga_init(&tag_fnames, (int)sizeof(char_u *), 10);
- do_in_runtimepath((char_u *)
- "doc/tags doc/tags-??"
- , TRUE, found_tagfile_cb, NULL);
+ do_in_runtimepath((char_u *)"doc/tags doc/tags-??", DIP_ALL,
+ found_tagfile_cb, NULL);
}
if (tnp->tn_hf_idx >= tag_fnames.ga_len) {
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 278255c904..8aa3071395 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -75,7 +75,9 @@ static char *features[] = {
// clang-format off
static int included_patches[] = {
+ 1973,
1960,
+ 1840,
1832,
1831,
1809,
@@ -87,9 +89,11 @@ static int included_patches[] = {
1753,
1728,
1716,
+ 1712,
1695,
1654,
1652,
+ 1649,
1643,
1641,
// 1624 NA
@@ -98,7 +102,7 @@ static int included_patches[] = {
// 1599 NA
// 1598 NA
// 1597 NA
- // 1596,
+ 1596,
// 1595 NA
// 1594 NA
// 1593 NA
@@ -141,11 +145,11 @@ static int included_patches[] = {
// 1557,
// 1556 NA
// 1555 NA
- // 1554,
- // 1553,
- // 1552,
- // 1551,
- // 1550,
+ 1554,
+ 1553,
+ 1552,
+ 1551,
+ 1550,
// 1549,
// 1548,
// 1547,
@@ -167,7 +171,7 @@ static int included_patches[] = {
// 1531 NA
// 1530 NA
// 1529 NA
- // 1528,
+ 1528,
// 1527 NA
// 1526 NA
// 1525 NA
@@ -196,28 +200,28 @@ static int included_patches[] = {
// 1502 NA
// 1501 NA
1500,
- // 1499,
+ 1499,
// 1498 NA
// 1497 NA
// 1496 NA
// 1495 NA
// 1494,
// 1493 NA
- // 1492,
+ 1492,
// 1491,
// 1490 NA
// 1489 NA
// 1488 NA
// 1487 NA
- // 1486,
+ 1486,
// 1485 NA
// 1484 NA
// 1483 NA
// 1482 NA
// 1481 NA
- // 1480,
- // 1479,
- // 1478,
+ 1480,
+ 1479,
+ 1478,
// 1477,
// 1476 NA
// 1475 NA
@@ -299,7 +303,7 @@ static int included_patches[] = {
// 1399 NA
// 1398 NA
1397,
- // 1396,
+ 1396,
// 1395 NA
1394,
// 1393 NA
@@ -307,11 +311,11 @@ static int included_patches[] = {
// 1391 NA
// 1390 NA
// 1389 NA
- // 1388,
+ 1388,
// 1387 NA
// 1386 NA
// 1385 NA
- // 1384,
+ 1384,
// 1383 NA
// 1382 NA
// 1381 NA
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 165a44a148..09e9e850a7 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -174,6 +174,7 @@ enum {
EXPAND_USER,
EXPAND_SYNTIME,
EXPAND_USER_ADDR_TYPE,
+ EXPAND_PACKADD,
};
@@ -307,4 +308,12 @@ enum {
# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr( \
VV_HLSEARCH, !no_hlsearch && p_hls)
+// Used for flags in do_in_path()
+#define DIP_ALL 0x01 // all matches, not just the first one
+#define DIP_DIR 0x02 // find directories instead of files
+#define DIP_ERR 0x04 // give an error message when none found
+#define DIP_START 0x08 // also use "start" directory in 'packpath'
+#define DIP_OPT 0x10 // also use "opt" directory in 'packpath'
+#define DIP_NORTP 0x20 // do not use 'runtimepath'
+
#endif /* NVIM_VIM_H */
diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua
new file mode 100644
index 0000000000..b2ed39f288
--- /dev/null
+++ b/test/functional/legacy/packadd_spec.lua
@@ -0,0 +1,350 @@
+-- Tests for 'packpath' and :packadd
+
+local helpers = require('test.functional.helpers')(after_each)
+local clear, source, execute = helpers.clear, helpers.source, helpers.execute
+local call, eq, nvim = helpers.call, helpers.eq, helpers.meths
+local feed = helpers.feed
+
+local function expected_empty()
+ eq({}, nvim.get_vvar('errors'))
+end
+
+describe('packadd', function()
+ before_each(function()
+ clear()
+
+ source([=[
+ func SetUp()
+ let s:topdir = expand('%:p:h') . '/Xdir'
+ exe 'set packpath=' . s:topdir
+ let s:plugdir = s:topdir . '/pack/mine/opt/mytest'
+ endfunc
+
+ func TearDown()
+ call delete(s:topdir, 'rf')
+ endfunc
+
+ func Test_packadd()
+ call mkdir(s:plugdir . '/plugin', 'p')
+ call mkdir(s:plugdir . '/ftdetect', 'p')
+ call mkdir(s:plugdir . '/after', 'p')
+ set rtp&
+ let rtp = &rtp
+ filetype on
+
+ exe 'split ' . s:plugdir . '/plugin/test.vim'
+ call setline(1, 'let g:plugin_works = 42')
+ wq
+
+ exe 'split ' . s:plugdir . '/ftdetect/test.vim'
+ call setline(1, 'let g:ftdetect_works = 17')
+ wq
+
+ packadd mytest
+
+ call assert_true(42, g:plugin_works)
+ call assert_true(17, g:ftdetect_works)
+ call assert_true(len(&rtp) > len(rtp))
+ call assert_true(&rtp =~ (s:plugdir . '\($\|,\)'))
+ call assert_true(&rtp =~ (s:plugdir . '/after$'))
+
+ " Check exception
+ call assert_fails("packadd directorynotfound", 'E919:')
+ call assert_fails("packadd", 'E471:')
+ endfunc
+
+ func Test_packadd_noload()
+ call mkdir(s:plugdir . '/plugin', 'p')
+ call mkdir(s:plugdir . '/syntax', 'p')
+ set rtp&
+ let rtp = &rtp
+
+ exe 'split ' . s:plugdir . '/plugin/test.vim'
+ call setline(1, 'let g:plugin_works = 42')
+ wq
+ let g:plugin_works = 0
+
+ packadd! mytest
+
+ call assert_true(len(&rtp) > len(rtp))
+ call assert_true(&rtp =~ (s:plugdir . '\($\|,\)'))
+ call assert_equal(0, g:plugin_works)
+
+ " check the path is not added twice
+ let new_rtp = &rtp
+ packadd! mytest
+ call assert_equal(new_rtp, &rtp)
+ endfunc
+
+ func Test_packloadall()
+ " plugin foo with an autoload directory
+ let fooplugindir = &packpath . '/pack/mine/start/foo/plugin'
+ call mkdir(fooplugindir, 'p')
+ call writefile(['let g:plugin_foo_number = 1234',
+ \ 'let g:plugin_foo_auto = bbb#value',
+ \ 'let g:plugin_extra_auto = extra#value'], fooplugindir . '/bar.vim')
+ let fooautodir = &packpath . '/pack/mine/start/foo/autoload'
+ call mkdir(fooautodir, 'p')
+ call writefile(['let bar#value = 77'], fooautodir . '/bar.vim')
+
+ " plugin aaa with an autoload directory
+ let aaaplugindir = &packpath . '/pack/mine/start/aaa/plugin'
+ call mkdir(aaaplugindir, 'p')
+ call writefile(['let g:plugin_aaa_number = 333',
+ \ 'let g:plugin_aaa_auto = bar#value'], aaaplugindir . '/bbb.vim')
+ let aaaautodir = &packpath . '/pack/mine/start/aaa/autoload'
+ call mkdir(aaaautodir, 'p')
+ call writefile(['let bbb#value = 55'], aaaautodir . '/bbb.vim')
+
+ " plugin extra with only an autoload directory
+ let extraautodir = &packpath . '/pack/mine/start/extra/autoload'
+ call mkdir(extraautodir, 'p')
+ call writefile(['let extra#value = 99'], extraautodir . '/extra.vim')
+
+ packloadall
+ call assert_equal(1234, g:plugin_foo_number)
+ call assert_equal(55, g:plugin_foo_auto)
+ call assert_equal(99, g:plugin_extra_auto)
+ call assert_equal(333, g:plugin_aaa_number)
+ call assert_equal(77, g:plugin_aaa_auto)
+
+ " only works once
+ call writefile(['let g:plugin_bar_number = 4321'],
+ \ fooplugindir . '/bar2.vim')
+ packloadall
+ call assert_false(exists('g:plugin_bar_number'))
+
+ " works when ! used
+ packloadall!
+ call assert_equal(4321, g:plugin_bar_number)
+ endfunc
+
+ func Test_helptags()
+ let docdir1 = &packpath . '/pack/mine/start/foo/doc'
+ let docdir2 = &packpath . '/pack/mine/start/bar/doc'
+ call mkdir(docdir1, 'p')
+ call mkdir(docdir2, 'p')
+ call writefile(['look here: *look-here*'], docdir1 . '/bar.txt')
+ call writefile(['look away: *look-away*'], docdir2 . '/foo.txt')
+ exe 'set rtp=' . &packpath . '/pack/mine/start/foo,' . &packpath . '/pack/mine/start/bar'
+
+ helptags ALL
+
+ let tags1 = readfile(docdir1 . '/tags')
+ call assert_true(tags1[0] =~ 'look-here')
+ let tags2 = readfile(docdir2 . '/tags')
+ call assert_true(tags2[0] =~ 'look-away')
+ endfunc
+
+ func Test_colorscheme()
+ let colordirrun = &packpath . '/runtime/colors'
+ let colordirstart = &packpath . '/pack/mine/start/foo/colors'
+ let colordiropt = &packpath . '/pack/mine/opt/bar/colors'
+ call mkdir(colordirrun, 'p')
+ call mkdir(colordirstart, 'p')
+ call mkdir(colordiropt, 'p')
+ call writefile(['let g:found_one = 1'], colordirrun . '/one.vim')
+ call writefile(['let g:found_two = 1'], colordirstart . '/two.vim')
+ call writefile(['let g:found_three = 1'], colordiropt . '/three.vim')
+ exe 'set rtp=' . &packpath . '/runtime'
+
+ colorscheme one
+ call assert_equal(1, g:found_one)
+ colorscheme two
+ call assert_equal(1, g:found_two)
+ colorscheme three
+ call assert_equal(1, g:found_three)
+ endfunc
+
+ func Test_runtime()
+ let rundir = &packpath . '/runtime/extra'
+ let startdir = &packpath . '/pack/mine/start/foo/extra'
+ let optdir = &packpath . '/pack/mine/opt/bar/extra'
+ call mkdir(rundir, 'p')
+ call mkdir(startdir, 'p')
+ call mkdir(optdir, 'p')
+ call writefile(['let g:sequence .= "run"'], rundir . '/bar.vim')
+ call writefile(['let g:sequence .= "start"'], startdir . '/bar.vim')
+ call writefile(['let g:sequence .= "foostart"'], startdir . '/foo.vim')
+ call writefile(['let g:sequence .= "opt"'], optdir . '/bar.vim')
+ call writefile(['let g:sequence .= "xxxopt"'], optdir . '/xxx.vim')
+ exe 'set rtp=' . &packpath . '/runtime'
+
+ let g:sequence = ''
+ runtime extra/bar.vim
+ call assert_equal('run', g:sequence)
+ let g:sequence = ''
+ runtime START extra/bar.vim
+ call assert_equal('start', g:sequence)
+ let g:sequence = ''
+ runtime OPT extra/bar.vim
+ call assert_equal('opt', g:sequence)
+ let g:sequence = ''
+ runtime PACK extra/bar.vim
+ call assert_equal('start', g:sequence)
+ let g:sequence = ''
+ runtime! PACK extra/bar.vim
+ call assert_equal('startopt', g:sequence)
+ let g:sequence = ''
+ runtime PACK extra/xxx.vim
+ call assert_equal('xxxopt', g:sequence)
+
+ let g:sequence = ''
+ runtime ALL extra/bar.vim
+ call assert_equal('run', g:sequence)
+ let g:sequence = ''
+ runtime ALL extra/foo.vim
+ call assert_equal('foostart', g:sequence)
+ let g:sequence = ''
+ runtime! ALL extra/xxx.vim
+ call assert_equal('xxxopt', g:sequence)
+ let g:sequence = ''
+ runtime! ALL extra/bar.vim
+ call assert_equal('runstartopt', g:sequence)
+ endfunc
+ ]=])
+ call('SetUp')
+ end)
+
+ after_each(function()
+ call('TearDown')
+ end)
+
+ it('is working', function()
+ call('Test_packadd')
+ expected_empty()
+ end)
+
+ it('works with packadd!', function()
+ call('Test_packadd_noload')
+ expected_empty()
+ end)
+
+ it('works with :packloadall', function()
+ call('Test_packloadall')
+ expected_empty()
+ end)
+
+ it('works with helptags', function()
+ call('Test_helptags')
+ expected_empty()
+ end)
+
+ it('works with colorschemes', function()
+ call('Test_colorscheme')
+ expected_empty()
+ end)
+
+ it('works with :runtime [what]', function()
+ call('Test_runtime')
+ expected_empty()
+ end)
+
+ describe('command line completion', function()
+ local Screen = require('test.functional.ui.screen')
+ local screen
+
+ before_each(function()
+ screen = Screen.new(30, 5)
+ screen:attach()
+ screen:set_default_attr_ids({
+ [1] = {
+ foreground = Screen.colors.Black,
+ background = Screen.colors.Yellow,
+ },
+ [2] = {bold = true, reverse = true}
+ })
+ local NonText = Screen.colors.Blue
+ screen:set_default_attr_ignore({{}, {bold=true, foreground=NonText}})
+
+ execute([[let optdir1 = &packpath . '/pack/mine/opt']])
+ execute([[let optdir2 = &packpath . '/pack/candidate/opt']])
+ execute([[call mkdir(optdir1 . '/pluginA', 'p')]])
+ execute([[call mkdir(optdir1 . '/pluginC', 'p')]])
+ execute([[call mkdir(optdir2 . '/pluginB', 'p')]])
+ execute([[call mkdir(optdir2 . '/pluginC', 'p')]])
+ end)
+
+ it('works', function()
+ feed(':packadd <Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {1:pluginA}{2: pluginB pluginC }|
+ :packadd pluginA^ |
+ ]=])
+ feed('<Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {2:pluginA }{1:pluginB}{2: pluginC }|
+ :packadd pluginB^ |
+ ]=])
+ feed('<Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {2:pluginA pluginB }{1:pluginC}{2: }|
+ :packadd pluginC^ |
+ ]=])
+ feed('<Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {2:pluginA pluginB pluginC }|
+ :packadd ^ |
+ ]=])
+ end)
+
+ it('works for colorschemes', function()
+ source([[
+ let colordirrun = &packpath . '/runtime/colors'
+ let colordirstart = &packpath . '/pack/mine/start/foo/colors'
+ let colordiropt = &packpath . '/pack/mine/opt/bar/colors'
+ call mkdir(colordirrun, 'p')
+ call mkdir(colordirstart, 'p')
+ call mkdir(colordiropt, 'p')
+ call writefile(['let g:found_one = 1'], colordirrun . '/one.vim')
+ call writefile(['let g:found_two = 1'], colordirstart . '/two.vim')
+ call writefile(['let g:found_three = 1'], colordiropt . '/three.vim')
+ exe 'set rtp=' . &packpath . '/runtime']])
+
+ feed(':colorscheme <Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {1:one}{2: three two }|
+ :colorscheme one^ |
+ ]=])
+ feed('<Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {2:one }{1:three}{2: two }|
+ :colorscheme three^ |
+ ]=])
+ feed('<Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {2:one three }{1:two}{2: }|
+ :colorscheme two^ |
+ ]=])
+ feed('<Tab>')
+ screen:expect([=[
+ |
+ ~ |
+ ~ |
+ {2:one three two }|
+ :colorscheme ^ |
+ ]=])
+ end)
+ end)
+end)