• Login
Community
  • Login

c++ syntax for all files

Scheduled Pinned Locked Moved General Discussion
9 Posts 4 Posters 1.0k 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.
  • W
    wS Стас
    last edited by Feb 6, 2020, 3:03 PM

    c++ syntax for all files - how i can do this?
    I disabled all syntaxes except с++, but this does not work.

    A 1 Reply Last reply Feb 6, 2020, 3:51 PM Reply Quote 0
    • A
      Alan Kilborn @wS Стас
      last edited by Feb 6, 2020, 3:51 PM

      @wS-Стас

      Well, you might try defining what “all files” really means by putting their extensions here:

      5872256b-d605-43df-a728-a2c373af1b27-image.png

      1 Reply Last reply Reply Quote 1
      • W
        wS Стас
        last edited by wS Стас Feb 6, 2020, 4:08 PM Feb 6, 2020, 4:05 PM

        Yes, for examle i have “php” in “User ext” and anyway it’s not working.
        https://prnt.sc/qyiwft

        I think because: https://prnt.sc/qyiuyr
        I can’t edit left side (“default ext”). When i open .php file, i have .php highlighting.

        1 Reply Last reply Reply Quote 0
        • W
          wS Стас
          last edited by Feb 6, 2020, 4:12 PM

          https://prnt.sc/qyiyo0

          I turned off all languages except c++, and even this does not help, the .php file opens with .php highlighting. It’s stupid… Exist properties “-l cpp <file>”, but how i can do this for all files?

          E 1 Reply Last reply Feb 7, 2020, 6:43 PM Reply Quote 0
          • E
            Ekopalypse @wS Стас
            last edited by Feb 7, 2020, 6:43 PM

            @wS-Стас

            may I ask you what you really try to achieve?
            Setting the cpp lexer to every document might not do
            what you think it would do.
            For example, a cpp lexer is not able to lex a php file correctly.

            1 Reply Last reply Reply Quote 2
            • W
              wS Стас
              last edited by Feb 7, 2020, 6:56 PM

              I want to do the same highlighting for all file types. To be more precise, i am only interested in comments and lines.

              //
              /**/
              ‘’
              “”

              And there are times when the highlighting does not work at all and in order for it to work, you need to restart the program or close the file and open it again.

              1 Reply Last reply Reply Quote 0
              • P
                PeterJones
                last edited by PeterJones Feb 7, 2020, 6:59 PM Feb 7, 2020, 6:58 PM

                @wS-Стас said in c++ syntax for all files:

                To be more precise, i am only interested in comments and lines.

                You can add extra highlighting to any builtin lexer (like the PHP lexer) using regexes via the script EnhanceAnyBuiltinLexer.py that @Ekopalypse shares in this linked post . A variant of that script could be made to work without reference to which lexer is active, which would be a way to highlight/color/style comments and quotes the same in all languages.

                1 Reply Last reply Reply Quote 1
                • P
                  PeterJones
                  last edited by Feb 7, 2020, 7:01 PM

                  @wS-Стас said in c++ syntax for all files:

                  when the highlighting does not work at all

                  Never seen that happen. If you have reproducible circumstances, that would be good to share.

                  (on rare occasion, I have seen it look like highlighting is temporarily missing because a redraw didn’t happen at the right time; usually just switching to another tab in Notepad++, and then back, which force the redraw)

                  1 Reply Last reply Reply Quote 1
                  • E
                    Ekopalypse
                    last edited by Ekopalypse Feb 7, 2020, 7:17 PM Feb 7, 2020, 7:16 PM

                    @wS-Стас said in c++ syntax for all files:

                    And there are times when the highlighting does not work at all and in order for it to work, you need to restart the program or close the file and open it again.

                    That is actually one thing I would expect if a lexer is used which is not written for that kind of file.
                    I never experienced this if the correct lexer for the current file did the highlighting.

                    In order to make this work, that every programming language file, as far as notepad++ knows it,
                    displays its comment in the same color and font you have to go through each defined language
                    and reconfigure there comment line settings.

                    Another alternative might be to explicitly mark those lines like here

                    a52ef6c3-577e-4b2d-930b-f83c26e9e8a8-image.png

                    Might be possible by recording a macro - didn’t try it.

                    Or using a scripting language like @PeterJones mentioned.

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