Mercurial > vim
comparison runtime/doc/if_pyth.txt @ 4323:f1eab4f77a6f v7.3.911
updated for version 7.3.911
Problem: Python: Access to Vim variables is not so easy.
Solution: Define vim.vars and vim.vvars. (ZyX)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 24 Apr 2013 14:07:45 +0200 |
parents | 058f26a834c4 |
children | 7eaccdaa5304 |
comparison
equal
deleted
inserted
replaced
4322:918eada6eda5 | 4323:f1eab4f77a6f |
---|---|
235 The last case deserves a little explanation. When the :python or | 235 The last case deserves a little explanation. When the :python or |
236 :pyfile command specifies a range, this range of lines becomes the | 236 :pyfile command specifies a range, this range of lines becomes the |
237 "current range". A range is a bit like a buffer, but with all access | 237 "current range". A range is a bit like a buffer, but with all access |
238 restricted to a subset of lines. See |python-range| for more details. | 238 restricted to a subset of lines. See |python-range| for more details. |
239 | 239 |
240 vim.vars *python-vars* | |
241 vim.vvars *python-vvars* | |
242 Dictionary-like objects holding dictionaries with global (|g:|) and | |
243 vim (|v:|) variables respectively. Identical to `vim.bindeval("g:")`, | |
244 but faster. | |
240 | 245 |
241 Output from Python *python-output* | 246 Output from Python *python-output* |
242 Vim displays all Python code output in the Vim message area. Normal | 247 Vim displays all Python code output in the Vim message area. Normal |
243 output appears as information messages, and error output appears as | 248 output appears as information messages, and error output appears as |
244 error messages. | 249 error messages. |
305 :py del b[2] # delete a line (the third) | 310 :py del b[2] # delete a line (the third) |
306 :py b.append("bottom") # add a line at the bottom | 311 :py b.append("bottom") # add a line at the bottom |
307 :py n = len(b) # number of lines | 312 :py n = len(b) # number of lines |
308 :py (row,col) = b.mark('a') # named mark | 313 :py (row,col) = b.mark('a') # named mark |
309 :py r = b.range(1,5) # a sub-range of the buffer | 314 :py r = b.range(1,5) # a sub-range of the buffer |
315 :py b.vars["foo"] = "bar" # assign b:foo variable | |
310 | 316 |
311 ============================================================================== | 317 ============================================================================== |
312 4. Range objects *python-range* | 318 4. Range objects *python-range* |
313 | 319 |
314 Range objects represent a part of a vim buffer. You can obtain them in a | 320 Range objects represent a part of a vim buffer. You can obtain them in a |
352 buffer (read-only) The buffer displayed in this window | 358 buffer (read-only) The buffer displayed in this window |
353 cursor (read-write) The current cursor position in the window | 359 cursor (read-write) The current cursor position in the window |
354 This is a tuple, (row,col). | 360 This is a tuple, (row,col). |
355 height (read-write) The window height, in rows | 361 height (read-write) The window height, in rows |
356 width (read-write) The window width, in columns | 362 width (read-write) The window width, in columns |
363 vars (read-only) The window |w:| variables. Attribute is | |
364 unassignable, but you can change window | |
365 variables this way | |
357 The height attribute is writable only if the screen is split horizontally. | 366 The height attribute is writable only if the screen is split horizontally. |
358 The width attribute is writable only if the screen is split vertically. | 367 The width attribute is writable only if the screen is split vertically. |
359 | 368 |
360 ============================================================================== | 369 ============================================================================== |
361 6. pyeval() and py3eval() Vim functions *python-pyeval* | 370 6. pyeval() and py3eval() Vim functions *python-pyeval* |