-
Notifications
You must be signed in to change notification settings - Fork 0
neovim Python
lamt edited this page Jun 13, 2022
·
4 revisions
| Category | Name |
|---|---|
| Language Server | pyright |
| Debugger | debugpy |
| Linter | null-ls(flake8) |
| Formatter | null-ls(black) |
| Formatter | null-ls(isort) |
mkdir hello-python
cd hello-python# Optional
# You can keep the version of pyenv.
pyenv install <your version>
pyenv local <your version>
python -m pip install --upgrade pip
pip install debugpyvi main.pythonprint("Hello World.")# Optional
# Run
python main.pyThis sample use nvim-dap-python.
vi main.py-
F9: Set Breakpoint -
F5: Start Debug - Select
Launch file - Stop at Breakpoint
-
F10: Step over - Exit Debug
vi main.pyimport os
print("Hello World.")Show the trouble window (leader x x).
# Optional
# Also runnable on the command line
flake8Linter can change settings (e.g. add tox.ini).
See: flake8 -- Configuration Locations.
See also: flake8-black -- Configuration.
vi main.pyimport sys
import os
print(
"Hello World."
):w or space f.
# Optional
# Also runnable on the command line
black .
isort .Formatter can change settings (e.g. add pyproject.toml).
black takes the following stance.
Pro-tip: If you're asking yourself "Do I need to configure anything?" the answer is "No". Black is all about sensible defaults. Applying those defaults will have your code in compliance with many other Black formatted projects.
See: black -- Configuration.
See: isort -- Config Files.
See also: isort -- Black Compatibility.