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
22
33
44 VIM REFERENCE MANUAL by Paul Moore
@@ -184,8 +184,9 @@ vim.eval(str) *python-eval*
184184 evaluator (see | expression | ). Returns the expression result as:
185185 - a string if the Vim expression evaluates to a string or number
186186 - a list if the Vim expression evaluates to a Vim list
187+ - a tuple if the Vim expression evaluates to a Vim tuple
187188 - 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.
189190 Examples: >
190191 :" value of the 'textwidth' option
191192 :py text_width = vim.eval("&tw")
@@ -196,6 +197,8 @@ vim.eval(str) *python-eval*
196197 :" Result is a string! Use string.atoi() to convert to a number.
197198 :py str = vim.eval("12+12")
198199 :
200+ :py tuple = vim.eval('(1, 2, 3)')
201+ :
199202 :py tagList = vim.eval('taglist("eval_expr")')
200203< The latter will return a python list of python dicts, for instance:
201204 [{'cmd': '/^eval_expr(arg, nextcmd)$/', 'static': 0, 'name': ~
@@ -207,8 +210,8 @@ vim.eval(str) *python-eval*
207210
208211vim.bindeval(str) *python-bindeval*
209212 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.
212215
213216vim.strwidth(str) *python-strwidth*
214217 Like | strwidth() | : returns number of display cells str occupies, tab
@@ -688,6 +691,22 @@ vim.List object *python-List*
688691 print isinstance(l, vim.List) # True
689692 class List(vim.List): # Subclassing
690693
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+
691710 vim.Function object *python-Function*
692711 Function-like object, acting like vim | Funcref | object. Accepts special
693712 keyword argument `self ` , see | Dictionary-function | . You can also use
0 commit comments