• Login
Community
  • Login

Automatic syntax highlighting for Python

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
pythonhighlightingsyntax
4 Posts 2 Posters 7.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    Marcell Lévai
    last edited by Feb 16, 2016, 10:10 AM

    I have a couple of .py files, in which I have python code. Syntax highlighting doesn’t seem to kick in, although I checked the langs.xml file and it contains the following lines:

    <Language ext=“py pyw” name=“python” commentLine=“#”>
    <Keywords name=“instre1”>and as assert break class continue def del elif else except exec False finally for from global if import in is lambda None not or pass print raise return triple True try while with yield</Keywords>
    </Language>

    So in theory it should recognize the file extension and apply python syntax highlighting. Yet it does not work, I have to set Python language for every new file with .py extension manually. How can I do this automatically or fix this problem?

    C 1 Reply Last reply Feb 16, 2016, 3:33 PM Reply Quote 0
    • C
      Claudia Frank @Marcell Lévai
      last edited by Feb 16, 2016, 3:33 PM

      Hello @Marcell-Lévai,

      did you install npp or do you use a zipped version?
      If you installed npp, did you use local configuration or %APPDATA%.
      If %APPDATA% was chosen, goto %APPDATA% directory and rename
      notepad++ directory then start notepad++. Does it still happen?

      Cheers
      Claudia

      M 1 Reply Last reply Feb 19, 2016, 2:06 PM Reply Quote 1
      • M
        Marcell Lévai @Claudia Frank
        last edited by Feb 19, 2016, 2:06 PM

        @Claudia-Frank thank you, I just did what you mentioned, and now it seems to work properly. I had a theme installed before, so the issue might have had something to do with that. Now I don’t have the theme. So I’ll try to achieve the same setting it up manually and seeing how that affects this. Thanks again for your help :)

        C 1 Reply Last reply Feb 19, 2016, 9:34 PM Reply Quote 0
        • C
          Claudia Frank @Marcell Lévai
          last edited by Feb 19, 2016, 9:34 PM

          @Marcell-Lévai

          oh, I see, that could simply mean that this theme hasn’t done any python styling.
          Which theme did you use, maybe it’s easier to modify the theme than to try to
          reconfigure the default theme.

          Normally you would load the theme, goto Settings->Style Configurator->select the language
          and set the styles.

          Cheers
          Claudia

          1 Reply Last reply Reply Quote 0
          1 out of 4
          • First post
            1/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors