Vim/Neovim: Scripting using Python

alpha2phi
2 min readJun 15, 2021

Use Vimscript and Python in your development workflow.

Vim/Neovim Scripting using Python

Overview

In my previous articles, I walked through with you how to develop a simple Neovim plugin using Neovim Lua APIs. For Python developers, there is a simpler solution as both Vim and Neovim support using Python for plugin development.

For Neovim (:h provider-python), it supports Python remote-plugins (:h remote_plugin.txt) and the Vim legacy python2 and python3 interfaces. To use Python plugins, you need the pynvim module. Run :checkhealth to see if you already have it.

For Vim (:h python3), type :version to check if Vim is built with Python 3 support.

Develop Plugins using Python

Let’s develop a few Vim/Neovim plugins using Python.

Text to Speech

With just a few lines of code, I can create a text-to-speech plugin.

  • Install the pyttsx3 library.
  • Under your Vim/Neovim configuration folder, create a file…

--

--

alpha2phi

Software engineer, Data Science and ML practitioner.