• 0 Votes
    6 Posts
    824 Views
    Jason McGeeJ

    Thanks @PeterJones, I really appreciate your time! I spent a chunk of time yesterday too trying to work out the regex if-then-else functionality before I gave up.

    I wouldn’t want to pick up everything that starts with \ because that will pull in a lot of commands that aren’t related to document structure (every command starts with \). For example, here’s my minimum working example with a numbered list in it, and that picks up the \begin{enumerate} and \items:

    \documentclass{scrreprt} \begin{document} \chapter{Chapter 1 with sections} \section{1.1} \subsection{1.1.1} Lorem \subsection{1.1.2} ipsum \section{1.2} \begin{enumerate} \item dolor \item sit \item amet \end{enumerate} \chapter{Chapter 2 with no sections} consectetur adipiscing elit. \chapter{Chapter 3 with unnumbered sections} \section*{Heading with no number} Phasellus mollis posuere ante vel tincidunt. \section*{Second heading with no number} Donec faucibus tellus sapien, vitae fringilla nulla bibendum eget. \appendix \chapter{Appendix A} \include{document} \chapter{Appendix B with sections} \section{B.1} Nam mauris nisl, cursus at erat in, \section{B.2} molestie luctus nulla. \end{document}

    … but picking up the \chapter{} as a function along with the \section{}s is a great workaround!

    Here’s what I have now:

    <?xml version="1.0" encoding="UTF-8" ?> <!-- ==========================================================================\ | To learn how to make your own language parser, please check the following | link: https://npp-user-manual.org/docs/function-list/ \=========================================================================== --> <NotepadPlus> <functionList> <parser displayName="LaTeX Syntax" id ="latex_class" commentExpr="(?x) (%.*?$) # Comment " > <function mainExpr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`) (?im-s) # ignore case, ^ and $ match start/end of line, dot doesn't match newline \\begin{document} # match start of document " > </function> <classRange mainExpr ="(?x) # free-spacing (see `RegEx - Pattern Modifiers`) (?m) # ^ and $ match at line-breaks (?'CLASS_START' ^\s* # optional leading white space before \chapter \\(chapter\*?) ) (?s:.*?) # whatever, (?= # ...up till \s* # ...optional leading white-space of (?: (?&amp;CLASS_START) # ...next header | (\\end{document}) # ...or end of document ) ) " > <className> <nameExpr expr="(?x) # free-spacing (see `RegEx - Pattern Modifiers`) (?<={) # brace before name .*? # name (?=}) # brace after name " /> </className> <function mainExpr="(?xm-s) # free-spacing (see `RegEx - Pattern Modifiers`) \\(chapter| # match chapter so that even \chapters with no \section appear section| # match \section subsection| # match \subsection )\*?{.*} # match starred and unstarred commands " > <functionName> <funcNameExpr expr=".*"/> </functionName> </function> </classRange> </parser> </functionList> </NotepadPlus>

    And the result on the sample file:
    Screenshot 2025-05-14 094212.png

    I modified the classRange mainExpr because I wanted to also match indented \chapter{}s (like I have for the appendices in the new sample file). After that change I found that the last \chapter{} wasn’t being matched with \Z so I changed the alternate search to look for \end{document} instead (which will always appear) and that worked.

    Thanks for your help!

  • Preventing Unicode Symbols From Displaying as Emojis

    2
    0 Votes
    2 Posts
    421 Views
    PeterJonesP

    @Malek-A ,

    If your active font has a glyph for that character, then whether it looks like an emoji or not depends on that font. If your chosen font does not contain the glyph, depending on your Notepad++ DirectWrite preferences, Windows OS may go through some alternate fonts to find one that has the glyph.

    For example, for Yin Yang, if I use my default Fira Code font, which does not apparently have the glyph for that symbol, it uses an emoji-style rendering, because whatever backup font Windows OS has chosen uses the emoji rendering:
    7ac95ec0-141b-4916-8dbd-7d0fab933f02-image.png

    If I switch to DejaVu Sans Mono, which does have a glyph for that font, it looks like a normal character:
    73f467c9-8ca2-4f1d-b6e3-1c26be584638-image.png

    (both those screenshots were zoomed, so that you could actually make out the character rendering)

    It’s not actually a Notepad++ specific issue: I can see similar even in my browser: ☯/☯ renders as

    3414e66a-bbd0-446e-be30-b97906eca8ea-image.png

    for me – once again, because of the font choices in the browser settings, and whether or not those fonts have a glyph for the given character.

    Windows uses what it calls the CompositeFont for doing glyph substitutions. If you change your Notepad++ Settings > Preferences > MISC > …DirectWrite… / Rendering Mode , you can influence whether or not the substitutions happen (turning it off in older versions, or to GDI (most compatible) in newer versions should stop the substitution, but might mean that all unrecognized characters show up as �.

    You can read more about CompositeFont in some of my old posts, or searching the web in your favorite engine.

    Some characters are not displayed [Unicode]” [May 2018] “Default font for Devanagiri script” [Apr 2019] “门这个字显示有问题” [Oct 2024] search here for other mentions of CompositeFont [insert link to favorite search engine’s results here]

    The web search is mostly likely to be helpful in figuring out how to edit your Windows OS settings to make use of a different backup/alternate font for a given range of characters, if you end up going down that route.

    But the best advice is to pick a font that has a glyph that you like for every unicode character you care about. (Easier said than done, I know)

  • Wanting To Make Notepad++ A C And C++ Compiler

    5
    0 Votes
    5 Posts
    700 Views
    PeterJonesP

    @Palittle-Studios,

    Not A Bad Idea But With Like Step-By-Step Tutorials, It Will Be GOOD.
    You Could Mention Libraries Too

    The FAQ is sufficient for anyone who already knows how to compile their code; once they know that, they can just put those compilation commands into the examples given. That’s as “step-by-step” as anyone who knows how to code needs. Libraries are done inside Notepad++ the same way they are when typing C/C++ code in any text editor; and passing libraries to the linker is done in Notepad++ the same way it is with any command-line compiling. All Notepad++ (and the Run menu or NppExec plugin or whatever you choose from the FAQ) are doing is helping you to “memorize” those command line calls, so that you don’t have to type them completely every time you compile.

    If you need help learning C/C++, or learning how to compile and link C/C++ from the command line, there are about a gazillion webpages that already exist that explain how to do that – a forum focused on Notepad++ text editor is not the best place to look for details on the elementary learning of coding. Once you learn and understand coding in general, and compling-and-linking from the command line, then doing that from within Notepad++, using the information in the FAQ, is a piece of cake.

  • Warning option when closing multiple, unedited files

    4
    1 Votes
    4 Posts
    597 Views
    David MackD

    @PeterJones Thanks for that information, I’ll definitely turn on that setting. As far as searching goes, I hadn’t thought of using the term “backup.”

  • Change size of tab text

    4
    1 Votes
    4 Posts
    703 Views
    C BaccaC

    @PeterJones Ok, Reduce was checked. So I’m stuck with this.

    It would be nice to control the font size and font name for the tab bar text.

    Thanks!

    Consider this closed.

  • UDL: Folding with Alt-0 no longer works correctly

    9
    1 Votes
    9 Posts
    1k Views
    PeterJonesP

    @peklei said in UDL: Folding with Alt-0 no longer works correctly:

    It would be interesting to know how this is implemented there and whether it can be recreated in a UDL definition.

    In a UDL definition? No. Each built-in lexer has dedicated code for deciding where to fold (if that lexer has folding). The source code for UDL has a separate set of code, that is purely keyword-based.
    From the “UDL definition” point of view, all you can do is set the open/middle/close keywords; you cannot change the logic from the UDL interface or config file. If you wanted to change the logic, it would require a change to the UDL source code, which requires a feature request

  • Tail with filter

    2
    0 Votes
    2 Posts
    342 Views
    PeterJonesP

    @Franz ,

    Natively, no. Notepad++ doesn’t have a “filter” feature that just hides text without deleting it.

    There might be some plugins that do a “filter”-like feature, but I don’t know which they are, and it would be doubtful if they’d work correctly with the Monitor (tail -f) feature of Notepad++. If someone else knows of a way, they can chime in.

    As a workaround: assuming you have the logfile.log open as the current file (doesn’t need to be in “tail” mode, but it can be): Run > Run…

    powershell -command "Get-Date -Format 'MM/dd/yyyy' >> '$(CURRENT_DIRECTORY)\filtered.log' ; Get-Content -Path '$(FULL_CURRENT_PATH)' -Wait | Select-String -pattern '^[AEOIU].*$' >> '$(CURRENT_DIRECTORY)\filtered.log';"

    and then File > Open filtered.log, and set Monitor (tail -f).

    This example filters your original logfile.log for any line in that starts with a vowel, and pipes it into filtered.log in the same directory; when you then open filtered.log in tail-mode, only the text that matches the filter will make it into filtered.log , which you are watching as it goes, so it gives you the basic effect, even though Notpead++ doesn’t do it natively.

    If you want something other than “starts with a vowel”, change the '^[AEOIU].*$' from the command I gave to a valid powershell regular expression (make sure to keep it wrapped in single quotes, like the example regex was). (In this forum, we’re good at Notepad++ regular expressions; but powershell regex are not our area of expertise, so, if you need help with the powershell regex aspect, this forum probably isn’t the best place to ask)

  • New Update Removed My Toolbar Icons. How Do I Get them Back?

    22
    0 Votes
    22 Posts
    3k Views
    Troglo37T

    @PeterJones Great catch! Thanks Peter!! It works! I didn’t notice the double .XML.

    Just noticed your comment about the extensions. I keep it like that because I frequently use the search software Everything and several file conversion programs. I need to know what I’m dealing with while using them simultaneously.

    The other reason I keep it hidden is so I don’t accidentally screw up the extension and can’t find the file. It’s happened to me several times. The only way that can happen is when I use Everything, However, it nicely only highlights the file name and not the extension, making it harder to unintentionally change the extension.

  • doLocalConf.xml still necessary to make NP++ portable?

    3
    0 Votes
    3 Posts
    397 Views
    mkupperM

    @Claudia-Svenson, I am wondering, What are you trying to achieve?

    The reason I ask is that it’s possible to run a “portable” copy of Notepad++ without a doLocalConf.xml file.

    You may want to review https://npp-user-manual.org/docs/config-files/#configuration-files-location.

  • Use mouse browser back/forward button to rotate vertical tabs

    5
    0 Votes
    5 Posts
    819 Views
    Ariel DiamondA

    If anyone else is interested in an AHK script that works, it’s simple enough:

    #HotIf WinActive("Notepad++") XButton1::XButton2 XButton2::XButton1 #HotIf
  • Orange highlighting of everything I copy and paste into a document

    2
    0 Votes
    2 Posts
    267 Views
    PeterJonesP

    @Martin-Neosel ,

    Do you mean the orange bar on the left margin, as shown in this screenshot?
    90102f0a-b5ce-44ca-9472-e03bf0a8d861-image.png

    That’s the Change History. We have a FAQ that explains that feature, and how to turn it off (but also explains why it’s a good idea to leave it on, now that you know what it is).

  • Remove "duplicate" lines based on only a specific part of the line

    4
    0 Votes
    4 Posts
    600 Views
    Terry RT

    @inkognito said in Remove "duplicate" lines based on only a specific part of the line:

    How can I apply it to the text file without opening it in Notepad++?
    Are there any corresponding options over the command line?

    Two very leading but somewhat loosely defined questions.

    Find in Files allows you to select a number of files based on filters, such as folders (and hidden & sub-folders), file type, partial filename. So the files are edited by Notepad++ (NPP) but don’t show in the NPP view(s). You could say they aren’t opened by NPP if you mean “do I see them in the NPP view”.

    I am aware that there is the ability to have an “auto start” functionality upon loading NPP. The information is in the FAQ section here. So it uses the PythonScript plugin along with an “auto-start” script file called “startup.py”. Upon NPP loading it immediately starts processing the commands in this script file.

    There is another PlugIn called NppExec and a post late last year suggested it might have a method on autostarting once NPP is loaded, see post #26006. Unfortunately there isn’t a lot else I have seen on NppExec, it doesn’t tend to get much exposure.

    If you are referring to editing these files without NPP itself loading, then that is a whole other question which resides outside of this forum. Other command line editors such as AWK, SED, GREP etc might offer you that functionality but as I say that is not for this forum to answer. You would need to visit forums based on which ever editor you wish to use. The regular expression I provided might work as is in another editor, but likely would require some massaging to perform correctly.

    Terry

  • Escaping delimiters does not work with UDL.

    2
    0 Votes
    2 Posts
    336 Views
    PeterJonesP

    @Manish-Patel,

    Based on your description, I assume you are seeing something akin to
    e28deaed-860a-4b30-9409-669bbcf0badd-image.png
    … where the regex starts looking like a quote starts inside.

    In that example, I also showed examples of how the escape is actually intentended to work: the “Escape” character escapes the various open/close symbols _when embedded between open/close symbols. So "In \" quotes", it properly treats the \" as being inside the string, not ending the string, and similarly for the single-quote example.

    Since, based on your <Keywords...> line, you don’t have regex defined as delimiters, the parser is not in a mode where it knows it needs to escape them.

    If you define regex wrappers as delimiters as well, like:
    c4459c06-30a2-4102-b735-97449b2d96f2-image.png

    … then you can get it to treat the regex as a string:
    9c3810c4-bef3-4bb0-b24e-9443e312a000-image.png

    The reason the quote isn’t starting a string inside the regex is because, by default, UDL doesn’t allow nesting of delimiters, unless you tell it to in the Stylers. This is more obvious if I do the same regex, but with the quotes not escaped:
    186dddd5-94e5-4595-a12f-d3b85b0f2d2b-image.png

    The quotes are still not treated as string-starters, because the regex delimiters were not defined to allow nesting of the string delimiters.

    On the other hand, if you define Delimiter 5 to be [ and \ and ] and then in the Styler definition you also allow nesting of Delimiters 1 and 2:
    f6821207-5207-450b-98b9-5168b42c7068-image.png

    … then you can get another example, which shows quotes embedded in brackets, and escaped brackets:
    347cbe63-ed9c-482b-8cbd-97498d8cc7f3-image.png

    If you escape the quotes when inside brackets, they will not be recognized as embedded quotes anymore:
    8ec9e14d-4e2d-48fe-848b-4b5bf5931cd6-image.png

    So I believe these are the kinds of setups you will want. Defining the regex wrappers as delimiters as well should go a long way to giving you what you want, I think.

  • Re-Assign hotkey: Conflict found --> auto-delete previous assigment?

    6
    0 Votes
    6 Posts
    715 Views
    mathlete2M

    @PeterJones said in Re-Assign hotkey: Conflict found --> auto-delete previous assigment?:

    Once you know for sure which one you want to not use that shortcut, you just have to click on it and choose Clear

    Unless it’s a Scintilla command; as discussed in this thread, those are much more cumbersome to clear.

  • PythonScript detect saved/unsaved file state at startup

    8
    0 Votes
    8 Posts
    1k Views
    Alan KilbornA

    After long delay, I made an official Notepad++ issue out of this:

    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/16514

    In the issue, I switched to using NppExec to reproduce, rather than PythonScript, lest it be interpreted as a PS bug and not a N++ bug.

  • How to disable FindHistory and FileEditViewHistory? auto-clear at exit?

    15
    0 Votes
    15 Posts
    2k Views
    Alan KilbornA

    @MarkusBodensee said:

    Highlight the entry in the dropdown and press Del to delete.

    To extend this idea, drop down the combobox, then press and hold Del (aka Delete) to remove all entries (ask the key repeats).

  • Fullscreen - X icon to close isn't enought on top right corner

    2
    0 Votes
    2 Posts
    274 Views
    Alan KilbornA

    @Andrea-Astolfi-0

    Didn’t you already say this, HERE ?

    This is a long-known issue; I could be wrong but I believe the reason it hasn’t been fixed is that it is related to other problems Notepad++ has with “high dpi” screens…

    If you’d like, you can find the issue in the official Notepad++ issue list, start HERE, and add a comment (to the existing issue) in the form of an “I noticed this too and would like it fixed”.

  • posting code (by copy & paste) with line numbers

    18
    0 Votes
    18 Posts
    3k Views
    Lycan ThropeL

    @PeterJones said in posting code (by copy & paste) with line numbers:

    @Lycan-Thrope ,

    If it’s automatically picking the D language, have you looked at Settings > Preferences > New Document > Default Language – does it say D instead of None (Normal Text)? If so, change that preference back, and it will go back to defaulting to normal text. (That setting cannot be affected by UDL, so I don’t see how your dBASE UDLs could be doing anything to influence it…)

    @PeterJones ,
    Thanks, this was the cause.
    Now that I think back, I think I was doing a help in the forum and used that to show the language setting and take screenshots…and forgot to put it back. DOH!!
    Back to normal…thanks for curing my forgetfulness. :-)

  • 0 Votes
    7 Posts
    967 Views
    dr ramaanandD

    @guy038 Thank you very much. @PeterJones I don’t come here to “fight” with anyone - I linked to the explanation of the SKIP/FAIL method by @guy038 just to help future readers to understand it. I am sorry if I have hurt you but that was not my intention. I request others to comment if any of my posts seem offensive and why they seem so (if they deem it so) - I will correct myself.

  • Bold font style change on Linux Mint

    12
    0 Votes
    12 Posts
    1k Views
    PeterJonesP

    @kapenike said in Bold font style change on Linux Mint:

    @PeterJones yes I agree, I believe the OP is ------. Keep it to reddit

    Either I have misunderstood what you were implying by that term, or I think you seriously misunderstood me somewhere along the way. I was never intending to insult or otherwise denegrate you – and I would never use the term that I think you were trying to obfuscate to refer to anyone.

    As @mathlete2 said, maybe you just forgot that you had different settings on the two; or, as all I was trying to say, you maybe didn’t notice that it was a plain text file on one machine and a syntax-highlighted file on another.

    Or maybe that wasn’t the cause at all: given the symptoms you described, and the resolution that you said works, I cannot, right now, think of anything else that would have matched your description on both sides of the equation, which is why I currently believe that; but if you have evidence to the contrary, then great. If you wanted to help figure out why things were behaving differently on Windows and Wine for you, then provide some more evidence, and we can try to help you figure it out; or if you’ve got a solution that works for you, and you don’t care about the cause, that’s fine – but I was honestly not in any way trying to insult or attack you.