• Multi selection and multi edit

    64
    2 Votes
    64 Posts
    223k Views
    donhoD

    FYI: This feature is implemented in Notepad++ core and it’ll be available in the next release.
    You may want to check the PR to see if it meets your need:
    https://github.com/notepad-plus-plus/notepad-plus-plus/pull/14313

  • HTML pages view

    10
    0 Votes
    10 Posts
    2k Views
    mkupperM

    @PeterJones and others

    I am running 8.5.8 but apparently the Run / Launch in Firefox Ctrl+Alt+Shift+X that’s available to me is a legacy thing from a previous version of npp. I usually double check a portable 8.5.8’s behavior before commenting but forgot to do that earlier in the thread. My portable 8.5.5 does not have Run / Launch in Firefox

    That made me curious… It turns out the culprit, if you want to call it that, is an entry in my shortcuts.xml file:

    <UserDefinedCommands> <Command name="Launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="88">firefox &quot;$(FULL_CURRENT_PATH)&quot;</Command> </UserDefinedCommands>

    I dug further and found that up until npp v7.6.2 that the shortcuts.xml file included:

    <UserDefinedCommands> <Command name="Launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="88">firefox &quot;$(FULL_CURRENT_PATH)&quot;</Command> <Command name="Launch in IE" Ctrl="yes" Alt="yes" Shift="yes" Key="73">iexplore &quot;$(FULL_CURRENT_PATH)&quot;</Command> <Command name="Launch in Chrome" Ctrl="yes" Alt="yes" Shift="yes" Key="82">chrome &quot;$(FULL_CURRENT_PATH)&quot;</Command> <Command name="Launch in Safari" Ctrl="yes" Alt="yes" Shift="yes" Key="65">safari &quot;$(FULL_CURRENT_PATH)&quot;</Command> <Command name="Get PHP help" Ctrl="no" Alt="yes" Shift="no" Key="112">http://www.php.net/$(CURRENT_WORD)</Command> <Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no" Key="114">https://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command> <Command name="Open file in another instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst</Command> <Command name="Send via Outlook" Ctrl="yes" Alt="yes" Shift="yes" Key="79">outlook /a &quot;$(FULL_CURRENT_PATH)&quot;</Command> </UserDefinedCommands>

    From npp v7.6.3 to v7.9.5 much of that was commented out:

    <UserDefinedCommands> <!-- The following shortcuts are dangerous if your computer is compromised. (But if your computer is compromised, EVERYTHING IS DANGEROUS!) Remove the comment and use them at your own risk!!! <Command name="Launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="88">firefox &quot;$(FULL_CURRENT_PATH)&quot;</Command> <Command name="Launch in IE" Ctrl="yes" Alt="yes" Shift="yes" Key="73">iexplore &quot;$(FULL_CURRENT_PATH)&quot;</Command> <Command name="Launch in Chrome" Ctrl="yes" Alt="yes" Shift="yes" Key="82">chrome &quot;$(FULL_CURRENT_PATH)&quot;</Command> <Command name="Launch in Safari" Ctrl="yes" Alt="yes" Shift="yes" Key="65">safari &quot;$(FULL_CURRENT_PATH)&quot;</Command> <Command name="Send via Outlook" Ctrl="yes" Alt="yes" Shift="yes" Key="79">outlook /a &quot;$(FULL_CURRENT_PATH)&quot;</Command> --> <Command name="Get PHP help" Ctrl="no" Alt="yes" Shift="no" Key="112">http://www.php.net/$(CURRENT_WORD)</Command> <Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no" Key="114">https://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command> <Command name="Open file in another instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst</Command> </UserDefinedCommands>

    Starting with v8.0 the commented out section was removed.

  • Regex help using find for the first 15 characters only.

    2
    0 Votes
    2 Posts
    1k Views
    PeterJonesP

    @Caner-Ak ,

    Yes, using single character matches, quantifiers/multiplying operators and anchors: For example, ^.{14}U will only match “start-of-line, then 14 of any character, then a U”.

    Note: When using . to match any character, make sure you have the correct state of . Matches Newline or use the equivalent search modifier (?-s)/(?s) in the regex.

    ----

    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
  • PythonScript: Script not working

    3
    0 Votes
    3 Posts
    456 Views
    PeterJonesP

    @Fuel-DZN said in PythonScript: Script not working:

    How is it matching the contents of the file if it just closed it?

    Either a bug in your logic, or a race condition. If it’s a bug in your logic, it’s not really on-topic for a Notepad++

    But if it’s a race condition, it’s got to do with the way that Plugins ask Notepad++ to perform actions: In case you didn’t know, Notepad++ actions take time (dozens or hundreds of milliseconds are not uncommon action times), and the Plugin Communication messages that the notepad and editor objects wrap around often don’t wait until the action is complete before returning control to the plugin (which in this case is the PythonScript plugin, which then continues executing your script).

    So your script tells Notepad++ to close the file, the application says “okay, I will”, and then proceeds to take a significant fraction of a second to close the file. In the meantime, your script gets the “okay, I will” message and then says “good, I’ll continue running the next commands”.

    If you were going to continue to do something more after the file were closed, I would say that you should probably put in a 500ms - 1000ms wait after doing the close, just to make sure that Notepad++ has time to finish it.

    If you are not planning on doing anything after, then I would suggest adding in logic to exit the script (warning: exit() doesn’t do what you think it does in PythonScript [when it kills the Python interpreter, it also closes Notepad++], so you’ll want flags and if-statements to just quickly exit out of your script, or throw an exception, which PythonScript handles more gracefully (without exiting Notepad++).

    How can it have a match and also no match?

    Either because of the race condition (above) or because of another logic bug. If it’s the race condition, then it’s explained above. If it’s a logic bug on your part, that’s just part of programming, and not specific to Notepad++ or the PythonScript interface with Notepad++, so is not on topic here.

  • 0 Votes
    3 Posts
    286 Views
    Fuel DZNF

    @Alan-Kilborn Thanks, that worked. I had tried that but forgot to put it after the notepad.activateBufferID line.

  • Break Text ever x Characters (keeping sentence / paragraphs)

    3
    0 Votes
    3 Posts
    442 Views
    Andrew CaseyA

    @Coises Wow that is amazing - will save so much time thanks

  • 0 Votes
    7 Posts
    3k Views
    Alan KilbornA

    I wonder what the rationale was for allowing multiple shortcuts for the same Scintilla command, but only one shortcut for non-Scintilla commands?

    Perhaps because “Copy” (and related) command is (or used to be) very common in apps as Ctrl+Insert as well as Ctrl+c?

    I wonder how hard it would be to allow ALL commands to have multiple shortcuts. (The current workaround is to define a macro for a single command, and then assign the macro a keycombo).

  • Saving Session does not include bookmarked lines in XML file

    5
    0 Votes
    5 Posts
    317 Views
    Peter RudloffP

    THANK YOU! Version 1.5 solved all problems! Blue bullets and Mark tags are back.

  • Formatting js file

    3
    0 Votes
    3 Posts
    5k Views
    James JordanJ

    Thank you Peter. I appreciate the quick reply.

  • Dspell Check offline language installation

    2
    0 Votes
    2 Posts
    423 Views
    PeterJonesP

    @Ofer-Ton ,

    Are you using the Hunspell library in DSpellCheck Plugin? If so, the plugin downloads the dictionaries from https://github.com/LibreOffice/dictionaries , then places the .dic and .aff files into %AppData%\Notepad++\Plugins\config\Hunspell\ (or whatever directory is shown in the Plugins > DSpellCheck > Settings… > Hunspell Dictionaries Path setting)…

    So if you have grabbed an offline copy of the right dictionary files, you should be able to put them in that directory and restart Notepad++, and the DSpellCheck/Hunspell should show them as available in the plugin’s Language: pulldown.

    (Sorry, I don’t know the ASpell side of things, so I cannot give the equivalent instructions if you’re using that library instead)

  • How can I style just the number prefix?

    3
    0 Votes
    3 Posts
    563 Views
    Peter LindP

    @ PeterJones Thank you!

  • Why is this an invalid expression only in some files?

    Locked
    8
    0 Votes
    8 Posts
    3k Views
    Terry RT

    Please note that the poster’s account that started this conversation was removed. This was due to issues for new posters trying to reply to other posts, the forum’s moderators are working on a fix. Then the poster created a new (similar) account and posted another thread, with almost the same question.

    That thread is located here.

    Terry

  • How to find the first space in all lines?

    6
    0 Votes
    6 Posts
    701 Views
    Emalino EmaleroE

    Thanks!

  • Cryptage

    2
    0 Votes
    2 Posts
    210 Views
    Alan KilbornA

    @ec974 said in Cryptage:

    Hello Administrator(s),

    It would be nice to be able to encrypt a file with a Ctrl + something (or other simple manipulation).
    Thanks for thinking about it

    First, English is the preferred language of this forum.

    Second, there’s a plugin for encryption, I think it is called NppCrypt, but check Plugins Admin to be sure.

  • How to get Notepad++ to close all files upon closing the program?

    3
    0 Votes
    3 Posts
    2k Views
    Patrick ZonneveldP

    That did the trick, thanks!

  • Wierd characters

    3
    0 Votes
    3 Posts
    201 Views
    CoisesC

    @Jongolo-Der-II

    Notepad++ is the wrong tool for this job.

    Try SQLiteStudio.

  • Move id number to the left side

    2
    0 Votes
    2 Posts
    192 Views
    Alan KilbornA

    @Deny-Firmansyah :

    Find: (?-s)(.*),(\d+)$
    Replace: ${2}, ${1}
    Search mode: Regular expression

  • Sequence number 1, 2, 3... Change to adding a 0

    5
    0 Votes
    5 Posts
    2k Views
    CoisesC

    @Un-Known

    Your title and example suggests that the question numbers are already correct, you just want to add a zero before them, and you say you have 325 questions; so I wonder, do you want:

    01- 02- ... 09- 010- 011- ... 099- 0100- 0101- ... 0325-

    which is what your question, taken precisely, says? Or:

    001- 002- ... 009- 010- 011- ... 099- 100- 101- ... 325-

    which is what I think @PeterJones assumed you meant?

    Also, are the numbers themselves already correct (just missing the leading zeros), or do you need to renumber, too?

    If all you wanted was to add one zero before every question number, and the pattern follows your example that all question lines, and only question lines, start with a number, then all you need is:

    From the menu, select Search | Replace; in the dialog, set:

    Find what : ^(\d)
    Replace with: 0$1
    Search Mode : Regular expression

    and use the Replace All button.

  • UDL folding breaks halfway through the file

    2
    0 Votes
    2 Posts
    287 Views
    PeterJonesP

    @ArminRay said in UDL folding breaks halfway through the file:

    It works fine for about the first third of the file, but then breaks halfway through the file.

    Unfortunately, the UDL folding has never been perfect, and it’s been pointed out to the developer for years: nothing has ever come of such reports (or any of the other feature requests for UDL). We essentially have to live with imperfect folding for UDL, or not use it. (Some of my UDL don’t fold right even near the top of the document, if the first line(s) of the document are a comment. So it might be that a comment somewhere in your file is the culprit for breaking folding. And consider yourself “lucky” that it works for even the first 1/3 of the file.)

    If you write a Lexer Plugin, you can define the folding yourself, and it might work better for you than UDL’s built-in folding. But that’s a lot of work, and I doubt you’ll go that far.

    (Sorry, there’s not much else I can say. It’s annoying that a much-used feature of Notepad++ has essentially been left to rot, letting people use what works, but ignoring what doesn’t or what could be made better. The best I can do is commiserate with you, because I cannot offer you any hope that the UDL system will ever get better.)

  • Start Notepad++ with powershell

    3
    0 Votes
    3 Posts
    4k Views
    mkupperM

    @_ A couple of comments (well, it turned out to be a lot more…):

    Gotcha#1 - If Notepad++ is already running then when you start a new instance of Notepad++.exe it sees that a copy is already running and will hand control to that. It does not pass along that it was started minimized. Thus Notepad++ will appear to start as a window or maximized if that’s what you already had it as. Gotcha #2 - If Notepad++ is already running, but minimized, then attempts to start Notepad++ as minimized end up both passing control to the already running copy but also activating it to a normal or maximized window. Gotcha 3 - There is another “gotcha” where if Notepad++ is running as a maximized window, you exit/close it, and then attempt to start it as minimized that Notepad++ will fire up as maximized.

    The only thing works is for you to be running Notepad++ as a non-full screen windowed application, for you to exit/close it, and then to start it as minimized.

    The second issue is your syntax for how to start Notepad++ seemed rather mangled. I don’t know if the mangling was your attempt to copy/paste a correct command into the forum or if attempted the wrong syntax to start with. I suspect you started with the wrong syntax as you mentioned “<ScriptBlock>,<No file>:line 1” etc. which is unexpected regardless of how you were trying to start Notepad++.

    The syntax I used from PowerShell was:
    Start-Process "C:\npp\npp858x64\notepad++.exe" -WindowStyle Minimized

    I got the C:\npp\npp858x64\notepad++.exe part that is inside the quotes from Notepad++’ ? / Debug info... menu. A box or window will pop up. The second line of that box for me was:
    Path : C:\npp\npp858x64\notepad++.exe
    I copy/pasted the part into the command line that I used for testing this.

    A normal installation of Notepad++ is usually in the C:\Program Files\Notepad++\notepad++.exe directory meaning people would use:
    Start-Process "C:\Program Files\Notepad++\notepad++.exe" -WindowStyle Minimized

    Again though, the gotchas mentioned above will apply regardless on if you try to start Notepad++ from Powershell, via a .lnk shortcut file that says “run minimized” or the command prompt’s START command with the /MIN option run run either the exe or shortcut. All of them will fail to be minimized if any of the gotchas I listed above apply.

    To start a minimized Notepad++ you must:

    Not already have Notepad++.exe running. That when you exited/closed Notepad++ that it had been a windowed app (not maximized) regardless on if you may have had it minimized at the time you closed it.
    It’s a rather narrow eye-hole in the needle but you can nail it 100% of the time if those two conditions exist.

    If you absolutely must start a minimized copy of Notepad++ then I would:

    Install a portable copy somewhere. Rename the portable copy of Notepad++.exe to something else such as min-notepad.exe. In your powershell script see if the min-notepad.exe process is running and if so, kill it and wait for it to terminate as we will then be updating the config.xml file. In your powershell script inspect the config.xml file for your portable copy and see if the line for <GUIConfig name="AppPosition" ... has isMaximized="yes". If so, change that to be isMaximized="no" and save it. Now you can start min-notepad.exe in minimized mode but there is still one more gotcha… You need to start min-notepad.exe with the -multiInst command line option to prevent it from locating a copy of Notepad.exe that is already running and passing control to it. The PowerShell command becomes:
    Start-Process "C:\npp\npp858x64\min-notepad.exe" -ArgumentList @("-multiInst") -WindowStyle Minimized