Run Black
Create a keybind to run Black and save file by adding this to your .vimrc
By default, the <leader> key is the backslash \ character. Mine is the spacebar key. You can remap it by adding the following line in your .vimrc:
If it fails to reformat the code, put Vim in the background by pressing Ctrl + z so that you can read the error message, and then just come back to Vim with the fg command.