Community
    • Login

    c++ syntax for all files

    Scheduled Pinned Locked Moved General Discussion
    9 Posts 4 Posters 1.6k Views 1 Watching
    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.
    • wS СтасW Offline
      wS Стас
      last edited by

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

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @wS Стас
        last edited by

        @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
        • wS СтасW Offline
          wS Стас
          last edited by wS Стас

          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
          • wS СтасW Offline
            wS Стас
            last edited by

            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?

            EkopalypseE 1 Reply Last reply Reply Quote 0
            • EkopalypseE Offline
              Ekopalypse @wS Стас
              last edited by

              @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
              • wS СтасW Offline
                wS Стас
                last edited by

                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
                • PeterJonesP Offline
                  PeterJones
                  last edited by PeterJones

                  @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
                  • PeterJonesP Offline
                    PeterJones
                    last edited by

                    @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
                    • EkopalypseE Offline
                      Ekopalypse
                      last edited by Ekopalypse

                      @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

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors