comparison runtime/doc/if_pyth.txt @ 4401:cfd76908da25 v7.3.949

updated for version 7.3.949 Problem: Python: no easy access to tabpages. Solution: Add vim.tabpages and vim.current.tabpage. (ZyX)
author Bram Moolenaar <bram@vim.org>
date Wed, 15 May 2013 15:12:29 +0200
parents a84f21892563
children 2a166caf8709
comparison
equal deleted inserted replaced
4400:7324bd8b67b1 4401:cfd76908da25
221 object supports the following operations: > 221 object supports the following operations: >
222 :py w = vim.windows[i] # Indexing (read-only) 222 :py w = vim.windows[i] # Indexing (read-only)
223 :py w in vim.windows # Membership test 223 :py w in vim.windows # Membership test
224 :py n = len(vim.windows) # Number of elements 224 :py n = len(vim.windows) # Number of elements
225 :py for w in vim.windows: # Sequential access 225 :py for w in vim.windows: # Sequential access
226 < Note: vim.windows object always accesses current tab page,.
227 |python-tabpage|.windows objects are bound to parent |python-tabpage|
228 object and always use windows from that tab page (or throw vim.error
229 in case tab page was deleted). You can keep a reference to both
230 without keeping a reference to vim module object or |python-tabpage|,
231 they will not loose their properties in this case.
232
233 vim.tabpages *python-tabpages*
234 A sequence object providing access to the list of vim tab pages. The
235 object supports the following operations: >
236 :py t = vim.tabpages[i] # Indexing (read-only)
237 :py t in vim.tabpages # Membership test
238 :py n = len(vim.tabpages) # Number of elements
239 :py for t in vim.tabpages: # Sequential access
226 < 240 <
227 vim.current *python-current* 241 vim.current *python-current*
228 An object providing access (via specific attributes) to various 242 An object providing access (via specific attributes) to various
229 "current" objects available in vim: 243 "current" objects available in vim:
230 vim.current.line The current line (RW) String 244 vim.current.line The current line (RW) String
231 vim.current.buffer The current buffer (RO) Buffer 245 vim.current.buffer The current buffer (RO) Buffer
232 vim.current.window The current window (RO) Window 246 vim.current.window The current window (RO) Window
247 vim.current.tabpage The current tab page (RO) TabPage
233 vim.current.range The current line range (RO) Range 248 vim.current.range The current line range (RO) Range
234 249
235 The last case deserves a little explanation. When the :python or 250 The last case deserves a little explanation. When the :python or
236 :pyfile command specifies a range, this range of lines becomes the 251 :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 252 "current range". A range is a bit like a buffer, but with all access
373 5. Window objects *python-window* 388 5. Window objects *python-window*
374 389
375 Window objects represent vim windows. You can obtain them in a number of ways: 390 Window objects represent vim windows. You can obtain them in a number of ways:
376 - via vim.current.window (|python-current|) 391 - via vim.current.window (|python-current|)
377 - from indexing vim.windows (|python-windows|) 392 - from indexing vim.windows (|python-windows|)
393 - from indexing "windows" attribute of a tab page (|python-tabpage|)
394 - from the "window" attribute of a tab page (|python-tabpage|)
378 395
379 You can manipulate window objects only through their attributes. They have no 396 You can manipulate window objects only through their attributes. They have no
380 methods, and no sequence or other interface. 397 methods, and no sequence or other interface.
381 398
382 Window attributes are: 399 Window attributes are:
405 422
406 The height attribute is writable only if the screen is split horizontally. 423 The height attribute is writable only if the screen is split horizontally.
407 The width attribute is writable only if the screen is split vertically. 424 The width attribute is writable only if the screen is split vertically.
408 425
409 ============================================================================== 426 ==============================================================================
427 6. Tab page objects *python-tabpage*
428
429 Tab page objects represent vim tab pages. You can obtain them in a number of
430 ways:
431 - via vim.current.tabpage (|python-current|)
432 - from indexing vim.tabpages (|python-tabpages|)
433
434 You can use this object to access tab page windows. They have no methods and
435 no sequence or other interfaces.
436
437 Tab page attributes are:
438 number The tab page number like the one returned by
439 |tabpagenr()|.
440 windows Like |python-windows|, but for current tab page.
441 vars The tab page |t:| variables.
442 window Current tabpage window.
443
444 ==============================================================================
410 6. pyeval() and py3eval() Vim functions *python-pyeval* 445 6. pyeval() and py3eval() Vim functions *python-pyeval*
411 446
412 To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()| 447 To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()|
413 functions to evaluate Python expressions and pass their values to VimL. 448 functions to evaluate Python expressions and pass their values to VimL.
414 449