• Creating and running macros

    19
    0 Votes
    19 Posts
    16k Views
    PeterJonesP

    @Tony-Moody,

    You must not …

    That’s not strictly true. “You must be careful if you …” would be the better way of phrasing that.

    C:\Documents and Settings\<username>\Application Data\Notepad++\shortcuts.xml

    And I can now identify that you’re on an older Windows, such as Win2k or WinXP. For more on the %AppData%, see our FAQ on the topic – which includes an explanation for how the simplest way to access folders in the user-app-data hierarchy is by %AppData%\FolderName, so you don’t have to know which file hierarchy your system uses.

    What I do is record a macro and run it to check. If it needs altering I either record it again or I have a go at editing it. One can add macros together by editing.

    Yep, those are good, solid advice.

    Editing Configuration Files

    As it says in NpWiki++: Configuration Files, “Because Notepad++ updates some of its configuration files on normal program termination, manual editing of a Notepad++ configuration file requires both specific procedures and good knowledge of the files’ layout. It is strongly advised to read about how to edit configuration files and the knowledge base for file layouts.”

    The editing configuration files page claims you have to mark the files as read-only, but that’s not technically accurate, either.

    Notepad++ will overwrite the shortcuts.xml file when it exits… but only if you’ve recorded a new Macro, or if you’ve used the Settings > Shortcut Mapper or Macro > Modify Shortcut / Delete Macro…. (There may be one or two other circumstances that I haven’t thought of, but if there are, they seem to be more rare.)

    A sequence that has always worked for me, every time, for editing the shortcuts.xml from within Notepad++:

    Close all active instances of Notepad++. This will make sure Notepad++ saves any changes it needs to save into shortcuts.xml. Open one instance of Notepad++. Do nothing else regarding Notepad++, other than what’s described in these steps, while following these instructions. Do not open another instance. Do not change GUI settings, especially the Shortcut Mapper… or Modify Shortcut / Delete Macro…. Open %AppData%\Notepad++\shortcuts.xml using that one instance of Notepad++ if you’re in a portable installation, open the local shortcuts.xml instead Make your edits to shortcuts.xml using that one Notepad++, without opening any other instances. Save shortcuts.xml Close that one instance of Notepad++. When you open Notepad++ again, the changes you made should take effect if you handcrafted a new macro, or edited an existing one, it should be available in the Macro menu. You can also re-load shortcuts.xml to make sure the changes are still in place; they should be (they are for me). If shortcuts.xml is open, either Close shortcuts.xml again, so that you don’t expect it to be editable this time,
    or if you do want to safely edit shortcuts.xml more, and haven’t done anything else with Notepad++, you’re effectively back at step #3 right now, and can continue the sequence from there
  • 0 Votes
    1 Posts
    495 Views
    No one has replied
  • can't donate

    Locked
    1
    1 Votes
    1 Posts
    537 Views
    No one has replied
  • NP++ 'ignores' parenthesis in remote session while editing Python

    Locked
    6
    0 Votes
    6 Posts
    2k Views
    Chip WachobC

    Thanks to all.

    Just got Npp with NppFTP plugin working. The ‘help’ for NppFTP is a little light, but once you set up your ‘server’ in NppFTP and click on the chain link, you are good to go…

    Used vsftpd and xinetd per here

    https://linuxconfig.org/how-to-setup-and-use-ftp-server-in-ubuntu-linux

    On the Ubuntu side.

  • Automatic update of "modified:..." in .md file header

    Locked
    2
    2 Votes
    2 Posts
    816 Views
    PeterJonesP

    What you want is something that will set a callback on the FILEBEFORESAVE notification.

    You could use PythonScript – download the latest using the Plugin Manager, or directly from the github repo releases. The Plugins > Python Script > Context-Help will bring up a help window; navigate to Notepad++ Object and scroll down to notepad.callback(function, notifications) for the syntax.

    You can search this forum for “callback” to find other complete examples of how to set up a callback. (You would want to put the callback initialization in your startup.py in order to get it to be always enabled.) I believe there are also examples in the forum of applying a callback only to a particular type of file – for you, you’d presumably want it only if the file was a .md markdown file.

    I assume LuaScript would also have the notification/callback feature, too (though I could be wrong).

  • Changing NPP's GUI

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    PeterJonesP

    Embedding the image you linked:

    I believe that the blue background you are referring to on the menu bar and the icon bar are a function of your operating system. I use Windows 10 64bit OS, and mine does not have the blue tinge to the title bar, menu bar, and icon bar. If I remember correctly, Windows 7 used the faded blue backgrounds.

    The icons, themselves, however, I do see the same icon shapes… just not with the bluish background tinge:
    Imgur
    I opened both the Settings > Style Configurator to show I had temporarily selected Zenburn, and the Settings > Preferences > General to show I’ve got ☑ Standard icons selected. If I change to ☑ Small icons or ☑ Big icons, they are definitely a different image/icon: specifically,
    and

    Note that the icons don’t change when I change the theme; they just change as I go between small, big, or standard.

  • Help with regex

    Locked
    3
    0 Votes
    3 Posts
    974 Views
    C Ananda RaoC

    @PeterJones Thank you so much! It worked!

    I went through the FAQ. But the whole regex thing looked so frightening that I decided to depend upon the kindness of strangers. Not being a programmer, I felt that it would take me at least a couple of months just to get an idea about it.

  • How to add/use ISCII encoding or devanagari code page in notepad++?

    Locked
    1
    0 Votes
    1 Posts
    590 Views
    No one has replied
  • Npp crashes when NppFTP connects to the server

    Locked
    3
    0 Votes
    3 Posts
    1k Views
    Pete NorrisP

    Scratch the question.

    Both my desktop and my laptop have Notepad++. NppFTP was crashing the Notepad++ on both computers.

    I am at a remove location now with my laptop. Notepad++ and NppFTP are working fine here.

    It must be my IP connection. I am using my Android as a hotspot.

    I apologize for taking everyone’s time.

  • 2 Votes
    6 Posts
    4k Views
    guy038G

    Hello, @ttm-1895, @claudia-frank and All,

    I think that the regex can be shortened, as below :

    (?s)(?<=\[).+?(?=\])

    Notes :

    The (?s) modifier means that the dot regex character ( . ) represents any single char ( either a standard one or an EOL one )

    The (?i) modifier is not necessary, as no letters or letter range(s) are involved in the discussed regexes

    The main part of the regex is the .+? syntax, which catches the smallest NON-empty range of any character, which, either :

    is preceded by a literal [ symbol, due to the (?<=\[) positive look-behind structure

    is followed with a literal ] symbol, due to the (?=\]) positive look-ahead structure

    Both [ and ] symbols must be escaped, with the \ symbol, to be interpreted as literals

    Cheers,

    guy038

  • How to repalce newlines to other characters with Extended Search

    Locked
    3
    1 Votes
    3 Posts
    1k Views
    Claudia FrankC

    @Shima-Hisaharu

    what you have posted and what you did describe doesn’t match.

    If you want to have it added you need to replace with \n\ta

    But from what you’ve posted as result you want to insert it in front of \n
    which means you need to replace with \ta\n.

    Find is, for both, like you already did \n

    Cheers
    Claudia

  • Need help changing a number section in these text files for a game

    Locked
    6
    1 Votes
    6 Posts
    1k Views
    Terry RT

    Great answer @guy038 ! And of course for any newbies on this forum the definition of a regex is most likely the search string used only when under the ‘extended’ or ‘regular expression’ modes of search , find and replace, using the ‘metacharacter’ options made available. Because that’s where your ‘literal’ example turns into a ‘regex’.

    When using the ‘normal’ mode or looking at a very simple string search as in this instance I probably should refrain from using the ‘regex’ word.

    Thanks for the clarification.

    Terry

  • Find in all files not working for me?

    Locked
    5
    0 Votes
    5 Posts
    1k Views
    PeterJonesP

    Thanks for the vote of confidence. I’ve added it.

  • Help with regular expression.

    Locked
    9
    1 Votes
    9 Posts
    2k Views
    Claudia FrankC

    That’s the wonderful world of regex - multiple solutions for one problem :-)

    Cheers
    Claudia

  • Viewing infected PHP file I don't see the dangerous code

    Locked
    3
    0 Votes
    3 Posts
    916 Views
    Robert H. MorrisonR

    Problem resolved, I need to activate View - Show Symbol - Show Whitespace and TAB.
    THEN we can see the … and no there is something at the end of the line,
    or, alternatively I could turn on Word Wrap!

  • How to Recover Unsaved and deleted Notepad++ files?

    Locked
    2
    0 Votes
    2 Posts
    9k Views
    PeterJonesP

    Open-but-unsaved files live in %AppData%\Notepad++\Backup (assuming you have the Settings > Preferences > Backup > Enable session snapshot and periodic backup enabled – which I believe you do, since you seem to have the expectation that unsaved files are somehow “safe”).

    Assuming your recovery wizard (or however their trademark spells it) recovered your %AppData% (or if your %AppData% is on C: instead of D:, and thus isn’t deleted), then it could be that your unsaved files are available in %AppData%\Notepad++\Backup.

    Otherwise, if recovery software hasn’t helped, there’s not much more to be done. This might be a good lesson to you that with any application that edits files (not just Notepad++), even if it has auto-save of some sort, you need to take ownership for the task of preserving data; the more important your data is, the more important it is that you play an active role in saving and backing up that data.

  • How to make style configurator work on CSS inside html

    Locked
    2
    0 Votes
    2 Posts
    805 Views
    Claudia FrankC

    @abdulbadii

    there is no npp builtin way to use two different lexers in one document but a possible
    workaround might be using some technique like discussed here. As I don’t have any experience in css I’m not sure if this can be done easily.

    Cheers
    Claudia

  • Filter lines

    5
    0 Votes
    5 Posts
    2k Views
    guy038G

    Hi, @terry-r and All,

    In your last post, Terry, the (?|\R|\z) regex syntax is, for instance, a branch reset group structure. However, as it is said here :

    If you don’t use any alternation or capturing groups inside the branch reset group, then its special function doesn’t come into play. It then acts as a non-capturing group.

    So, I don’t think that, in that specific case, the branch reset group syntax was necessary ;-))

    And for everybody, to, clearly, show the difference between a capturing list of alternatives and a branch reset group, let’s consider the two following regexes, which matches, either, one of the 5-chars strings : axyzw, apqrw or atuvw

    A) with a list of consecutive alternatives, in a capturing group :

    (a)(x(y)z|(p(q)r)|(t)u(v))(w)

    When the regex matches axyzw, group 1 = a, group 2 = x(y)z, group 3 = y and group 8 = w

    When the regex matches apqrw, group 1 = a, group 2 = (p(q)r), group 4 = p(q)r, group 5 = q and group 8 = w

    When the regex matches atuvw, group 1 = a, group 2 = (t)u(v), group 6 = t, group 7 = v and group 8 = w

    B) with a branch reset group ( NOT a capturing group itself ! ) :

    (a)(?|x(y)z|(p(q)r)|(t)u(v))(w)

    When the regex matches axyzw, group 1 = a, group 2 = y, group 3 is undefined and group 4 = w

    When the regex matches apqrw, group 1 = a, group 2 = p(q)r, group 3 = q and group 4 = w

    When the regex matches atuvw, group 1 = a, group 2 = t, group 3 = v and group 4 = w

    An other example. Given that text :

    abcdefg hijklmn opqrstu

    The regex S/R :

    SEARCH (abcdefg)|(hijklmn)|(opqrstu)

    REPLACE ==\1\2\3== OR, also, ==$0==

    would change the text as :

    ==abcdefg== ==hijklmn== ==opqrstu==

    Note that, in the syntax ==\1\2\3==, only one group is defined, at a time and the two others are just “empty” groups !

    Now, with the same initial text, the regex S/R, below :

    SEARCH ab(cde)fg|hi(jkl)mn|op(qrs)tu

    REPLACE ==\1\2\3==

    gives :

    ==cde== ==jkl== ==qrs==

    whereas the following regex S/R, with a branch reset group and only group 1, in replacement :

    SEARCH (?|ab(cde)fg|hi(jkl)mn|op(qrs)tu)

    REPLACE ==\1==

    would produce the same results

    …and the regex S/R :

    SEARCH (?|ab(cde)fg|hi(jkl)mn|op(qrs)tu)

    REPLACE ==\1\1\1==

    would give :

    ==cdecdecde== ==jkljkljkl== ==qrsqrsqrs==

    Best Regards,

    guy038

  • 0 Votes
    19 Posts
    5k Views
    Claudia FrankC

    @Χρήστος-Κοτζιάς

    Yes, I’m able to see your uploaded image.
    What is your question or what did I miss?

    Cheers
    Claudia

  • Notepad++ lifecycle information

    Locked
    2
    0 Votes
    2 Posts
    3k Views
    Claudia FrankC

    @Tony-Montana

    npp doesn’t do such thing as it always supports the last recent version only.
    I never saw that a particular version was patched.

    When something is wrong and a developer finds some time and interest to fixed it
    and Don accepts the PR than this will go into one of the next versions of npp.

    Cheers
    Claudia