Home Explore Blog CI



neovim

9th chunk of `runtime/doc/if_pyth.txt`
2dfbe7463f4b4f1113e869fa08324b2a5644e6aeba3aa44a0000000100000c71
 (|python-current|)
	- from indexing vim.tabpages (|python-tabpages|)

You can use this object to access tab page windows. They have no methods and
no sequence or other interfaces.

Tab page attributes are:
	number		The tab page number like the one returned by
			|tabpagenr()|.
	windows		Like |python-windows|, but for current tab page.
	vars		The tab page |t:| variables.
	window		Current tabpage window.
	valid		True or False. Tab page object becomes invalid when
			corresponding tab page is closed.

TabPage object type is available using "TabPage" attribute of vim module.

==============================================================================
pyeval() and py3eval() Vim functions			*python-pyeval*

To facilitate bi-directional interface, you can use |pyeval()| and |py3eval()|
functions to evaluate Python expressions and pass their values to Vim script.
|pyxeval()| is also available.

==============================================================================
Python 3						*python3*

As Python 3 is the only supported version in Nvim, "python" is synonymous
with "python3" in the current version. However, code that aims to support older
versions of Nvim, as well as Vim, should prefer to use "python3" variants
explicitly if Python 3 is required.

							*:py3* *:python3*
:[range]py3 {stmt}
:[range]py3 << [trim] [{endmarker}]
{script}
{endmarker}

:[range]python3 {stmt}
:[range]python3 << [trim] [{endmarker}]
{script}
{endmarker}
	The `:py3` and `:python3` commands work similar to `:python`.  A
	simple check if the `:py3` command is working: >vim
		:py3 print("Hello")
<
	To see what version of Python you have: >vim
		:py3 import sys
		:py3 print(sys.version)
<							*:py3file*
:[range]py3f[ile] {file}
	The `:py3file` command works similar to `:pyfile`.
							*:py3do*
:[range]py3do {body}
	The `:py3do` command works similar to `:pydo`.

							*E880*
Raising SystemExit exception in python isn't endorsed way to quit vim, use:
>vim
	:py vim.command("qall!")
<
							*has-python*
You can test if Python is available with: >vim
	if has('pythonx')
	  echo 'there is Python'
	endif
	if has('python3')
	  echo 'there is Python 3.x'
	endif

Python 2 is no longer supported. Thus `has('python')` always returns
zero for backwards compatibility reasons.

==============================================================================
Python X						*python_x* *pythonx*

The "pythonx" and "pyx" prefixes were introduced for python code which
works with Python 2.6+ and Python 3. As Nvim only supports Python 3,
all these commands are now synonymous to their "python3" equivalents.

							*:pyx* *:pythonx*
`:pyx` and `:pythonx` work the same as `:python3`.  To check if `:pyx` works: >vim
	:pyx print("Hello")

To see what version of Python is being used: >vim
	:pyx import sys
	:pyx print(sys.version)
<
					*:pyxfile* *python_x-special-comments*
`:pyxfile` works the same as `:py3file`.

							*:pyxdo*
`:pyxdo` works the same as `:py3do`.

							*has-pythonx*
To check if `pyx*` functions and commands are available: >vim
	if has('pythonx')
	  echo 'pyx* commands are available. (Python ' .. &pyx .. ')'
	endif
<

 vim:tw=78:ts=8:noet:ft=help:norl:

Title: NVim Python 3 Support, pyeval(), py3eval(), and Python X Commands
Summary
This section explains that Python 3 is the only supported version in NVim, making "python" synonymous with "python3". It details the `:py3`, `:python3`, `:py3file`, and `:py3do` commands, mirroring their Python counterparts. It emphasizes against using SystemExit to quit Vim, suggesting `vim.command("qall!")` instead. The section discusses the now defunct `has('python')` and explains how `pythonx` commands are now synonymous with `python3` commands and provides corresponding commands to check its version and availability.