This will be a quick guide on how to setup neovim as your python IDE. It might invovle some concepts, but they shouldn’t block your setup as long as you follow these steps (hopefully).

Here are the tools/software that we need:

• neovim
• python3
• git

## Install

You can install neovim according to the offical document here. If you are using windows, you can always use the pre-built latest stable release provided by the neovim team.

I am using neovim v0.3.1 at the time of writing showing as following:

## Python3 and Neovim package

You need to have python3 installed and also install neovim package using pip

and then we can check if we have successfully configured python component for neovim by running the following command

and check if it outputs 1 like the following,

## Plugin Manager

There are many neovim/vim plugin managers like dein.vim and vim-plug. Here I am showing vim-plug in the below figures. If you are using windows and don’t have PowerShell, then you can download the plug.vim (as suggested by the vim-plug document) and put it at

~\AppData\Local\nvim\autoload

## Configuration file

Create the following configuration file based on the system you use:

• Unix: ~/.config/nvim/init.vim
• Windows: ~\AppData\Local\nvim\init.vim

this file will store all of our configurations about neovim such as:

• UI related settings
• certain behaviors you want neovim to behave
• plugins and related settings

Create the init.vim file in the above location if it’s not there yet.

## Plugin Manager

There are many neovim/vim plugin managers like dein.vim and vim-plug. Here I am showing vim-plug in the below figures. If you are using windows and don’t have PowerShell, then you can download the plug.vim (as suggested by the vim-plug document) and put it at

~\AppData\Local\nvim\autoload

After we created the init.vim file, paste the following contents in it

The lines above tell neovim and vim-plug which plugins (and their github repo name) that we need for our vim. And vim-plug will do a git clone for each of them.

Then, close your neovim and reopen it, now neovim will load the setting above. And then we run the following command, neovim will install the plugins we put into init.vim above

:PlugInstall

After this, we paste the following content into our configuration file below the content showing above.

Close neovim and reopen it again, then we have this

# Code completion and code lint/formatting

In order to have code completion, syntax checking, and code formatting, we need the following python packages

• jedi for code completion: pip install jedi
• flake8 for code linting: pip install flake8
• autopep8 for code formatting: pip install autopep8

Then, we have our python coding environment in our neovim. Suppose we have the following python code,

And neovim will display the following two errors/warnings:

So let’s fix them… note that we also have the autocompletion too!

Notice that we have another error/warning showing stating that

E231: missing whitespace after ‘,’

Now if we run the following command

:Autoformat or hit <F3> since we mapped it in our configuration file

we will notice that the error E231 is resolved after code reformatting.

since code linting and formatting rely on separate python uilities (flake8 and autopep8), which are isolated from our editor. So we can set the behavior of them such as