runtime(doc): Whitespace updates
Use double sentence spacing and wrap lines at 'textwidth'. Code examples and tables were not wrapped unless this had already been done locally. closes: #18453 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
2a33b499a3
commit
c58f91c035
@ -1,4 +1,4 @@
|
||||
*if_pyth.txt* For Vim version 9.1. Last change: 2025 Mar 26
|
||||
*if_pyth.txt* For Vim version 9.1. Last change: 2025 Oct 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Paul Moore
|
||||
@ -80,9 +80,9 @@ and "EOF" do not have any indent.
|
||||
{body}" for each line in the [range], with the
|
||||
function arguments being set to the text of each line
|
||||
in turn, without a trailing <EOL>, and the current
|
||||
line number. The function should return a string or
|
||||
None. If a string is returned, it becomes the text of
|
||||
the line in the current turn. The default for [range]
|
||||
line number. The function should return a string or
|
||||
None. If a string is returned, it becomes the text of
|
||||
the line in the current turn. The default for [range]
|
||||
is the whole file: "1,$".
|
||||
|
||||
Examples:
|
||||
@ -91,7 +91,7 @@ Examples:
|
||||
:pydo if line: return "%4d: %s" % (linenr, line)
|
||||
<
|
||||
One can use `:pydo` in possible conjunction with `:py` to filter a range using
|
||||
python. For example: >
|
||||
python. For example: >
|
||||
|
||||
:py3 << EOF
|
||||
needle = vim.eval('@a')
|
||||
@ -205,12 +205,12 @@ vim.eval(str) *python-eval*
|
||||
'eval_expr', 'kind': 'f', 'filename': './src/eval.c'}] ~
|
||||
|
||||
NOTE: In Vim9 script, local variables in def functions are not visible
|
||||
to python evaluations. To pass local variables to python evaluations,
|
||||
to python evaluations. To pass local variables to python evaluations,
|
||||
use the {locals} dict when calling |py3eval()| and friends.
|
||||
|
||||
vim.bindeval(str) *python-bindeval*
|
||||
Like |python-eval|, but returns special objects described in
|
||||
|python-bindeval-objects|. These python objects let you modify
|
||||
|python-bindeval-objects|. These python objects let you modify
|
||||
(|List|, |Tuple| or |Dictionary|) or call (|Funcref|) vim objects.
|
||||
|
||||
vim.strwidth(str) *python-strwidth*
|
||||
@ -220,14 +220,14 @@ vim.strwidth(str) *python-strwidth*
|
||||
vim.foreach_rtp(callable) *python-foreach_rtp*
|
||||
Call the given callable for each path in 'runtimepath' until either
|
||||
callable returns something but None, the exception is raised or there
|
||||
are no longer paths. If stopped in case callable returned non-None,
|
||||
are no longer paths. If stopped in case callable returned non-None,
|
||||
vim.foreach_rtp function returns the value returned by callable.
|
||||
|
||||
vim.chdir(*args, **kwargs) *python-chdir*
|
||||
vim.fchdir(*args, **kwargs) *python-fchdir*
|
||||
Run os.chdir or os.fchdir, then all appropriate vim stuff.
|
||||
Note: you should not use these functions directly, use os.chdir and
|
||||
os.fchdir instead. Behavior of vim.fchdir is undefined in case
|
||||
os.fchdir instead. Behavior of vim.fchdir is undefined in case
|
||||
os.fchdir does not exist.
|
||||
|
||||
Error object of the "vim" module
|
||||
@ -265,12 +265,12 @@ vim.windows *python-windows*
|
||||
< Note: vim.windows object always accesses current tab page.
|
||||
|python-tabpage|.windows objects are bound to parent |python-tabpage|
|
||||
object and always use windows from that tab page (or throw vim.error
|
||||
in case tab page was deleted). You can keep a reference to both
|
||||
in case tab page was deleted). You can keep a reference to both
|
||||
without keeping a reference to vim module object or |python-tabpage|,
|
||||
they will not lose their properties in this case.
|
||||
|
||||
vim.tabpages *python-tabpages*
|
||||
A sequence object providing access to the list of vim tab pages. The
|
||||
A sequence object providing access to the list of vim tab pages. The
|
||||
object supports the following operations: >
|
||||
:py t = vim.tabpages[i] # Indexing (read-only)
|
||||
:py t in vim.tabpages # Membership test
|
||||
@ -293,10 +293,10 @@ vim.current *python-current*
|
||||
|
||||
Note: When assigning to vim.current.{buffer,window,tabpage} it expects
|
||||
valid |python-buffer|, |python-window| or |python-tabpage| objects
|
||||
respectively. Assigning triggers normal (with |autocommand|s)
|
||||
switching to given buffer, window or tab page. It is the only way to
|
||||
respectively. Assigning triggers normal (with |autocommand|s)
|
||||
switching to given buffer, window or tab page. It is the only way to
|
||||
switch UI objects in python: you can't assign to
|
||||
|python-tabpage|.window attribute. To switch without triggering
|
||||
|python-tabpage|.window attribute. To switch without triggering
|
||||
autocommands use >
|
||||
py << EOF
|
||||
saved_eventignore = vim.options['eventignore']
|
||||
@ -310,16 +310,16 @@ vim.current *python-current*
|
||||
vim.vars *python-vars*
|
||||
vim.vvars *python-vvars*
|
||||
Dictionary-like objects holding dictionaries with global (|g:|) and
|
||||
vim (|v:|) variables respectively. Identical to `vim.bindeval("g:")`,
|
||||
vim (|v:|) variables respectively. Identical to `vim.bindeval("g:")`,
|
||||
but faster.
|
||||
|
||||
vim.options *python-options*
|
||||
Object partly supporting mapping protocol (supports setting and
|
||||
getting items) providing a read-write access to global options.
|
||||
Note: unlike |:set| this provides access only to global options. You
|
||||
Note: unlike |:set| this provides access only to global options. You
|
||||
cannot use this object to obtain or set local options' values or
|
||||
access local-only options in any fashion. Raises KeyError if no global
|
||||
option with such name exists (i.e. does not raise KeyError for
|
||||
access local-only options in any fashion. Raises KeyError if no
|
||||
global option with such name exists (i.e. does not raise KeyError for
|
||||
|global-local| options and global only options, but does for window-
|
||||
and buffer-local ones). Use |python-buffer| objects to access to
|
||||
buffer-local options and |python-window| objects to access to
|
||||
@ -340,8 +340,8 @@ Output from Python *python-output*
|
||||
|
||||
*python-input*
|
||||
Input (via sys.stdin, including input() and raw_input()) is not
|
||||
supported, and may cause the program to crash. This should probably be
|
||||
fixed.
|
||||
supported, and may cause the program to crash. This should probably
|
||||
be fixed.
|
||||
|
||||
*python2-directory* *python3-directory* *pythonx-directory*
|
||||
Python 'runtimepath' handling *python-special-path*
|
||||
@ -401,11 +401,11 @@ Implementation is similar to the following, but written in C: >
|
||||
|
||||
sys.path_hooks.append(hook)
|
||||
|
||||
vim.VIM_SPECIAL_PATH *python-VIM_SPECIAL_PATH*
|
||||
String constant used in conjunction with vim path hook. If path hook
|
||||
vim.VIM_SPECIAL_PATH *python-VIM_SPECIAL_PATH*
|
||||
String constant used in conjunction with vim path hook. If path hook
|
||||
installed by vim is requested to handle anything but path equal to
|
||||
vim.VIM_SPECIAL_PATH constant it raises ImportError. In the only other
|
||||
case it uses special loader.
|
||||
vim.VIM_SPECIAL_PATH constant it raises ImportError. In the only
|
||||
other case it uses special loader.
|
||||
|
||||
Note: you must not use value of this constant directly, always use
|
||||
vim.VIM_SPECIAL_PATH object.
|
||||
@ -422,7 +422,7 @@ vim.find_spec(...) *python-find_spec*
|
||||
|
||||
vim._get_paths *python-_get_paths*
|
||||
Methods returning a list of paths which will be searched for by path
|
||||
hook. You should not rely on this method being present in future
|
||||
hook. You should not rely on this method being present in future
|
||||
versions, but can use it for debugging.
|
||||
|
||||
It returns a list of {rtp}/python2 (or {rtp}/python3) and
|
||||
@ -431,7 +431,8 @@ vim._get_paths *python-_get_paths*
|
||||
==============================================================================
|
||||
3. Buffer objects *python-buffer*
|
||||
|
||||
Buffer objects represent vim buffers. You can obtain them in a number of ways:
|
||||
Buffer objects represent vim buffers. You can obtain them in a number of
|
||||
ways:
|
||||
- via vim.current.buffer (|python-current|)
|
||||
- from indexing vim.buffers (|python-buffers|)
|
||||
- from the "buffer" attribute of a window (|python-window|)
|
||||
@ -445,9 +446,10 @@ act as if they were lists (yes, they are mutable) of strings, with each
|
||||
element being a line of the buffer. All of the usual sequence operations,
|
||||
including indexing, index assignment, slicing and slice assignment, work as
|
||||
you would expect. Note that the result of indexing (slicing) a buffer is a
|
||||
string (list of strings). This has one unusual consequence - b[:] is different
|
||||
from b. In particular, "b[:] = None" deletes the whole of the buffer, whereas
|
||||
"b = None" merely updates the variable b, with no effect on the buffer.
|
||||
string (list of strings). This has one unusual consequence - b[:] is
|
||||
different from b. In particular, "b[:] = None" deletes the whole of the
|
||||
buffer, whereas "b = None" merely updates the variable b, with no effect on
|
||||
the buffer.
|
||||
|
||||
Buffer indexes start at zero, as is normal in Python. This differs from vim
|
||||
line numbers, which start from 1. This is particularly relevant when dealing
|
||||
@ -458,17 +460,17 @@ The buffer object attributes are:
|
||||
|buffer-variable|s.
|
||||
b.options Mapping object (supports item getting, setting and
|
||||
deleting) that provides access to buffer-local options
|
||||
and buffer-local values of |global-local| options. Use
|
||||
and buffer-local values of |global-local| options. Use
|
||||
|python-window|.options if option is window-local,
|
||||
this object will raise KeyError. If option is
|
||||
this object will raise KeyError. If option is
|
||||
|global-local| and local value is missing getting it
|
||||
will return None.
|
||||
b.name String, RW. Contains buffer name (full path).
|
||||
b.name String, RW. Contains buffer name (full path).
|
||||
Note: when assigning to b.name |BufFilePre| and
|
||||
|BufFilePost| autocommands are launched.
|
||||
b.number Buffer number. Can be used as |python-buffers| key.
|
||||
b.number Buffer number. Can be used as |python-buffers| key.
|
||||
Read-only.
|
||||
b.valid True or False. Buffer object becomes invalid when
|
||||
b.valid True or False. Buffer object becomes invalid when
|
||||
corresponding buffer is wiped out.
|
||||
|
||||
The buffer object methods are:
|
||||
@ -541,7 +543,8 @@ Example (assume r is the current range): >
|
||||
==============================================================================
|
||||
5. Window objects *python-window*
|
||||
|
||||
Window objects represent vim windows. You can obtain them in a number of ways:
|
||||
Window objects represent vim windows. You can obtain them in a number of
|
||||
ways:
|
||||
- via vim.current.window (|python-current|)
|
||||
- from indexing vim.windows (|python-windows|)
|
||||
- from indexing "windows" attribute of a tab page (|python-tabpage|)
|
||||
|
||||
Reference in New Issue
Block a user