Tutorial by Examples

Vim has its own built-in Python interpreter. Thus it could use a different version of the default interpreter for the operating system. To check with which version of Python Vim was compiled, type the following command: :python import sys; print(sys.version) This imports the sys module and prin...
To be able to use vim commands in Python, the vim module should be imported. :python import vim After having this module imported, the user has access to the command function: :python vim.command("normal iText to insert") This command would execute i in normal mode then type Text t...
Every Python statement in Vim should be prefixed with the :python command, to instruct Vim that the next command is not Vimscript but Python. To avoid typing this command on each line, when executing multi-line Python code, it is possible to instruct Vim to interpret the code between two marker exp...

Page 1 of 1