Module vpe.wrappers
Wrappers around the built-in Vim Python types.
You should not normally need to import this module directly.
Commands
- class wrappers.Commands(modifiers: dict[str, bool] = None)
A namespace for the set of Vim commands.
A single instance of this class is made available as
vpe.commands.This class provides functions for a majority of Vim’s commands, often providing a cleaner mechanism compared to python-command. For example:
from vpe import commands commands.edit('README.txt') # Start editing README.txt commands.print(a=10, b=20) # Print lines 1 to 20 commands.print(lrange=(10, 20)) # Print lines 1 to 20 commands.write(bang=True) # Same as :w! commands.split(vertical=True) # Split current window vertically
Each command function is actually an instance of the
Commandclass. See its description for details of the arguments.Most commands that can be entered at the colon prompt are supported. Structural parts of vim-script (such as function, while, try, etc) are excluded.
The vpe, vpe.mapping and vpe.syntax modules provides some functions and classes as alternatives for some commands. You are encouraged to use these alternatives in preference to the equivalent functions provided here. The following is a summary of the alternatives.
vpe.AutoCmdGroupA replacement for augroup and autocmd.
vpe.highlightProvides keyword style arguments. See also the
syntaxmodule.vpe.error_msgWrites a message with error highlighting, but does not raise a vim.error.
mappingThis provides functions to make key mappings that are handled by Python functions.
syntaxProvides a set of classes, functions and context managers to help define syntax highlighting.
See also:
vpe.pedit.Parameters
- modifiers
A dictionary of the default modifier flags for generated
Commandinstances. This is only intended to be used by thewith_modifiersclass method.
Class methods
- classmethod with_modifiers(**modifiers)
Return a version of
Commandsthat always applies modifiers.For example:
silent = vpe.commands.modified(silent=True) silent.tabonly()
Is equivalent to:
vpe.commands.tabonly(silent=True)