• Backup Files for New, Unsaved Tabs Are Deleted When Tab Is Closed — Bug?

    3
    0 評價
    3 貼文
    138 瀏覽
    Terry RT

    @Tall-Navy-Guy said in Backup Files for New, Unsaved Tabs Are Deleted When Tab Is Closed — Bug?:

    Actual Result
    The backup created for the unsaved tab is immediately deleted when the tab is closed — there is no way to recover the text.

    Why This Matters
    Users (myself included) rely on the periodic-backup feature as a safety net for unsaved work. Accidentally closing an unsaved tab—or closing all tabs—should not silently discard those backups; other editors retain them until the user explicitly deletes the file or disables backups.

    You really need to understand what the backup is designed to do. There is a FAQ section and in there is this post which explains in detail what it does.

    You say you rely on this process “as a safety net” yet what you really seem to say is that this will be the “one and only” copy of the data you create. I am actually concerned to learn that you are relying on some process which clearly you misunderstand for saving what seems to be critical data.

    I believe you should get a message when closing the new 1 tab (not the whole application) asking if you want to keep it (see image in @Lycan-Thrope post), so in reality the application does NOT silently discard the backup, it asks you, it seems you confirm you don’t want the data since you are asking this question. The only “silent” process will be if you close Notepad++ without first closing any tabs. When you start Notepad++ later, all tabs should remain with their content intact.

    For your idea to work you would continue to rack up endless “backup” files, all with the same starting name new 1... and have very little idea which file contains which data you want.

    If you were to search this forum you will find it littered with unhappy users who like you misunderstood the process, relied on it for their only copy, only to find that inevitably the process eventually failed them, often due to external factors outside of Notepad++'s control.

    Please read the FAQ post and I strongly suggest changing the way you use Notepad++.

    Terry

  • subnets, search/find and regular expression, txt2xml

    2
    0 評價
    2 貼文
    133 瀏覽
    PeterJonesP

    @vasstr said in subnets, search/find and regular expression, txt2xml:

    search/find and regular expression?

    Yep.

    FIND WHAT = ^(\d+\.\d+\.\d+\.\d+)/(\d+\.\d+\.\d+\.\d+)
    REPLACE WITH = <IPHost transactionid="">\r\n <Name>n$1</Name>\r\n <Description>subnet</Description>\r\n <IPFamily>IPv4</IPFamily>\r\n <HostType>Network</HostType>\r\n <IPAddress>$1</IPAddress>\r\n <Subnet>$2</Subnet>\r\n</IPHost>
    SEARCH MODE = Regular Expression
    REPLACE ALL

    Notes:

    ^ makes sure the match must start at the beginning of a line each \d+\.\d+\.\d+\.\d+ match four dot-separated integers The parens around those put them in two groups The $1 and $2 in the replacement refer to the values of group1 and group2, respectively the \r\n in the replacement are the standard windows CRLF end-of-line sequence, so that your replacement can go over multiple lines.

    ----

    Useful References Please Read Before Posting Template for Search/Replace Questions Formatting Forum Posts Notepad++ Online User Manual: Searching/Regex FAQ: Where to find other regular expressions (regex) documentation
  • Regexp multiline text replace when care about line delimiters

    4
    0 評價
    4 貼文
    246 瀏覽
    I HayI

    @guy038 @Coises

    Thank you both of you, you’ve both given me more to learn which is great. I had wondered after posting about getting rid of the newlines and replacing them with an unused character (though I might have hit some line limits with that somewhere), but I’m pleased to find it can be done without that. I didn’t know about the reverse lines option and would never have thought of using it for regexp purposes - good to know! - if the world is too hard as it is, turn it upside down lol.
    Thanks again both of you :-)

  • 0 評價
    5 貼文
    212 瀏覽
    PeterJonesP

    @Coises said in I go to Style Configurator set a new font size Using Global Styles, save and nothing happens:

    if someone set a value in Global Override before it was moved … They’re still changing the first entry in the list.

    If they did, and it moved for them, they would have had to delete stylers.xml and let a new one be generated in the new order (or manually re-ordered), because stylers.xml doesn’t get overwritten to the new order when you upgrade from a version before the re-order to a version after the re-order. (Hence, my Config Updater plugin, to apply those kinds of fixes.)

    So, except in the unlikely event that they deleted their stylers.xml and let it be re-generated, then all that remains is that either it was in the old order and probably still is in the old order (but their understanding has improved, and they are now correctly looking at the Default Style), or it was in the new order and had all the modern warnings in the GUI and they still checkmarked the override. I find the still-in-old-order the most likely scenario, but that’s just my estimate. (Thus, I disagree with your conclusion that “They’re still changing the first entry in the list”, as it seems unlikely to me that they deleted/regenerated stylers.xml, because that doesn’t seem a natural behavior of any normal user, to me.)

    My point in linking to the manual is that it’s all explained in there, and explains how to fix the stylers.xml to move Global Override to the end, even if it’s not at the end, so that you never accidentally use the Global Override.

  • Installation Bug?

    5
    1 評價
    5 貼文
    320 瀏覽
    mpheathM

    @xomx

    Thanks for the confirmation. Issue has been posted at Github #16896 .

  • Notepad ++ Plugin Geneator

    3
    0 評價
    3 貼文
    129 瀏覽
    Mark OlsonM

    @ISSUE-BADGE

    If your plugin concept is very simple, you might find it easier to write a PythonScript script rather than writing a full-blown plugin.

    If you need to write a full plugin and you’re used to working with garbage-collected languages like Python/Java/JavaScript, I’d recommend starting with NppCSharpPluginPack, which is a C# plugin template that I actively maintain.

  • Drag-and-drop not working in editor

    3
    0 評價
    3 貼文
    116 瀏覽
    CoisesC

    @DanielTheGreatAu said in Drag-and-drop not working in editor:

    a hidden setting somewhere that reverts Notepad++ to ‘normal’ Windows behaviour

    Settings | Preferences… | Editing 2 | Multi-Editing: uncheck Enable Multi-Editing to restore normal Ctrl+drag behavior.

    Shift key down, then drag on a selection, as far as I know, has never moved the selection in Notepad++ — it just changes the selection. You don’t need the Shift key to move a selection.

  • UDL highlight words between 2 keyword

    2
    0 評價
    2 貼文
    112 瀏覽
    PeterJonesP

    @taigama_coder said in UDL highlight words between 2 keyword:

    How can I use UDL to fromat it?

    That is beyond the capability of UDL: it’s designed for simple keyword and operator highlighting, and what you are asking would require a custom lexer…

    Normally, I would suggest the EnhanceAnyLexer plugin, which allows adding foreground coloring based on regular expressions… but since you are asking to highlight the whitespace, and whitespace by definition is not using the foreground color, I don’t think it’s features would help you.

  • easy way to move a file tab in the open file list

    2
    0 評價
    2 貼文
    84 瀏覽
    mathlete2M

    @Arne-Everhard it sounds like you’re referring to the functionality of the Move Tab Forward and Move Tab Backward options in the View > Tab menu. If so, both have default shortcuts, but they can be modified in the Main Menu tab of the shortcut mapper.

    Note: I actually had a difficult time finding those particular options in my own window at first; you may need to filter by “tab” to see these particular options right away.

  • Toolbar icons with 2560x1440 display

    9
    0 評價
    9 貼文
    2k 瀏覽
    PeterJonesP

    After this conversation, I worked briefly on a workaround. I took the 16x16 standard-icon BMP files from the N++ source code, converted them to ICO format, then on all the files, I used an image program to upscale from 16x16 to 32x32, and make .ico files that have both 16x16 and 32x32 resolution files. The 32x32 are admittedly ugly (because they are just enlarged versions of the 16x16), but it’s at least a starting place, and will give the ability to have icons that are based on the standard icon set, but being able to use them in large-icon mode.

    Assuming a standard installation of Notepad++ (using %AppData% config directory), to use these dual-resolution ICO files:

    Go to %AppData%\Notepad++\ in Windows Explorer Create a directory toolbarIcons and a subdirectory toolbarIcons\StandardDualResolution Download the .ico files in https://github.com/pryrt/nppStuff/tree/main/StandardIconUpscaling/GIMP DualResolution 32x32 16x16 and unzip into toolbarIcons\StandardDualResolution\ update: added zipfile for easy download Rename toolbarButtonsConf_example.xml to toolbarButtonsConf.xml Edit that file, and near the end, change the line from <ToolBarIcons icoFolderName="" /> to <ToolBarIcons icoFolderName="StandardDualResolution" /> Save the toolbarButtonsConf.xml exit Notepad++

    The next time you run Notepad++, it should be using the custom versions of the standard icons. If you select Settings > Preferences > Toolbar and choose one of the “large” choices, it should use the custom icons in large (32x32).

    5ef248da-6716-4e80-a474-4147eb20d515-image.png

    This is obviously not ideal. But since there hasn’t been any official or publically-available 32x32 “originals” of those icons in 14+ years, that I can find, it’s the best thing I can think of for now. Someone with more image editing skill – or more AI skill – might be able to generate better 32x32 versions from the original 16x16 BMP files in the source code and create better-looking versions as ICO files. But until such happens, this might be a usable workaround.

  • Notetab++ novice questions

    3
    0 評價
    3 貼文
    401 瀏覽
    PeterJonesP

    A few months ago, I said,

    I don’t know of anyone who has done that and made them public.

    After this conversation, I worked briefly on a workaround. I took the 16x16 standard-icon BMP files from the N++ source code, converted them to ICO format, then on all the files, I used an image program to upscale from 16x16 to 32x32, and make .ico files that have both 16x16 and 32x32 resolution files. The 32x32 are admittedly ugly (because they are just enlarged versions of the 16x16), but it’s at least a starting place, and will give the ability to have icons that are based on the standard icon set, but being able to use them in large-icon mode.

    Assuming a standard installation of Notepad++ (using %AppData% config directory), to use these dual-resolution ICO files:

    Go to %AppData%\Notepad++\ in Windows Explorer Create a directory toolbarIcons and a subdirectory toolbarIcons\StandardDualResolution Download the .ico files in https://github.com/pryrt/nppStuff/tree/main/StandardIconUpscaling/GIMP DualResolution 32x32 16x16 and unzip into toolbarIcons\StandardDualResolution\ update: added zipfile for easy download Rename toolbarButtonsConf_example.xml to toolbarButtonsConf.xml Edit that file, and near the end, change the line from <ToolBarIcons icoFolderName="" /> to <ToolBarIcons icoFolderName="StandardDualResolution" /> Save the toolbarButtonsConf.xml exit Notepad++

    The next time you run Notepad++, it should be using the custom versions of the standard icons. If you select Settings > Preferences > Toolbar and choose one of the “large” choices, it should use the custom icons in large (32x32).

    5ef248da-6716-4e80-a474-4147eb20d515-image.png

    This is obviously not ideal. But since there hasn’t been any official or publically-available 32x32 “originals” of those icons in 14+ years, that I can find, it’s the best thing I can think of for now. Someone with more image editing skill – or more AI skill – might be able to generate better 32x32 versions from the original 16x16 BMP files in the source code and create better-looking versions as ICO files. But until such happens, this might be a usable workaround.

  • I want to display only lines beginning by something of my text file, is it possible ?

    2
    0 評價
    2 貼文
    129 瀏覽
    Mark OlsonM

    @PATRICK-MULOT

    This is probably a job for regular expressions, but it depends to some extent on the specifics of your task.

    If you have a text file where every line is a word that you need to search for, you need to do a scripting solution. This kind of question has been asked many times before on the forum and I’m too lazy to look up which posts it was answered in, but a PythonScript script that would accomplish this would probably be as follows:

    Open the file with the words you’re searching for (hereafter WORD_FILE) Open the PythonScript console Paste in the command words = [x + ' ' for x in editor.getText().splitlines()] then hit Enter. Open the file that you want to search in (hereafter TARGET_FILE) Paste in the command lines = [line for line in editor.getText().splitlines() if any(line.startswith(word) for word in words)] then hit Enter Open a new file. Paste in the command editor.setText('\r\n'.join(lines)) and hit Enter Your new file will contain only the lines in TARGET_FILE that started with one of the words in WORD_FILE followed by a literal space character

    If you want to find lines that start with "fam " or "blah " (as in “fam” or “blah” followed by a literal space character), you can do that by:

    Use Search->Find... from the Notepad++ main menu (Ctrl+F with default keybindings) to open the Find form. Set Search Mode to Regular expression. Set Find what: to (?-i)^(?:fam|blah)\x20.* This regular expression has these basic parts: (?-i), ^, (?:fam|blah), \x20, and .* The (?-i) says that this is a case-sensitive search (so it would exclude lines starting with FAM for example) The ^ means that we only search at the start of a line The (?:fam|blah) matches fam or blah The \x20 is a different representation of a normal space character, which I sometimes use in regular expressions to make it more readable The .* matches the rest of the line (. is any non-newline character and * means match 0 or more of the preceding pattern) Hit the Find All in Current Document button. A form will pop up at the bottom of the Notepad++ window showing all the lines that matched.
  • Regex to get lines starting with digits, and all between round bracket on any line

    5
    0 評價
    5 貼文
    209 瀏覽
    Robert Or Janet DiebelR

    @guy038 Thanx much for your help

  • Search/Find Dialog

    5
    0 評價
    5 貼文
    262 瀏覽
    Gerhard MunroG

    @guy038 @PeterJones

    I have checked the Registry Entries as requested:

    If your system doesn’t have MS Shell Dlg (or 2) installed, or even if it does, you might also want to look in your registry at HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes and see if MS Shell Dlg (or … 2) has an entry (for mine, those two have entries set to MS Sans Serif and Tahoma, respectively). If there is a FontSubstitutes entry set up on your computer, then you need to check that the resulting font exists in your c:\windows\fonts\ or equivalent directory. If not, then I have no idea what font that Windows OS will choose for that text.

    Regex.png

    Then checked the fonts:

    Screenshot 2025-07-27 165307.png

    I highlighted the 2 fonts, MS Sans Serif is named MS Sans Serif Regular but I think this is ok.

    I then checked my wife’s laptop, HP Firefly with Win 11 24H2 and Notepad++ is perfect. I gather it must be a graphics setting on my machine as I am having endless driver issues. I also read up a lot on this topic and it seems like it has something to do with scaling (not 100% sure here).

    Anyway, I apologize for this thread as I think this is an isolated incident on this specific laptop.

    The resolution is 3840 x 2400
    Scale : 250% (Recommended)

  • How to remove empty strings by notepad++?

    4
    0 評價
    4 貼文
    166 瀏覽
    mathlete2M

    @Раке if you still prefer using a Regex-based Search and Replace, you can add a Start of Line anchor (and perhaps the whitespace character class with a quantifier) to get similar results. For example, a search of ^\s*\r\n will remove all “empty” lines, including ones with various types of whitespace.

    Sample start text:

    c8db255e-b5b8-4d9d-b85c-db4da28525d5-image.png

    After running the S/R with the above Regex:

    a6fef303-5305-4289-9f25-8f4ebfd36ff9-image.png

  • [regex] Why unexpected hit?

    3
    0 評價
    3 貼文
    160 瀏覽
    S

    @PeterJones Thank you.

  • How to replace any text between some text without specifics

    3
    0 評價
    3 貼文
    168 瀏覽
    th3lifeoftorchT

    @PeterJones Very much appreciate this, you saved me a lot of time

  • NPP v8.8.3 64 bit, turning on dark mode in settings closes/crashes npp window

    5
    0 評價
    5 貼文
    156 瀏覽
    Paul LeoP

    @Paul-Leo Thanks, and sorry about missing the FAQ re: npp crashes after update/upgrade!

  • Macros to find foward the next character

    7
    0 評價
    7 貼文
    350 瀏覽
    PeterJonesP

    @Ivan-Garnizov said in Macros to find foward the next character:

    the question refers to your source of information,
    Where do you find and most importantly interpret these codes?

    My source of information is the User Manual and the Notepad++ source code, both of which are publically available.

    User Manual: Generic info on macros = https://npp-user-manual.org/docs/macros/ User Manual: Details on the macro syntax in the shortcuts.xml file = https://npp-user-manual.org/docs/config-files/#macros Source Code: Values for the message="###" on the type="0" and type="1" commands = https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/include/Scintilla.h Each of those command names (with their numbers) listed in Scintila.h is documented by the Scintilla project = https://scintilla.org/ScintillaDoc.html Source Code: Values for the wParam="###" on the type="2" commands = https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/menuCmdID.h The menuCmdID.h was not intended primarily for human-readability, so here is an example cheat sheet for how to read it: If we wanted to look up the Search > Select and Find Next, and already knew it was IDM_SEARCH_SETANDFINDNEXT:#define IDM_SEARCH_SETANDFINDNEXT (IDM_SEARCH + 48) That says that IDM_SEARCH_SETANDFINDNEXT is defined as the value of IDM_SEARCH + 48. So then you look for IDM_SEARCH:#define IDM_SEARCH (IDM + 3000) So that means that IDM_SEARCH_SETANDFINDNEXT is IDM + 3000 + 48 = IDM + 3048. Looking for the definition of IDM:#define IDM 40000 So that means that IDM_SEARCH_SETANDFINDNEXT is 40000 + 3000 + 48 = 43048 But that required knowing beforehand what the internal IDM_XYZ name for the menu-command was that you wanted was. There are two good ways for finding that: In the menuCmdID.h, it is mostly organized by Notepad++ menu, so it’s not that hard to say “I want the Find (Volatile) Next command from the Search menu”, and then to look in menuCmdID.h for the Search menu entries – they start here at IDM_SEARCH, which isn’t that hard to find (for example, look in the file for SEARCH, which is the name of the menu). Once in the right section, the IDM_<section>_<command_name> is reasonably easy to map to the entries in the default English menu system in Notepad++. But that’s still a bit of effort. I make use of the NppUISpy plugin (installed from Plugins Admin), which allows you to look up what the command ID (and thus wParam="###" value) is for every built-in and currently-installed plugin command is. Once you know the ID, you can use it directly. But you can also look up the IDM_xyz name by looking for the last digit or two, and finding the ones that end in that last digit until the name makes sense for the given menu command. This Forum’s FAQs: Automating Notepad++ = https://community.notepad-plus-plus.org/topic/25400/faq-automating-notepad This has a lot about macros, and how to dig in to find even the right menu command IDs for plugin commands (plugin commands are not recordable, but the FAQ explains how to hack the recorded macro to run plugin commands with certain limitation)

    @deleelee , there is no published reference of which commands aren’t recordable – there are thousands of commands, and it’s hard to piece together the information(*). The general rule is “any command that requires user input (launches a dialog, renames a file, etc) cannot be recorded or played back; any other built-in command that can be accessed through a menu can at least be played back by a macro, though an arbitrary list of them cannot be recorded even though they can be played back; almost any normal ‘editing’ command, like copy/paste/select etc, which are handled by the scintilla component, should be recordable”. As the Automating Notepad++ FAQ explains, there is no list of which commands are specifically recordable vs not. Essentially, my recommendation is to try to record a macro, and then see if there are any commands (like the Search > Select and Find Next) that don’t end up with a corresponding entry in the macro; those are usually the commands that aren’t macro-recordable. ;-)

    (*: when I was writing up the FAQ, I tried to create a list of not-recordable-but-playable based on the source code, but I gave up after a few hours of spinning my wheels on that. It’s not a simple task.)

  • notepad ++ adjust indentation

    8
    0 評價
    8 貼文
    10k 瀏覽
    T

    @PeterJones I just registered an account to say thank you for mentioning what specific version changed the location of this setting. I came to this thread wondering where to change tabs to spaces. I knew there was a setting somewhere, I just couldn’t remember where, and apparently I must have missed that autoupdate for whatever reason (I don’t remember disabling auto updates but nonetheless I was outdated by a few minor versions), so knowing the setting got moved between versions, and particularly what version, was helpful.