How to start Python development in NeoVim

Neovim Environment for Python

I want to show how to start using NeoVim for Python development in a few basic steps.

Before migrating all of your development environments into vim, you should better start using vim plugins in your current development environment and get used to it, making progress slowly. You can use IdeaVim, it can be vscodevim, etc.. Don’t dive straight into it, just start to use a plugin.

During the learning phase, you need to learn basic vim movements. I can recommend ThePrimeagen’s youtube playlist, it will jumpstart your vim adventure.

While improving yourself in the plugin, you can start to spend some time with the real vim. To save some time in the beginning, you can follow these steps that I’ll give you now.

Go to Vim Bootstrap and generate your configuration file. It’ll immediately create a config file with the specifications you want, so you don’t need to search all of the bits and try to write your config file. Use for some time then learn how to configure. Also, this config file will be a great configuration reference. Save your config file as ~/.config/nvim/init.vim

Now open a command line in your project directory. Create a virtual environment for your project and activate it.

$ pipenv --python 3.9

Install the dependencies:

$ sudo apt install git curl python3-pip exuberant-ctags ack-grep

Then install neovim package for neovim development. You can install other packages like flake8 as well.

$ pipenv install --dev neovim flake8 pylint isort msgpack pynvim bpython ipython

Now we will open Neovim in the project directory, it’ll install the plugins, and then we can start to develop Python programs.

$ pipenv run nvim .

You can check your Python version to be sure that your virtual environment is activated.

:! python -V                                                            
Python 3.9.9

You can continue on your vim adventure right now.

Source: pyenv-pipenv-vim-config

Leave a Reply

Your email address will not be published. Required fields are marked *