Skip to content

Commit 7b046c0

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 8a17c52 + e0b66da commit 7b046c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1312
-347
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ src/testdir/viminfo
8181
src/memfile_test
8282
src/json_test
8383
src/message_test
84+
src/kword_test
8485

8586
# From MacVim
8687
.*.swp

Filelist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ SRC_ALL = \
4545
src/hashtab.c \
4646
src/json.c \
4747
src/json_test.c \
48+
src/kword_test.c \
4849
src/list.c \
4950
src/keymap.h \
5051
src/macros.h \
@@ -122,6 +123,7 @@ SRC_ALL = \
122123
src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py \
123124
src/testdir/python_after/*.py \
124125
src/testdir/python_before/*.py \
126+
src/testdir/pyxfile/*.py \
125127
src/testdir/bench*.in \
126128
src/testdir/bench*.vim \
127129
src/testdir/samples/*.txt \

runtime/doc/eval.txt

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*eval.txt* For Vim version 8.0. Last change: 2017 Jan 14
1+
*eval.txt* For Vim version 8.0. Last change: 2017 Jan 28
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2222,8 +2222,8 @@ matchstr({expr}, {pat}[, {start}[, {count}]])
22222222
String {count}'th match of {pat} in {expr}
22232223
matchstrpos({expr}, {pat}[, {start}[, {count}]])
22242224
List {count}'th match of {pat} in {expr}
2225-
max({list}) Number maximum value of items in {list}
2226-
min({list}) Number minimum value of items in {list}
2225+
max({expr}) Number maximum value of items in {expr}
2226+
min({expr}) Number minimum value of items in {expr}
22272227
mkdir({name} [, {path} [, {prot}]])
22282228
Number create directory {name}
22292229
mode([expr]) String current editing mode
@@ -2239,6 +2239,7 @@ printf({fmt}, {expr1}...) String format text
22392239
pumvisible() Number whether popup menu is visible
22402240
pyeval({expr}) any evaluate |Python| expression
22412241
py3eval({expr}) any evaluate |python3| expression
2242+
pyxeval({expr}) any evaluate |python_x| expression
22422243
range({expr} [, {max} [, {stride}]])
22432244
List items from {expr} to {max}
22442245
readfile({fname} [, {binary} [, {max}]])
@@ -4171,6 +4172,10 @@ getchar([expr]) *getchar()*
41714172
exe "normal " . v:mouse_col . "|"
41724173
endif
41734174
<
4175+
When using bracketed paste only the first character is
4176+
returned, the rest of the pasted text is dropped.
4177+
|xterm-bracketed-paste|.
4178+
41744179
There is no prompt, you will somehow have to make clear to the
41754180
user that a character has to be typed.
41764181
There is no mapping for the character.
@@ -5796,16 +5801,20 @@ matchstrpos({expr}, {pat}[, {start}[, {count}]]) *matchstrpos()*
57965801
The type isn't changed, it's not necessarily a String.
57975802

57985803
*max()*
5799-
max({list}) Return the maximum value of all items in {list}.
5800-
If {list} is not a list or one of the items in {list} cannot
5801-
be used as a Number this results in an error.
5802-
An empty |List| results in zero.
5804+
max({expr}) Return the maximum value of all items in {expr}.
5805+
{expr} can be a list or a dictionary. For a dictionary,
5806+
it returns the maximum of all values in the dictionary.
5807+
If {expr} is neither a list nor a dictionary, or one of the
5808+
items in {expr} cannot be used as a Number this results in
5809+
an error. An empty |List| or |Dictionary| results in zero.
58035810

58045811
*min()*
5805-
min({list}) Return the minimum value of all items in {list}.
5806-
If {list} is not a list or one of the items in {list} cannot
5807-
be used as a Number this results in an error.
5808-
An empty |List| results in zero.
5812+
min({expr}) Return the minimum value of all items in {expr}.
5813+
{expr} can be a list or a dictionary. For a dictionary,
5814+
it returns the minimum of all values in the dictionary.
5815+
If {expr} is neither a list nor a dictionary, or one of the
5816+
items in {expr} cannot be used as a Number this results in
5817+
an error. An empty |List| or |Dictionary| results in zero.
58095818

58105819
*mkdir()* *E739*
58115820
mkdir({name} [, {path} [, {prot}]])
@@ -6163,6 +6172,14 @@ pyeval({expr}) *pyeval()*
61636172
non-string keys result in error.
61646173
{only available when compiled with the |+python| feature}
61656174

6175+
pyxeval({expr}) *pyxeval()*
6176+
Evaluate Python expression {expr} and return its result
6177+
converted to Vim data structures.
6178+
Uses Python 2 or 3, see |python_x| and 'pyxversion'.
6179+
See also: |pyeval()|, |py3eval()|
6180+
{only available when compiled with the |+python| or the
6181+
|+python3| feature}
6182+
61666183
*E726* *E727*
61676184
range({expr} [, {max} [, {stride}]]) *range()*
61686185
Returns a |List| with Numbers:
@@ -6789,10 +6806,12 @@ setpos({expr}, {list})
67896806
[bufnum, lnum, col, off, curswant]
67906807

67916808
"bufnum" is the buffer number. Zero can be used for the
6792-
current buffer. Setting the cursor is only possible for
6793-
the current buffer. To set a mark in another buffer you can
6794-
use the |bufnr()| function to turn a file name into a buffer
6795-
number.
6809+
current buffer. When setting an uppercase mark "bufnum" is
6810+
used for the mark position. For other marks it specifies the
6811+
buffer to set the mark in. You can use the |bufnr()| function
6812+
to turn a file name into a buffer number.
6813+
For setting the cursor and the ' mark "bufnum" is ignored,
6814+
since these are associated with a window, not a buffer.
67966815
Does not change the jumplist.
67976816

67986817
"lnum" and "col" are the position in the buffer. The first
@@ -8135,7 +8154,7 @@ winnr([{arg}]) The result is a Number, which is the number of the current
81358154
is returned.
81368155
The number can be used with |CTRL-W_w| and ":wincmd w"
81378156
|:wincmd|.
8138-
Also see |tabpagewinnr()|.
8157+
Also see |tabpagewinnr()| and |win_getid()|.
81398158

81408159
*winrestcmd()*
81418160
winrestcmd() Returns a sequence of |:resize| commands that should restore
@@ -8405,6 +8424,7 @@ printer Compiled with |:hardcopy| support.
84058424
profile Compiled with |:profile| support.
84068425
python Compiled with Python 2.x interface. |has-python|
84078426
python3 Compiled with Python 3.x interface. |has-python|
8427+
pythonx Compiled with |python_x| interface. |has-pythonx|
84088428
qnx QNX version of Vim.
84098429
quickfix Compiled with |quickfix| support.
84108430
reltime Compiled with |reltime()| support.

runtime/doc/if_pyth.txt

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*if_pyth.txt* For Vim version 8.0. Last change: 2016 Sep 17
1+
*if_pyth.txt* For Vim version 8.0. Last change: 2017 Jan 28
22

33

44
VIM REFERENCE MANUAL by Paul Moore
@@ -16,6 +16,7 @@ The Python Interface to Vim *python* *Python*
1616
8. pyeval(), py3eval() Vim functions |python-pyeval|
1717
9. Dynamic loading |python-dynamic|
1818
10. Python 3 |python3|
19+
11. Python X |python_x|
1920

2021
{Vi does not have any of these commands}
2122

@@ -711,6 +712,7 @@ vim.Function object *python-Function*
711712

712713
To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()|
713714
functions to evaluate Python expressions and pass their values to VimL.
715+
|pyxeval()| is also available.
714716

715717
==============================================================================
716718
9. Dynamic loading *python-dynamic*
@@ -811,5 +813,69 @@ dynamically, these has() calls will try to load them. If only one can be
811813
loaded at a time, just checking if Python 2 or 3 are available will prevent
812814
the other one from being available.
813815

816+
==============================================================================
817+
11. Python X *python_x* *pythonx*
818+
819+
Because most python code can be written so that it works with python 2.6+ and
820+
python 3 the pyx* functions and commands have been writen. They work exactly
821+
the same as the Python 2 and 3 variants, but select the Python version using
822+
the 'pyxversion' setting.
823+
824+
You should set 'pyxversion' in your |.vimrc| to prefer Python 2 or Python 3
825+
for Python commands. If you change this setting at runtime you may risk that
826+
state of plugins (such as initialization) may be lost.
827+
828+
If you want to use a module, you can put it in the {rtp}/pythonx directory.
829+
See |pythonx-directory|.
830+
831+
*:pyx* *:pythonx*
832+
The `:pyx` and `:pythonx` commands work similar to `:python`. A simple check
833+
if the `:pyx` command is working: >
834+
:pyx print("Hello")
835+
836+
To see what version of Python is being used: >
837+
:pyx import sys
838+
:pyx print(sys.version)
839+
<
840+
*:pyxfile* *python_x-special-comments*
841+
The `:pyxfile` command works similar to `:pyfile`. However you can add one of
842+
these comments to force Vim using `:pyfile` or `:py3file`: >
843+
#!/any string/python2 " Shebang. Must be the first line of the file.
844+
#!/any string/python3 " Shebang. Must be the first line of the file.
845+
# requires python 2.x " Maximum lines depend on 'modelines'.
846+
# requires python 3.x " Maximum lines depend on 'modelines'.
847+
Unlike normal modelines, the bottom of the file is not checked.
848+
If none of them are found, the 'pyxversion' setting is used.
849+
*W20* *W21*
850+
If Vim does not support the selected Python version a silent message will be
851+
printed. Use `:messages` to read them.
852+
853+
*:pyxdo*
854+
The `:pyxdo` command works similar to `:pydo`.
855+
856+
*has-pythonx*
857+
You can test if pyx* commands are available with: >
858+
if has('pythonx')
859+
echo 'pyx* commands are available. (Python ' . &pyx . ')'
860+
endif
861+
862+
When compiled with only one of |+python| or |+python3|, the has() returns 1.
863+
When compiled with both |+python| and |+python3|, the test depends on the
864+
'pyxversion' setting. If 'pyxversion' is 0, it tests Python 3 first, and if
865+
it is not available then Python 2. If 'pyxversion' is 2 or 3, it tests only
866+
Python 2 or 3 respectively.
867+
868+
Note that for has('pythonx') to work it may try to dynamically load Python 3
869+
or 2. This may have side effects, especially when Vim can only load one of
870+
the two.
871+
872+
If a user prefers Python 2 and want to fallback to Python 3, he needs to set
873+
'pyxversion' explicitly in his |.vimrc|. E.g.: >
874+
if has('python')
875+
set pyx=2
876+
elseif has('python3')
877+
set pyx=3
878+
endif
879+
814880
==============================================================================
815881
vim:tw=78:ts=8:ft=help:norl:

runtime/doc/index.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,10 @@ tag command action ~
14421442
|:python| :py[thon] execute Python command
14431443
|:pydo| :pyd[o] execute Python command for each line
14441444
|:pyfile| :pyf[ile] execute Python script file
1445+
|:pyx| :pyx execute |python_x| command
1446+
|:pythonx| :pythonx same as :pyx
1447+
|:pyxdo| :pyxd[o] execute |python_x| command for each line
1448+
|:pyxfile| :pyxf[ile] execute |python_x| script file
14451449
|:quit| :q[uit] quit current window (when one window quit Vim)
14461450
|:quitall| :quita[ll] quit Vim
14471451
|:qall| :qa[ll] quit Vim

runtime/doc/options.txt

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*options.txt* For Vim version 8.0. Last change: 2017 Jan 15
1+
*options.txt* For Vim version 8.0. Last change: 2017 Jan 28
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5968,6 +5968,35 @@ A jump table for the options with a short description can be found at |Q_op|.
59685968
PYTHON3_HOME, which was specified at compile time, will be used for
59695969
the Python 3 home directory.
59705970
Environment variables are expanded |:set_env|.
5971+
5972+
This option cannot be set from a |modeline| or in the |sandbox|, for
5973+
security reasons.
5974+
5975+
*'pyxversion'* *'pyx'*
5976+
'pyxversion' 'pyx' number (default depends on the build)
5977+
global
5978+
{not in Vi}
5979+
{only available when compiled with the |+python| or
5980+
the |+python3| feature}
5981+
Specifies the python version used for pyx* functions and commands
5982+
|python_x|. The default value is as follows:
5983+
5984+
Compiled with Default ~
5985+
|+python| and |+python3| 0
5986+
only |+python| 2
5987+
only |+python3| 3
5988+
5989+
Available values are 0, 2 and 3.
5990+
If 'pyxversion' is 0, it is set to 2 or 3 after the first execution of
5991+
any python2/3 commands or functions. E.g. `:py` sets to 2, and `:py3`
5992+
sets to 3. `:pyx` sets it to 3 if Python 3 is available, otherwise sets
5993+
to 2 if Python 2 is available.
5994+
See also: |has-pythonx|
5995+
5996+
If Vim is compiled with only |+python| or |+python3| setting
5997+
'pyxversion' has no effect. The pyx* functions and commands are
5998+
always the same as the compiled version.
5999+
59716000
This option cannot be set from a |modeline| or in the |sandbox|, for
59726001
security reasons.
59736002

runtime/doc/quickref.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ Short explanation of each option: *option-list*
843843
'pythonhome' name of the Python 2 home directory
844844
'pythonthreedll' name of the Python 3 dynamic library
845845
'pythonthreehome' name of the Python 3 home directory
846+
'pyxversion' 'pyx' Python version used for pyx* commands
846847
'quoteescape' 'qe' escape characters used in a string
847848
'readonly' 'ro' disallow writing the buffer
848849
'redrawtime' 'rdt' timeout for 'hlsearch' and |:match| highlighting

runtime/doc/syntax.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*syntax.txt* For Vim version 8.0. Last change: 2016 Oct 30
1+
*syntax.txt* For Vim version 8.0. Last change: 2017 Jan 17
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3479,6 +3479,8 @@ DEFINING CASE *:syn-case* *E390*
34793479
"ignore". Note that any items before this are not affected, and all
34803480
items until the next ":syntax case" command are affected.
34813481

3482+
:sy[ntax] case
3483+
Show either "syntax case match" or "syntax case ignore" (translated).
34823484

34833485
SPELL CHECKING *:syn-spell*
34843486

@@ -3496,6 +3498,11 @@ SPELL CHECKING *:syn-spell*
34963498

34973499
To activate spell checking the 'spell' option must be set.
34983500

3501+
:sy[ntax] spell
3502+
Show either "syntax spell toplevel", "syntax spell notoplevel" or
3503+
"syntax spell default" (translated).
3504+
3505+
34993506
SYNTAX ISKEYWORD SETTING *:syn-iskeyword*
35003507

35013508
:sy[ntax] iskeyword [clear | {option}]
@@ -4089,6 +4096,9 @@ IMPLICIT CONCEAL *:syn-conceal-implicit*
40894096
off" returns to the normal state where the "conceal" flag must be
40904097
given explicitly.
40914098

4099+
:sy[ntax] conceal
4100+
Show either "syntax conceal on" or "syntax conceal off" (translated).
4101+
40924102
==============================================================================
40934103
7. Syntax patterns *:syn-pattern* *E401* *E402*
40944104

0 commit comments

Comments
 (0)