• FAQ: Feature Request or Bug Report

    Pinned Locked
    1
    10 Votes
    1 Posts
    18k Views
    No one has replied
  • FAQ: Formatting Forum Posts

    Pinned
    1
    4 Votes
    1 Posts
    16k Views
    No one has replied
  • FAQ: Template for Search/Replace Questions

    Pinned
    1
    4 Votes
    1 Posts
    5k Views
    No one has replied
  • FAQ: Logging in to this Forum

    Pinned
    1
    4 Votes
    1 Posts
    2k Views
    No one has replied
  • FAQ: Why Can't I Just Say "Most Recent Version"

    1
    5 Votes
    1 Posts
    2k Views
    No one has replied
  • FAQ: How do I create a Poll in the Forum?

    Moved
    3
    1 Votes
    3 Posts
    385 Views
    PeterJonesP

    @Mark-Olson ,

    Moved.

  • 1 Votes
    7 Posts
    9k Views
    notdodgeballN

    Here the table for the Brazilian Portuguese layout (ABNT2) based on dinkumoil’s work:

    | | Pt/br Keyboard | | Npp shortcut mapper |---------+------------|--------------|--------------- | | | solo | with SHIFT | Virtual Key | KeyboardEvent | |---------------------+---------+------------|--------------|----------------| | ~ | ' | " | VK_OEM_3 | Backquote | | [ | ´ (DK) | ` (DK) | VK_OEM_4 | BracketLeft | | ] | [ | { | VK_OEM_6 | BracketRight | | ; | ç | Ç | VK_OEM_1 | Semicolon | | ' | ~ (DK) | ^ (DK) | VK_OEM_7 | Quote | | \ | ] | } | VK_OEM_5 | Backslash | | / | ; | : | VK_OEM_2 | Slash | | <> | \ | | | VK_OEM_102 | IntlBackslash | | Num . | Num , | DEL | VK_DELETE | NumpadDecimal | * | | Num . | | VK_ABNT_C2 | NumpadComma | | | / | ? | VK_ABNT_C1 | IntlRo | * Shortcuts using the Shift key don't work with the Numpad, are they being overridden by the driver?

    As a result, by using this layout one cannot bind commands to the / and Num . keys

    ----
    moderator duplicated this original post and assigned this new node to the original author, too; added link to ABNT2 keyboard

  • FAQ: Automating Notepad++

    1
    6 Votes
    1 Posts
    3k Views
    No one has replied
  • FAQ: Parsing and Editing JSON with regex is a bad idea

    2
    3 Votes
    2 Posts
    3k Views
    PeterJonesP
    Corollary: Parsing and Editing XML or HTML with regex is also a bad idea

    For essentially the same reasons.

    More on the horrors of HTML and regex can be found in this Stack Overflow answer.

    For working with XML and similar markups in Notepad++, the plugin XMLTools is an excellent choice as the first line of attack, and using one of the scripting plugins (like PythonScript, LuaScript, or jN) and the XML libraries that are appropriate to that programming language will allow you to tackle the more complicated problems.

  • FAQ: Can I Do a Mathematical Replacement?

    4
    4 Votes
    4 Posts
    4k Views
    PeterJonesP
    MultiReplace Plugin

    The MultiReplace Plugin is another plugin that will allow replacements to use mathematical forumula.

    Starting in Notepad++ v8.5.8, you can install the plugin through Plugins Admin. For older versions of Notepad++, you may be able to install it manually.

    As explained in this post, this is in a nutshell how MultiReplace is working for Math.

    Activating ‘Use Variables’:

    This option facilitates math functions and dynamic string substitutions within a Replace String. It can work with all search settings combined and is not exclusively dependent on regex.

    Commands Overview:

    Either set or cond command is mandatory to set in ‘Replace with’ to wrap the math functions.

    set(strOrCalc) - simple push of math results to Replace cond(condition, trueVal, [falseVal]) - if-then or if-then-else condition for push of results

    Examples of Commands Usage:

    set("replaceString"..CNT) - results in “replaceString3” (assuming CNT = 3). set(LINE+5) - results in “10” (assuming LINE = 5). cond(LINE<=5 or LINE>=9, "edge", "center") - results in “edge” (assuming LINE = 5). cond(LINE<3, "Modify this line") - Keeps original text if condition is false (assuming LINE >= 3). Variables Overview:

    (will be enhanced in future by User requests):

    CNT: Count of the detected string. LINE: Line number where the string is found. APOS: Absolute character position in the document. LPOS: Relative line position. LCNT: Count of the detected string within the line. COL: Column number where the string was found (CSV-Scope option selected). MATCH: Contains the text of the detected string. Special Variables:

    CAP1, CAP2, …: Correspond to regex capture groups $1, $2. CAP variables are usable for calculations or as strings.

    Format Handling: If the CAP variable is a number it can interpret both dot and comma as decimal separators, making international usage more straightforward. Thousand separators are not supported.

    Note: $1 and $2 can be used in ReplaceString but content will only be resolved in CAP Variables for conditions and math functions

    Example of special Variables:
    Find: (\d+.\d+)
    Replace with: set(CAP1 * 1.2) - multiplies decimal number with 1.2

    Basic rules: Strings have to be quoted by ' or " Concatenation is by .. Arithmetic: +, -, *, /, ^, % Relational: ==, ~=, <, >, <=, >= Logical: and, or, not

    Example of combining:
    Find: Price: (\d+(\.\d+)?)
    Replace with: cond(CAP1~=0, "Price per unit: " ..(CAP1/10), "Price cannot be zero") - Calculates Price per Unit if not Zero.

    Further functionality:

    As the engine is LUA driven all LUA math and string functions can be used in set or either cond

    Example with advanced math Function:
    Find: Radius: (\d+)
    Replace with: set("Circumference: "..(2 * math.pi * CAP1)) - Calculates the circumference of a circle given its radius.

    Example with a string function for alignment:
    Find: ;
    Replace with: cond(LCNT == 1, string.rep(" ", 20 - (LPOS))..";") - aligns first occurrence of semicolon in Line to the 20th character position.

  • FAQ: I Cannot Find My Panel!

    1
    6 Votes
    1 Posts
    2k Views
    No one has replied
  • 4 Votes
    1 Posts
    4k Views
    No one has replied
  • FAQ: Periodic Backup vs AutoSave Plugin

    2
    3 Votes
    2 Posts
    13k Views
    PeterJonesP
    AutoSave Plugin v1.61 (For Historical Reference)

    AutoSave Plugin v1.61 has been replaced by v2.00 since September 2022. It is not listed in Plugins Admin. However, you might still be able to go to the repo and download the older version, and manually install it. Unless you desperately need the “Unnamed/new Files” features, it is highly recommended that you use v2.00 or newer, obtained from Plugins Admin.

    When you first installed the AutoSave Plugin v1.61 manually (or years ago), the default configuration is to not have AutoSave providing any automatic saving, so it is doing nothing and you are still relying on Notepad++'s periodic backup (if enabled).

    You will have to configure this plugin if it is going to do any automatic saving for you. You do this by going to the Plugins menu, selecting Auto Save, and picking Options. The following screenshot shows Auto Save v1.61’s default Options dialog:

    e7286d9d-88ed-49d2-82b5-c275180b3440-image.png

    AutoSave When

    These options control when AutoSave is triggered.

    WARNING: If both options remain unchecked, there is no AutoSave occurring and the plugin is doing nothing.

    ☐ Notepad++ loses focus: If this option is checkmarked on ☑, then every time you move from Notepad++ to another window (a Windows explorer, or your browser window, or any other application, or even change focus to the Desktop or clicking on the Windows Start Menu), AutoSave plugin will trigger a save event.

    ☐ At timed intervals every _N_ minutes: If this option is checkmarked on ☑, then every N minutes, AutoSave plugin will trigger save event, even if you have never clicked outside of Notepad++.

    If both of the options are checkmarked on ☑, then AutoSave will trigger a save event every N minutes and everytime Notepad++ loses focus. This saves the most often.

    AutoSave What

    ○ Current file only: If this option is active ⦿, only the “current” file in Notepad++ (the active tab) will have AutoSave events. If you have multiple files open, the other tabs will not be AutoSaved.

    ○ All Open Files: If this option is active ⦿, all files currently opened in Notepad++ will be protected by AutoSave.

    Only one of those two options can be active ⦿.

    Ignore files larger than N KB: If this is set to 0 KB, all files will be AutoSaved. If this is set to a non-zero numbewr, files that are larger than that threshold will not be AutoSaved.

    Named Files

    ○ Ignore/do nothing: If this option is active ⦿, nothing will happen for named files when AutoSave is triggered. This means that named files will not be protected by the AutoSave plugin in this configuration.

    ○ Overwrite existing file: If this option is active ⦿, when AutoSave is triggered, the plugin will send a “Save” command to the Notepad++ application, and the file will be written in the same location where you last manually saved the file (the same place it was when it was first named). Note: This has the side effect of telling Notepad++ that the file is properly saved, so Notepad++ will remove its periodic-backup file for this named file. This feature is basically equivalent to the Plugin hitting the SAVE button for you every time the AutoSave is triggered.

    ○ Save autorecover in the same directory: If this option is active ⦿, when AutoSave is triggered for the named file namedfile.txt, the plugin will create a file with ~ after the extension (namedfile.txt~) in the same directory as the original namedfile.txt. Note: This time, since the state of the main file in Notepad++ is still “unsaved changes”, the Notepad++ periodic-backup for namedfile.txt still exists; Notepad++ and AutoSave plugin will both treat this file as “unsaved”.

    Unnamed/new Files

    ○ Ignore/do nothing: If this option is active ⦿, nothing will happen for unnamed/new files when AutoSave is triggered. This means that unnamed/new files will not be protected by the AutoSave plugin in this configuration.

    ○ Ask for filename: If this option is active ⦿, when AutoSave is triggered, the Plugin will prompt you for a name for the file. Once you enter the filename, AutoSave will tell Notepad++ to do a SaveAs to that location, and the file will now be a named file, and treated according to the Notepad++ and AutoSave rules for named files.

    ○ Save (overwrite) silently here: If this option is active ⦿, you need to choose a directory when you enable this option; the default $CDIR$\autorecover doesn’t seem to carry any meaning; choose a real directory. When AutoSave is triggered, the plugin will create a file called new # (matching Notepad++'s naming scheme) in that folder; from then on, Notepad++ and the AutoSave plugin will treat that file as a named file. Warning: This has the side effect of resetting Notepad++ new # numbering… so be careful, because creating another new file at this point might be given a number that’s already been used but saved by AutoSave, so AutoSave will try to put two files with the same name in the directory you specify.

    ○ Save autorecover here: If this option is active ⦿, you need to choose a directory when you enable this option; the default $CDIR$\autorecover doesn’t seem to carry any meaning; choose a real directory. When AutoSave is triggered, the plugin will create a file called new # (matching Notepad++'s naming scheme) in that folder; however, it still keeps the file that’s shown in Notepad++ as a new/unsaved/unnamed file, so Notead++ and AutoSave Plugin both treat the file as “unsaved” and “unnamed”. This configuration doesn’t reset Notepad++'s new # numbering, so new files created won’t generally collide with the existing autorecover files. When you close a new # tab without saving, the AutoSave plugin’s autorecover file will still exist; however, the next time you create a new tab, if Notepad++ re-uses that number, then the new autorecover file will overwrite the old autorecover file of the same name.

  • 6 Votes
    1 Posts
    4k Views
    No one has replied
  • FAQ: Validating Config-File XML

    1
    3 Votes
    1 Posts
    9k Views
    No one has replied
  • FAQ: New Change History feature

    1
    4 Votes
    1 Posts
    25k Views
    No one has replied
  • FAQ: How do I Replicate the Features of TextFX?

    1
    3 Votes
    1 Posts
    10k Views
    No one has replied
  • 5 Votes
    1 Posts
    7k Views
    No one has replied
  • FAQ: How to install and run a script in PythonScript

    1
    6 Votes
    1 Posts
    10k Views
    No one has replied
  • FAQ: Generic Regular Expression (regex) Formulas

    1
    2 Votes
    1 Posts
    2k Views
    No one has replied