-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decorators highlighting in python #52
Comments
I've tried to add the |
@sivakov512: You can "fontify" decorators by adding a regular expression for them to the keyword list for font locking. (This has nothing to do with Nord theme, specifically, cf. docs on font locking.) For example, try adding the following to your Emacs config: (add-hook 'python-mode-hook
(lambda ()
(font-lock-add-keywords
nil
'(("\\(^@[^(]*\\)" 1 'font-lock-preprocessor-face))))) With an optional customization of the preprocessor face (set-face-attribute 'font-lock-preprocessor-face nil
:weight 'normal
:foreground "#B48EAD") you should get something like this (aside from further custom coloring of constant and keyword faces): |
@egnha Thanks for your explanation and examples, this looks like a really promising solution 🚀 Also Hacktoberfest started to today, I'd really appreciate some contributions to get some things done during this month 😄 (and you can get a swaggy t-shirt 👕 as recognition for free 😆 ) |
I’d be glad to submit a PR (though I won’t be able to get around to that until the weekend). Thanks for the 👕 offer :) |
@egnha Take your time, there's no time pressure. |
In the meantime, a more robust regex to identify decorators: (add-hook 'python-mode-hook
(lambda ()
(font-lock-add-keywords
nil
'(("^[[:space:]]*\\(@[^(#[:space:]\n]*\\)" 1 'font-lock-preprocessor-face))))) |
@arcticicestudio, unfortunately, I won't have time to submit a PR. Sorry. |
@egnha No problem, I'm also busy with other urgent tasks and projects, but I'll try to test and put your code into a PR as soon as there is some time. |
Thank you for your patience! 🙏🏼 I recently published the first "Northern Post — The state and roadmap of Nord" announcement which includes all details about the plans and future of the Nord project, including the goal of catching up with the backlog. This issue is part of the backlog and therefore I want to triage and process it to get one step closer to a "clean state". Read the announcement about reaching the "clean" contribution triage state in Nord's discussions for more details about the goal. Therefore it has been added for triage in the central and single-source-of-truth project board that is also described in more detail in the roadmap announcement. @sivakov512 Thanks again for your contribution 🚀 |
What about the highlighting of Python decorators with color different from classes and methods?
For example screenshots from Emacs (first) and Visual Studio Code (second)
The text was updated successfully, but these errors were encountered: