dobval / NvChad-python-config

Custom config of Nvim (NvChad) as a Python IDE.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NeoVim with NvChad for Python Development

Custom config of Nvim (NvChad) as a Python IDE. Note: This guide takes into account the new configuration structure in NvChad v2.5 and beyond as outlined in the release notes.

Plugins

  • Pyright: Static type checker and LSP.
  • Black: Code formatter (automatically runs on save).
  • Ruff: Linting and code analysis.
  • MyPy: Static type checker for Python.
  • DebugPy: Debugger integration.
  • Tree-sitter: Syntax highlighting and code folding.

Structure

nvim/
├── lua/
│ └── custom/
│ ├── configs/
│ │ └── python.lua
│ ├── plugins.lua
│ └── init.lua

Pre-requisites

  • NvChad (Check if Neovim is up to date (v0.9.5+)!)

    Backup previous Nvim config (optional)
      mv ~/.config/nvim ~/.config/nvim_backup
    - Git
    - npm (for installing Pyright)
    - Python (of course)

Installation

git clone https://github.com/dobval/NvChad-python-config.git ~/.config/nvim/lua

Python tools

pip install black ruff mypy debugpy

start nvim and sync

:Lazy sync

pyright

:MasonInstall pyright

Tree-sitter

:TSInstall python

Verify Setup

To make debugging more convenient, the following key mappings are set up:
  • F5: Start or continue the debugger.

  • F10: Step over the current line.

  • F11: Step into a function.

  • F12: Step out of a function.

  • <leader>b: Toggle a breakpoint.

  • Open a Python file in Neovim.
  • Check if Pyright is running by using the command :LspInfo.
  • Save a Python file to ensure Black formats the code.
  • Check for diagnostics from Ruff and MyPy.
  • Debug a Python file using the key mappings defined above.

About

Custom config of Nvim (NvChad) as a Python IDE.


Languages

Language:Lua 100.0%