|
1 |
| -*if_pyth.txt* For Vim version 9.1. Last change: 2024 May 16 |
| 1 | +*if_pyth.txt* For Vim version 9.1. Last change: 2024 Nov 06 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Paul Moore
|
@@ -201,6 +201,10 @@ vim.eval(str) *python-eval*
|
201 | 201 | [{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name': ~
|
202 | 202 | 'eval_expr', 'kind': 'f', 'filename': './src/eval.c'}] ~
|
203 | 203 |
|
| 204 | + NOTE: In vim9script, local variables in def functions are not visible |
| 205 | + to to python evaluations. To pass local variables to python evaluations, |
| 206 | + use the {locals} dict when calling |py3eval()| and friends. |
| 207 | + |
204 | 208 | vim.bindeval(str) *python-bindeval*
|
205 | 209 | Like |python-eval|, but returns special objects described in
|
206 | 210 | |python-bindeval-objects|. These python objects let you modify (|List|
|
@@ -741,6 +745,10 @@ To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()|
|
741 | 745 | functions to evaluate Python expressions and pass their values to Vim script.
|
742 | 746 | |pyxeval()| is also available.
|
743 | 747 |
|
| 748 | +You can inject local variables into the evaluation using the optional {locals} |
| 749 | +dict. This can be particularly useful in vim9script where vim.eval |
| 750 | +|python-eval| will not find locals in a def func. |
| 751 | + |
744 | 752 | The Python value "None" is converted to v:none.
|
745 | 753 |
|
746 | 754 | ==============================================================================
|
|
0 commit comments