• How to add .bas and .frm to Notepad++?

    2
    0 Votes
    2 Posts
    1k Views
    PeterJonesP

    @OvalPiston ,

    By default, .bas is associated with the Language > F > Freenbasic. If you look in Style Configurator, it should have FreeBASIC between Fortran and GDScript:

    3627a079-9929-4e39-8dd2-e3ecf6230d19-image.png

    If you don’t have that entry, then your stylers.xml (or whatever theme you’ve picked) is out of date, and doesn’t have that language; that might explain why the background is not matching (because nothing is defined). If you wanted to use FreeBASIC for .bas files, you could open C:\Program Files\Notepad++\stylers.model.xml, and then copy the FreeBASIC section into your active stylers.xml (usually in %AppData%\Notepad++\stylers.xml) or into your theme XML of choice. Restart Notepad++, and FreeBASIC should now be in your Style Configurator. (But you only need to bother with these steps if you want to use FreeBASIC syntax highlighting. If you want to treat .bas and .frm as Visual Basic, then see the next paragraph.) Alternately, maybe you’ll see FreeBASIC listed, but it will show background colors that aren’t as you expect – in which case, you could change the colors there, if you wanted.

    But you said you want .bas to apply to Visual Basic; to do that, you would change the VB / VBS language’s User ext.: settings. If you have it set to bas frm, like in my screenshot below, then .bas and .frm files will default to using the VB/VBS color settings.

    caad295f-726a-48c8-a69e-7bac29b5cd1e-image.png

    If you already have a .bas file open, it won’t immediately take effect (because Notepad++ decides on filetype when the file is first opened, so it will have loaded that file with .bas associated with FreeBASIC). Thus, if you close the file then immediately open it again (Ctrl+W, Ctrl+Shift+T), or open a new .bas that isn’t already open, Notepad++ will know to treat it as Visual Basic code rather than FreeBASIC code. And every one you open from now on will also follow Visual Basic syntax highlighting.

    ce96eed3-8d75-4bc5-b765-67f3650b3f7c-image.png

  • Search and replace/delete timestamps in brackets []

    2
    0 Votes
    2 Posts
    288 Views
    CoisesC

    @Poldi

    Select Search | Replace… from the main menu; then fill in:

    Find what: (\A|\R)\[.*?\]\h*
    Replace with: a single space
    Search Mode: Regular expression

    then click Replace All. (You’ll wind up with one extra space at the beginning of the file, which you can delete by hand.)

  • Special characters with unmapped "shortcut" combos

    11
    2 Votes
    11 Posts
    2k Views
    PeterJonesP

    @kuzduk-kuzduk,

    You earlier said,

    i dont understand why Don Ho do not off by default this Special characters with unmapped “shortcut”…

    And now you say

    Thanks, but this doesn’t work for me because I’m using npp 8.5.8

    I am sorry.

    Some applications use a model where they are able to release patch fixes to old releases of software; Notepad++ does not work that way. If there are bug fixes, they go in the next revision. So, to be able to get a fix, you have to be willing to update to a new version.

    (Yes, I said “willing” , not “able”, because despite your assertion, your choice to not upgrade Notepad++ instead of choosing to remap the weird PauseBreak global shortcut to something other than PauseBreak is just that… your choice. And it’s your choice to prioritize keeping PauseBreak over keeping )

    so sad, but [Alan’s script does] not work in russian layout

    As an alternative, figure out all the Ctrl sequences that type ASCII control characters based on your setup. Then create a NULL macro for each of those. A “NULL macro” is a “do nothing” macro. The scintilla action 2172 is a do-nothing/no-op/null-op action. So, you could insert a macro like the following into shortcuts.xml, then save and restart:

    <Macro name="NULL-CTRL-R" Ctrl="yes" Alt="no" Shift="no" Key="82" FolderName="Control Remaps"> <Action type="0" message="2172" wParam="0" lParam="0" sParam="" /> </Macro>

    This mapped macro it would stop Ctrl+R from inserting the DC2 ASCII 18 control character, and instead run a no-op command, making it “do nothing”.

    Creating multiple such macros, one for each unmapped sequence, would get rid of the accidental ASCII control characters in your documents. (And I showed putting it in FolderName="Control Remaps", so they would all show up in a sub-menu of Macros instead of cluttering your main Macros menu)

    -----

    update: earlier in this discussion, @Michael-Vincent linked to this old discussion. It turns out, my suggestion is essentially what Claudia suggested 8 years ago (good to know that her excellent answers have apparently become part of my subconscious mind), though she chose message 0 instead of 2172. And in this February’s replies to that ancient thread, @mkupper showed a mapping with lots of macros that show how to do the “one macro for each unmapped sequence” that I just suggested today. (Though I would again recommend changing to 2172, and I’d add the FolderName attribute to de-clutter the Macro menu.) And @Alan-Kilborn already made the 2172 correction in that other discussion. So basically, it turns out I said nothing new anywhere in the second half of this post of mine. ;-)

  • how to delete text in notepad ++

    8
    0 Votes
    8 Posts
    2k Views
    PeterJonesP

    @Mert-dirk said in how to delete text in notepad ++:

    then its not working do i miss something?

    You didn’t understand the regex, and randomly changed it, so of course it won’t give you the right answer.

    I will explain a few features of my regex that you apparently didn’t understand, and see if you can try to figure it out. I will link to each feature in the user manual so you can read more about it.

    (...) – things in parentheses go into “capture groups”, in order. Since I had two sets of parentheses, that goes into group1 and group2, which are referenced in the replacement as $1 and $2. \d – is a “single character match” for a “digit character” \d{N} – the {N} is a “multiplying operator”, which makes this sequence match "N digit characters .*? – “non-greedy” match “zero or more” of “any character” \w+ – “one or more” “single character match(es) for a word character

    So, what your edited regex is doing is saying "look for (localhost/wordpress/ followed by two digits then a slash then four digits then a slash) and put it all into group#1, then search for anything in between ending with a /, then (one or more word characters, followed by .jpeg ‡) and put the second parenthetical into group 2.

    With that, I hope you can figure out why your random edit didn’t work. And given that I told you what each section of the regex did, you should now know what to take out or move to get stuff out of the capture groups and into the in-between stuff, so that there is less in the replacement and thus, effectively, more is deleted.

    ‡: technically, it is any character followed by the literal .jpeg … but it will work for your purposes, unless you have other text that has some non-dot character before jpeg)

    And no, you got your freebie: I am not going to just hand you the answer a second time without you putting in a little effort. (And swapping a 2 and a 4 is not putting in effort; that was obviously a random guess on your part. Random guessing is not “effort”.)

  • How to change text particular row and column in notepad++

    6
    0 Votes
    6 Posts
    5k Views
    guy038G

    Hello, @shubhada-wavale and All,

    In this case, the regex S/R is greatly simplified !

    The generic regex S/R to use becomes :

    SEARCH (?-is)^.{O}\K.{N}

    REPLACE R

    Where :

    O ( for OFFSET ) represents the leading number of characters, of each line, to discard from the search

    N represents the number of characters to replace, in each line

    R represents the replacement expression to replace, in each line, the N characters, found after the first O characters

    Remarks :

    You must check the Wrap around option and select the Regular expression search mode

    Note that the replacement R may be an empty string if you want to delete the N characters of each line

    If the replacement part R contains parentheses, you must escape each of them with an antislash char

    For instance, given the text in the first post, above :

    <----------25-----------><-5-> 171TRM00009988000300032019060305 50533 TRANSFERENCIAS 2202019060320190603000300030000001 633001100119M00301100000001234545000000000000200+000000000000000 e ZAVALETA-RUIZ-CARLOS ENRIQUE 576704424233621544324211M00000051000300030000005 !052000040301336Calle Antonio Narino 272 Urb Ceres Ate Vitarte 000000000000000000000000000000JR MIROQUESADA 441 - LIMA 011011111411000101411 000300030000005 799D9900110011000000100030011ADDINTIONAL INFOR Z0000002 000300030000005 80000000005000000000110011000000000000001000000000000200000000000000000 000300030000001 90000010000000007000000000110011000000000000001000000000000200000000000000000~~~

    Then, the regex S/R :

    SEARCH (?-is)^.{25}\K.{5}

    REPLACE | This is a test |

    would change that text as below :

    <----------25----------->| This is a test | 171TRM0000998800030003201| This is a test |05 50533 TRANSFERENCIAS 2202| This is a test |0320190603000300030000001 633001100119M003011000000| This is a test |545000000000000200+000000000000000 e ZAVALETA-RUIZ-CARLOS ENRIQUE 576704424233621544324211M| This is a test |051000300030000005 !052000040301336Calle Ant| This is a test |Narino 272 Urb Ceres Ate Vitarte 000000000000000000000000000000JR MIROQUESADA 441 - LIMA 011011111411000101411 000300030000005 799D990011001100000010003| This is a test |DDINTIONAL INFOR Z0000002 000300030000005 8000000000500000000011001| This is a test |00000000001000000000000200000000000000000 000300030000001 9000001000000000700000000| This is a test |11000000000000001000000000000200000000000000000~~~

    Best Regards,

    guy038

  • Colour problems with a CSS source

    12
    0 Votes
    12 Posts
    928 Views
    PeterJonesP

    @DomOBU said in Colour problems with a CSS source:

    This does not prevent:

    That’s because you only followed some, not all, of @mpheath’s advice.

    here’s a series of screenshots that show:

    the default rendering of the two examples from above the rendering when all you do is add the user-defined IDENTIFIERs the rendering when you run editor.setProperty('lexer.css.scss.language', 1) in the PythonScript plugin (or use another scripting plugin’s syntax to set that property)

    f1b691f6-e5cd-4c8e-ad18-54634f695c5a-image.png

    In the final rendering, you can see:

    both the percentages in 100% {...} and 0% {...} are the same blue, rather than being different colors the first offset-distance is the same color to the second all three margin-left in the third example are the same color now

    Actually, that’s pretty small, so zooming in on the third screenshot:

    670a4baa-3fe1-4758-ac5c-6513ea3df56b-image.png 7f533438-c869-40d6-9423-95a0af19a322-image.png

    It might need a callback to survive changing tabs.

    I confirmed, if you set the property, then switch to a different tab and back to the CSS tab, the CSS rendering will go back to the “middle” version rather than the “right” version. So one would definitely need a callback to maintain that setting when changing tabs.

  • Default save location

    4
    0 Votes
    4 Posts
    579 Views
    TBugReporterT

    @th-ch said in Default save location:

    Btw i m not a beginner.😁

    Neither am I, but I’ve also kept Desktop as the default save location. (I usually have at least two Explorer windows open, and one of them will be focused on the real intended file location, so I can drag the file there after saving (and maybe drag again from there back to N++ to put it in the Recent list). This way I never have to double-check that N++ is really set to the right save folder.

  • please help me !

    3
    0 Votes
    3 Posts
    237 Views
    Hatim MelloukiH

    @Coises thank you very much sir

  • how do I select only the files missing when I campare two docs?

    2
  • Where's my document shortcut list?

    3
    0 Votes
    3 Posts
    249 Views
    Alan KilbornA

    @bulrush15 said in Where's my document shortcut list?:

    …a document list where I could add a shortcut to my…

    Maybe you had a version of N++ where you had the Explorer plugin installed; it has such a functionality (if I’m interpreting what you are describing correctly).

    EDIT: Peter said: “Or did you have a plugin which has the ability to add Shortcuts? I believe the Explorer plugin has the ability to use shortcuts.”

    I think I’m “channeling” Peter, but maybe I should be fully reading his posts that occur before mine.

  • How to use fixed-width spaces?

    2
    0 Votes
    2 Posts
    644 Views
    PeterJonesP

    @bulrush15 ,

    Settings > Style Configurator > Global Styles > Default Style is where you set the main font that is inherited by all the other styles in the Style Configurator, including the Perl styles. The font for spaces and tabs is determined by that style. The Settings > Style Configurator > Perl > DEFAULT style is only used for text that the lexer cannot figure out how to assign to any color (which is why the default color in the default theme is red, to indicate that it’s an error that doesn’t match anything that the lexer can understand as Perl).

  • how to delete rows out of multiple files

    Locked
    11
    0 Votes
    11 Posts
    2k Views
    PeterJonesP

    To future readers of this topic: sorry for the missing information: the original poster deleted their posts because the data they shared had privacy violations.

    As a moderator, I restored the posts so there’s still some context for this conversation. But I removed (“redacted”) the original data and screenshots – both from the original poster’s messages and from any replies.

    This conversation is mostly meaningless at this point, so there’s not much to learn from. Sorry.

    This Topic is now locked.

    Moral

    The data you share in this forum has to be of the same format and structure as your oringal data, otherwise we cannot help you. But you need to make sure you clean out any private or secret or sensitive information and replace it with meaningless data that has the same structure and form.

  • How to stop curly braces moving left when I type?

    3
    0 Votes
    3 Posts
    303 Views
    bulrush15B

    @Alan-Kilborn Maybe I’m misunderstanding auto-indent. If I indent a line I want to keep that indent, but not do a backwards indent. I’ll try what you said.

  • How to remove icons from Notepad++ row just below menu row?

    7
    0 Votes
    7 Posts
    1k Views
    John PollardJ

    @PeterJones said

    There are per-user settings on which notifications go to email and which only flag in the forum, so you might check there. But email notifications from the Forum have never been reliable – there have been so many decades of fighting internet spam that various servers throughout the path take it upon themselves to clean the ether of bulk-looking emails, even before they hit your local spam filters. We’ve set all the “I’m safe” fields that we know how to set, but many of those notifications still never make it to their recipients.

    Sad. But thanks for the explanation.

  • adding a background image

    2
    0 Votes
    2 Posts
    407 Views
    Mark OlsonM

    @Andy-Scott
    If this is a question about HTML, and nothing you’re asking is specific to Notepad++, you’ve asked your question in the wrong place.

  • Regex search - match multiple strings anywhere within multiple files

    7
    0 Votes
    7 Posts
    6k Views
    guy038G

    Hello, @wkwied, @peterjones and All,

    @wkwied, all the regexes, below, ONLY matches if the 3 expressions price, assert and allow are all present, with this exact case, at least one time, in the current file !

    Regex A : (?s-i)\A(?=.*assert)(?=.*price)(?=.*allow)([^|\r\n]|\R)

    Regex B : (?s-i)\A(?=.*assert)(?=.*price)(?=.*allow)(?-s).*\R

    Regex C : (?s-i)\A(?=.*assert)(?=.*price)(?=.*allow).*?\K(?:assert|price|allow)

    Regex D : (?s-i)\A(?=.*assert)(?=.*price)(?=.*allow).*?\K(?:assert|price|allow).+(?:assert|price|allow)

    More precisely, IF the 3 expressions price, assert and allow all exist, at least one time, with this exact case, in current file :

    The regex A matches the first standard or EOL character(s)

    The regex B matches the first line, empty or not, with its line-break char(s)

    The regex C matches the first searched expression found

    The regex D matches from the first to the last searched expression found

    For instance :

    Regex A could be used with the Find in Files dialog to find out all the files containing these 3 expressions

    Regex D could be used, in a second time, with the Mark dialog to get the commplete range of the searched expressions, for specific files

    To be convinced, simply paste the text below ( part of the license.txt file of N++ v8.6.5 ) in a new tab :

    Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow.

    and… experiment !

    Notes :

    You must tick the Regular expression search mode and the Wrap around box option

    As soon as you insert or delete a character, within one of these 3 words, the regex will fail systematically !

    Best Regards

    guy038

  • shortcuts.xml With UTF-8 BOM Fails to Load

    7
    1 Votes
    7 Posts
    641 Views
    mkupperM

    <BOM/>@Bob-Smith-0, I am astonished that you did not preface your message with a BOM!

    As you seem to have already recognized the issue I suspect it would be enough to add two more tools to your bag, one that inserts a BOM, and another that removes it You can then do your desired magic on Notepad++'s config.xml.<EOM/>

  • Need help linking CSS with html

    3
    0 Votes
    3 Posts
    367 Views
    CoisesC

    @tilsy637

    If you mean that in your text href="css/rr.css" Notepad++ does not render css/rr.css as a clickable link, that is expected. Only complete URLs (with the http:// part, for example) are clickable. Even though what you’ve written is a relative URL in the context of HTML, Notepad++ doesn’t understand HTML and can’t recognize it as a link. You have to navigate to it on your own.

    If you mean it doesn’t work when you open it in a browser, then as @PeterJones wrote, this is the wrong forum.

    If you meant that Notepad++ doesn’t apply the style information, it will not. Notepad++ is strictly a source (plain text, with some syntax highlighting) editor; it can’t do “what you see is what you get” editing for HTML.

  • How to change apostrophe to letter g as a whole word

    3
    0 Votes
    3 Posts
    433 Views
    Mohamed MohamedM

    @PeterJones Thank you, it works

  • How to save the marked lines

    2
    0 Votes
    2 Posts
    636 Views
    PeterJonesP

    @Chetan-S-R ,

    Notepad++ does not save Bookmarks or the other styles.

    However, some years back, @Alan-Kilborn shared a script for the PythonScript plugin, which will allow you to save Bookmarks or styles, in this post in the “Style token not saved” conversation.

    So you would grab the script from that discussion, and follow our FAQ for installing/using PythonScript scripts

    Since that script was focused on Style Tokens, and not the Bookmarks, I am not 100% whether it would work “out of the box” for you, or whether you’d have to add in a check for the Bookmark code as well… It’s been too long since I used that. However, Alan can probably chime in about that.