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.
    • Marcell LévaiM
      Marcell Lévai
      last edited by

      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?

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Marcell Lévai
        last edited by

        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

        Marcell LévaiM 1 Reply Last reply Reply Quote 1
        • Marcell LévaiM
          Marcell Lévai @Claudia Frank
          last edited by

          @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 :)

          Claudia FrankC 1 Reply Last reply Reply Quote 0
          • Claudia FrankC
            Claudia Frank @Marcell Lévai
            last edited by

            @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
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors