• Search for a list of strings in another file.

    8
    0 Votes
    8 Posts
    3k Views
    Alan KilbornA

    @gendalv said in Search for a list of strings in another file.:

    although I had to figure out how to actually run a python script in np++, ended up installing PythonScript plugin, which is also not obvious, how to add a script to, but, after some fiddling

    You could have found quicker answers had you consulted this site’s FAQ entry for : How to install and run a script in PythonScript

  • Hide text

    3
    0 Votes
    3 Posts
    471 Views
    F

    @Alan-Kilborn thank you for this clear answer.

  • Adding a shortcut to a language....

    3
    1 Votes
    3 Posts
    2k Views
    BenHastingsFDSUB

    @PeterJones Thanks!! This really quite the perfect write-up. Top results off Google and 20 min later, I have icons for “Set Language to SQL” and “Set Language to XML.”

    The PytonScript was a little wonky with allowing me to set the icon. It seemed committed to .bmp or .ico files rather than .png. Ok – found those alternatives. But each time I tried to load them, it just didn’t work. But hey – that’s more the plug-in…

    Your solution worked like a charm! Thank you!

  • remove correlative text from multiple lines

    9
    0 Votes
    9 Posts
    344 Views
    Alan KilbornA

    @Mark-Olson said in remove correlative text from multiple lines:

    try using \s

    And note that \h is often better than \s.
    \s will match end-of-line characters which isn’t always what people expect.

  • Delete numbers following letters ( i.e. \w\d+\s becomes \w\s)

    3
    0 Votes
    3 Posts
    229 Views
    Luís GonçalvesL

    @Alan-Kilborn you’re right! Haha. Sorry about that, I’m just finding how regular expressions work (and I’m loving it, even though it’s hard to learn all by oneself)… so I’m sorry if sometimes my questions are more or less repetitive -.-’

  • "Intellisense" suggesting wrong words

    11
    0 Votes
    11 Posts
    482 Views
    Petr DemuthP

    @Michael-Vincent said in “Intellisense” suggesting wrong words:

    @Petr-Demuth said in “Intellisense” suggesting wrong words:

    Notepad++ v8.4.8 (64-bit)

    That’s the problem. If you want the behavior we are seeing, upgrade to 8.5 or newer.

    On a fresh 8.4.8 portable, I observe the same behavior as you do.

    Cheers.

    Kudos!
    Now works OK :)
    01331bb5-6b6c-41b0-aef7-a4882c501a94-image.png

  • Code Collapsing Weirdness

    3
    0 Votes
    3 Posts
    162 Views
    Alan KilbornA

    @Jason-Burnett:

    I try to collapse one sub_fld, it collapses the parent element

    I don’t know…works for me correctly, with N++ 8.5:

    dcc4a6bd-72bc-478a-a9be-77e935a9cf7f-image.png

    I guess if it doesn’t work for you, you’ll have to demo something about exactly what it is doing for you.

  • Snaphot not work with Plugin !?

    4
    0 Votes
    4 Posts
    206 Views
    Michael VincentM

    @Mes-E-M said in Snaphot not work with Plugin !?:

    How can a Plugin interfere with periodic autosave?

    The Notepad++ API changes so does the underlying Scintilla API - so it could be any number of things.

    What old version of Notepad++ did it work on?

    Where is the code to your plugin?

    Cheers.

  • 0 Votes
    7 Posts
    1k Views
    Alan KilbornA

    @pbarney said in Is it possible to replace individual characters inside a regex capture group?:

    If I owned a software development business, I’d hire you as Chief RegEx Officer.

    I fully endorse this.

  • langs.xml

    2
    0 Votes
    2 Posts
    185 Views
    PeterJonesP

    @DomOBU ,

    My general procedure in something like that is to do a DIFF between the two versions (the Compare Plus plugin is quite helpful for that) – and anyplace that is undoing your own setting can be ignored, but anything added to the v8.5.1 one that isn’t in your existing should be added; once your copy has been updated to include any new entries from v8.5.1, then you can copy your updated XML overtop the one in the v8.5.1 directory and restart Notepad++.

  • Insert new line after every comma, colon AND period mark

    4
    1 Votes
    4 Posts
    16k Views
    Alan KilbornA

    @Luís-Gonçalves said in Insert new line after every comma, colon AND period mark:

    The problem with that regex is that it deletes the commas, colons and period marks, which I don’t want to. I want to keep them as they are, while inserting a new line after them.

    Ah, I missed that detail.

    Revise the Replace: $0\r\n

  • Replace text inside Quotations

    6
    0 Votes
    6 Posts
    408 Views
    Alan KilbornA

    @geeman72 said in Replace text inside Quotations:

    and worked with this

    Seems reasonable!

  • How to get search partially instead of exact match?

    7
    0 Votes
    7 Posts
    793 Views
    Alan KilbornA

    @Neil-Schipper said in How to get search partially instead of exact match?:

    This could be achieved by using a suitable regex with a logical or directive and Mark All.

    I meant when using the simple regex I supplied.

  • mouse cursor changing shape as i move it

    4
    0 Votes
    4 Posts
    2k Views
    Terry RT

    @Terry-R said in mouse cursor changing shape as i move it:

    I only ever have the pointer when on menu options , radio buttons (under settings) and the I when over a text input field or in the tab itself to type characters.

    After seeing @Alan-Kilborn response I checked again. it took some searching but found the “finger”, when over Settings, Preferences, Recent Files History, Max. number of entries. I doubt there are many occurrences of those “pointers”, but as @Alan-Kilborn says, it’s normal behaviour.

    Terry

  • add attribute to element from value of next element

    2
    0 Votes
    2 Posts
    158 Views
    Mark OlsonM

    @Anar-Movsumov
    find/replace form; replace (?s)<request>\s*<num>(\d+)</num>(.*?</request>) with <request id="\1">\2.

    The very excellent regex manual on the reference website has some pages that may be of interest:

    single character matches on \s, ., and \d capture groups and backreferences for why I wrapped (\d+) and (.+</request>) in parentheses search modifiers to understand how (?s) works multiplying operators on why you need to use .*? and not .* to match everything between the <num> element and the remaining children of the <request> tag.
  • all files are one line?

    4
    0 Votes
    4 Posts
    3k Views
    Mark OlsonM

    @Vap
    Yeah, this is either JSON or something infuriatingly close to JSON that taunts the user by having a few strategically placed syntax errors.
    In either case, JsonTools and JSMinNPP are both fine choices. In the case of JsonTools, once you have the plugin, Pretty-print JSON will get you where you want to go.

  • Find and replace text with regex

    3
    0 Votes
    3 Posts
    301 Views
    Alan KilbornA

    @PeggoC82

    Regardless, this is a now-classic “replacing in a specific zone of text” problem, and we have a solution for that; reference HERE to get started and post back again if you need further help.

  • WordWeb Pro 10.1 not working in Notepad++ 8.5

    15
    0 Votes
    15 Posts
    1k Views
    EkopalypseE

    @R-D

    I don’t see the problem on my end.
    I downloaded the free version and Ctrl+mouse-right click seems to trigger Wordweb. But there is a problem with recognizing the correct word. It only works reliably if I select the whole line and then do the action at the particular word.

    wordweb.gif

  • How do you make a note pade file .ush for unreal engine

    2
    0 Votes
    2 Posts
    368 Views
    Emile BrouillardE

    i figured it out in the end it was just a mather of renaming the text file type in the right hierachy of folder for unreal . So you need to rename it in .ush and with all folder type engaged and your good when you see fichier USH27e0e338-1dd6-4051-bd4c-f0a1d7df2ad5-image.png

  • Remove "save file" prompt?

    14
    0 Votes
    14 Posts
    1k Views
    Alan KilbornA

    @Alan-Kilborn said in Remove “save file” prompt?:

    STOP! You’re doing it wrong!
    Every time you run that script, you put another callback in place.

    So let’s explore this a bit further.

    Create a script much like the earlier one in this thread:

    # -*- coding: utf-8 -*- from __future__ import print_function from Npp import * console.show() print('user ran the script! (let us flash the screen for fun)') editor.flash(250) def BufferActivated(args): print('system-generated buffer activated! tab:', notepad.getCurrentFilename().rsplit('\\', 1)[-1]) notepad.callback(BufferActivated, [NOTIFICATION.BUFFERACTIVATED])

    Run it once via the Plugins > Python Script > Scripts menu. Then click on different tabs, get something like this as output in the PythonScript console window:

    user ran the script! (let us flash the screen for fun) system-generated buffer activated! tab: new 3 system-generated buffer activated! tab: new 1 system-generated buffer activated! tab: new 2 system-generated buffer activated! tab: new 3

    All good. Now run the script 3 more times from the Plugins > Python Script > _Run Previous Script() _ menu.

    Now select a few different tabs (I did same sequence as above) to obtain:

    user ran the script! (let us flash the screen for fun) user ran the script! (let us flash the screen for fun) user ran the script! (let us flash the screen for fun) system-generated buffer activated! tab: new 3 system-generated buffer activated! tab: new 3 system-generated buffer activated! tab: new 3 system-generated buffer activated! tab: new 3 system-generated buffer activated! tab: new 1 system-generated buffer activated! tab: new 1 system-generated buffer activated! tab: new 1 system-generated buffer activated! tab: new 1 system-generated buffer activated! tab: new 2 system-generated buffer activated! tab: new 2 system-generated buffer activated! tab: new 2 system-generated buffer activated! tab: new 2 system-generated buffer activated! tab: new 3 system-generated buffer activated! tab: new 3 system-generated buffer activated! tab: new 3 system-generated buffer activated! tab: new 3

    As one can see, each time you switch a tab now, the callback gets called FOUR times! That’s because the script was run 4 times, and 4 separate callback functions were registered. It doesn’t matter that it was the “same” function that was registered each time.

    How does one avoid/prevent this kind of thing from happening? Well, don’t run the script multiple times. But, accidents happen, so change the code to protect yourself. But how?

    The changed script below shows how I like to do it (there are certainly other ways to achieve it):

    # -*- coding: utf-8 -*- from __future__ import print_function from Npp import * console.show() print('user ran the script! (let us flash the screen for fun)') editor.flash(250) def BufferActivated(args): print('system-generated buffer activated! tab:', notepad.getCurrentFilename().rsplit('\\', 1)[-1]) # --- vvv --- differences from original script are below --- vvv --- try: i_am_installed except NameError: notepad.callback(BufferActivated, [NOTIFICATION.BUFFERACTIVATED]) i_am_installed = True else: print('callback is already installed!')

    The effect should be somewhat self-explanatory from the code. If you try the multiple runs experiment with this new version of the script, you shouldn’t see multiple buffer-activated processing when tabs are switched in the Notepad++ UI.