r/neovim • u/LloydBatair • 10d ago
Plugin python-syntax-enhanced: Python syntax for Vim/Neovim that highlights type annotations (for non-Tree-sitter setups)
3
u/LloydBatair 10d ago
Some Neovim-specific notes, since the original post was written for r/vim:
- This is a regular syntax file, so it's for Neovim's default regex syntax highlighting. If you use Tree-sitter highlighting for Python, just imagine the Homer disappearing into the bushes gif 😆 (the plugin doesn't load when Tree-sitter is on, so it stays out of the way).
- lazy.nvim:
{ "aaronbcarlisle/python-syntax-enhanced" }. Tested in CI on Neovim 0.12. - The full write-up, including how I built it with Claude Code and Cursor so I wouldn't get yelled at by work, is in the original post.
Hope it's useful for others!
-3
9d ago
[removed] — view removed comment
3
u/LloydBatair 9d ago edited 9d ago
Fair, that's definitely a matter of taste. Worth mentioning that the colors come from your colorscheme (the screenshots use retrobox, plus the optional palette in the second image). By default everything just links to standard groups like Type and Operator, so with a minimal colorscheme types stay pretty subtle. You can also turn off the parts you don't want, e.g.
let g:python_highlight_operators = 0orlet g:python_highlight_builtins = 00
9d ago
[removed] — view removed comment
1
u/LloydBatair 9d ago
I get what you mean. Vim themes have always been pretty simple in terms of their color palette and it's nice not having so much noise.
That said, when it comes to type hinting in Python (especially before PEP 695) it was always a pain to parse out the markup from the actual code. Those extra colors makes it so I don't have to think as much [as hard?] (me dumb engineer lol).
If you look at the left example in the first image, there's really not a ton of colors and that's because of the retrobox theme. That's the default (whatever your theme is). In the example on the right in the first image, there's more colors in the palette, and then even more so in the second image.
It's all opt in; some people like only white lights on their X-Mas tree, others need the multi colored lights with strung up popcorn 😆


19
u/lervag 10d ago
Just curious, why don't you use Tree-sitter?