vim Using Python for Vim scripting Execute Vim normal mode commands through Python statement


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 to insert and fall back to normal mode.