1
- *if_pyth.txt* For Vim version 9.1. Last change: 2024 Nov 09
1
+ *if_pyth.txt* For Vim version 9.1. Last change: 2025 Mar 26
2
2
3
3
4
4
VIM REFERENCE MANUAL by Paul Moore
@@ -184,8 +184,9 @@ vim.eval(str) *python-eval*
184
184
evaluator (see | expression | ). Returns the expression result as:
185
185
- a string if the Vim expression evaluates to a string or number
186
186
- a list if the Vim expression evaluates to a Vim list
187
+ - a tuple if the Vim expression evaluates to a Vim tuple
187
188
- a dictionary if the Vim expression evaluates to a Vim dictionary
188
- Dictionaries and lists are recursively expanded.
189
+ Dictionaries, lists and tuples are recursively expanded.
189
190
Examples: >
190
191
:" value of the 'textwidth' option
191
192
:py text_width = vim.eval("&tw")
@@ -196,6 +197,8 @@ vim.eval(str) *python-eval*
196
197
:" Result is a string! Use string.atoi() to convert to a number.
197
198
:py str = vim.eval("12+12")
198
199
:
200
+ :py tuple = vim.eval('(1, 2, 3)')
201
+ :
199
202
:py tagList = vim.eval('taglist("eval_expr")')
200
203
< The latter will return a python list of python dicts, for instance:
201
204
[{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name': ~
@@ -207,8 +210,8 @@ vim.eval(str) *python-eval*
207
210
208
211
vim.bindeval(str) *python-bindeval*
209
212
Like | python-eval | , but returns special objects described in
210
- | python-bindeval-objects | . These python objects let you modify ( | List |
211
- or | Dictionary | ) or call (| Funcref | ) vim objects.
213
+ | python-bindeval-objects | . These python objects let you modify
214
+ ( | List | , | Tuple | or | Dictionary | ) or call (| Funcref | ) vim objects.
212
215
213
216
vim.strwidth(str) *python-strwidth*
214
217
Like | strwidth() | : returns number of display cells str occupies, tab
@@ -688,6 +691,22 @@ vim.List object *python-List*
688
691
print isinstance(l, vim.List) # True
689
692
class List(vim.List): # Subclassing
690
693
694
+ vim.Tuple object *python-Tuple*
695
+ Sequence-like object providing access to vim | Tuple | type.
696
+ Supports `.locked` attribute, see | python-.locked | . Also supports the
697
+ following methods:
698
+ Method Description ~
699
+ __new__(), __new__(iterable)
700
+ You can use `vim .Tuple ()` to create new vim tuples.
701
+ Without arguments constructs empty list.
702
+ Examples: >
703
+ t = vim.Tuple("abc") # Constructor, result: ('a', 'b', 'c')
704
+ print t[1:] # slicing
705
+ print t[0] # getting item
706
+ for i in t: # iteration
707
+ print isinstance(t, vim.Tuple) # True
708
+ class Tuple(vim.Tuple): # Subclassing
709
+
691
710
vim.Function object *python-Function*
692
711
Function-like object, acting like vim | Funcref | object. Accepts special
693
712
keyword argument `self ` , see | Dictionary-function | . You can also use
0 commit comments