• Find & Replace Modal Displaying Transparently in v8.5.3

    3
    0 Votes
    3 Posts
    200 Views
    Allen KenneyA

    @PeterJones Thank you!
    I had never noticed that option in the bottom-right corner before.
    That was my problem.

  • Macro with Encoding... Char Sets... OEM-US Does Nothing

    2
    0 Votes
    2 Posts
    311 Views
    Alan KilbornA

    @TheSimArchitect

    Maybe try:

    <Macro name="OEM US" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="2" message="0" wParam="45044" lParam="0" sParam="" /> </Macro>
  • New to Notepad++ Community

    6
    0 Votes
    6 Posts
    467 Views
    Mark OlsonM

    To expand on what @PeterJones said, my general feeling about learning any kind of programming is that you will probably make better progress and gain a better understanding if you have some intrinsic motivation to do something.

    So I guess my advice is this: look for some aspect of Notepad++ or an existing that you don’t like. Spend some time thinking about whether you have an idea of how to make it better. Look at the documentation and see if you can see a reasonable way to implement your idea.

  • [Improvements] Folding, copy paste, drag'n drop

    16
    0 Votes
    16 Posts
    1k Views
    wonkawillyW

    OK the solution proposed works indeed: so the trick is basically to select one more paragraph / end of line / \r\n to make it work.
    Thank you all.

  • Find and Replace Multiple Lines of Code for whole directory

    3
    0 Votes
    3 Posts
    495 Views
    JigenJ

    @Karan-Mandya said in Find and Replace Multiple Lines of Code for whole directory:

    I was able to make it work.

    Using \r \n and \t in extended search mode I was able to put entire code supposed to be replaced in single line and then did a replace in all files pretty easily. Yay!

  • Notepad++ Sort Class

    9
    0 Votes
    9 Posts
    596 Views
    PeterJonesP

    @JediSQL said in Notepad++ Sort Class:

    I do not think that addresses, though, the relative order of letters versus special characters.

    Yes it does. Uppercase come before underscore come before lowercase in lexicographic order. If Notepad++ is capitalizing all letters to sort ignoring case, then it will put letters before underscore. If PowerShell is lowercasing all letters, it will put letters after underscore.

  • 2 Votes
    16 Posts
    1k Views
    Mark OlsonM

    Disregard the version I posted in my previous post. It is bugged and does not work.

    This version contains a proper working implementation of a feature in which the current word is boosted to the top if it previously occurred and is otherwise not shown.

    from Npp import * # BEGIN SETTINGS AUTOCOMPLETION_MIN_LEN = 2 # min length of word to trigger autocompletion CHARS_TO_MATCH = r'[\w_-]' # characters that can be in "words" (by default most letters, digits, underscores, and dashes) USE_LANGUAGE_IGNORECASE = True # use the document's lexer language setting for ignoring case DEFAULT_IGNORECASE = False # should case be ignored if not using language ignorecase? ENABLED_EXTENSIONS = { '', # files with no extension yet 'csv', 'txt', 'md', 'xml', 'json', 'tsv', 'log', 'dump', 'yaml', 'yml', } # only use for files with these extensions MAX_FILE_SIZE = 200_000 # do not try autocompleting for files with more bytes than this CURRENT_WORD_ONLY_IF_IN_TEXT = True # END_SETTINGS def on_match(m, ctr, ignorecase): '''increase the count of the current word by 1 if ignorecase, store only the uppercase version of each word''' word = m.group(0) if ignorecase: word = word.upper() ctr.setdefault(word, 0) ctr[word] += 1 def getWordRangeUnderCaret(): '''get the start and end of the word under the caret''' pos = editor.getCurrentPos() word_start_pos = editor.wordStartPosition(pos, True) word_end_pos = editor.wordEndPosition(pos, True) return word_start_pos, word_end_pos def getExtension(fname): for ii in range(len(fname) - 1, -1, -1): if fname[ii] == '.': break if ii == 0: return '' return fname[ii + 1:] def onCharInsert(notif): '''Find all words in the document prefixed by the word under the caret and show those words for autocompletion sorted by their frequency. Ignore words with length less than AUTOCOMPLETION_MIN_LEN. May ignore the case of words based on the lexer language (e.g., will ignore case in SQL but not in Python)''' if editor.getLength() > MAX_FILE_SIZE: return ext = getExtension(notepad.getCurrentFilename()) if ext not in ENABLED_EXTENSIONS: return word_start_pos, word_end_pos = getWordRangeUnderCaret() word_length = word_end_pos - word_start_pos word = editor.getRangePointer(word_start_pos, word_length).strip() if word_length < AUTOCOMPLETION_MIN_LEN: return ctr = {} # anything preceded by a non-word-char and starting with the current word match_pat = '(?<!{0}){1}({0}*)'.format(CHARS_TO_MATCH, word) ignorecase = DEFAULT_IGNORECASE if USE_LANGUAGE_IGNORECASE: ignorecase = editor.autoCGetIgnoreCase() else: editor.autoCSetIgnoreCase(ignorecase) if ignorecase: # match case-insenstively if that's the language default match_pat = '(?i)' + match_pat editor.research(match_pat, lambda m: on_match(m, ctr, ignorecase)) if CURRENT_WORD_ONLY_IF_IN_TEXT: if ignorecase: upword = word.upper() if upword in ctr: if ctr[upword] > 1: # word earlier in text, move to front ctr[upword] = 10_000_000_000 else: del ctr[upword] # word not in text, remove elif word in ctr: if ctr[word] > 1: ctr[word] = 10_000_000_000 else: del ctr[word] autocomp = sorted(ctr, key = lambda x: ctr[x], reverse=True) autocomp_str = ' '.join(autocomp) editor.autoCShow(word_length, autocomp_str) if __name__ == '__main__': try: CALLBACK_ADDED except NameError: CALLBACK_ADDED = 1 editor.callback(onCharInsert, [SCINTILLANOTIFICATION.CHARADDED])
  • Add Setting in Preferences | Searching

    Moved
    2
    0 Votes
    2 Posts
    413 Views
    PeterJonesP

    @Rick-Welwood

    Could you please add a new setting

    This is a Community of Notepad++ users. We cannot change the codebase here. See “FAQ: Feature Request”

    ☐ Show Incremental Search at program startup

    It’s not a bad idea, but since Notepad++ remembers a bunch of toggles in the View menu, I’d probably just prefer that Notepad++ just remember whether or not you have Search > Incremental Search active (like it does for remembering the current state of View > Show Symbol > xxx or other View menu toggles).

    ☐ Incremental Search bar … Match Word

    Also a good idea.

    could you get a version working on Linux

    That’s been made pretty clear: https://github.com/notepad-plus-plus/notepad-plus-plus/wiki/FAQ#support-for-systems-other-than-the-ms-windows-family

  • Greek encoding

    2
    0 Votes
    2 Posts
    862 Views
    Denis DenisD

    Finally worked after enabled directwrite.

  • Changing the color of a letter in user defined language

    2
    0 Votes
    2 Posts
    284 Views
    PeterJonesP

    @Put-Up

    I want to change the color of the letters X, Y, and Z (each a different new color).

    Then put them into three different keyword lists, and set a different color for each. It looks like you’re not using keywords 5, 6, 7, or 8, so you’ve got four keyword sets remaining, and have three terms that you want in three different colors. It seems like a natural fit to put X in Keywords 5, Y in Keywords 6, and Z in Keywords 7.

  • [SOLVED] Selected lines do not get indented with TAB for me

    1
    2 Votes
    1 Posts
    199 Views
    No one has replied
  • Languages: Formatting rest of line after keyword

    4
    0 Votes
    4 Posts
    391 Views
    PigankleP

    @PeterJones That’s very helpful - thank you!

  • Selecting things of a certain type

    3
    0 Votes
    3 Posts
    8k Views
    Mark OlsonM

    Find/replace (?-si)(?::\s*"|(?<!%)%\d*[dsf]|(?!\A)\G)\K((?:(?!(?:(?<!%)%\d*[dsf]|")).)*) with \U\1\E.

    Note that this won’t actually convert all your text to upper-case, because some of it (the %s format specifiers) will probably cause bugs downstream if it is capitalized. This regex is very careful to avoid capitalizing format specifiers, which is a lot of why it looks (and is, TBH) so hairy.

    My regex doesn’t handle all the possible syntax surrounding format specifiers, because I don’t have 3 hours to spend enumerating and debugging each weird edge case, but it should be fine assuming that all the strings are values in dictionaries. The find-regex becomes the absolutely abhorrent (?-si)(?:"|(?<!%)%\d*[dsf]|(?!\A)\G)\K(?=[^"]*"\s*[,\]\}])((?:(?!(?:(?<!%)%\d*[dsf]|")).)*) in the case where the strings can be strings in arrays or values in dictionaries.

    Test text:

    { "a.b": "caps %02d %5s %d %03fnocaps %%02dcaps", "b.c.d": "%%caps %3sap %s cap" }

    Expected output:

    { "a.b": "CAPS %02d %5s %d %03fNOCAPS %%02DCAPS", "B.C.D": "%%CAPS %3sAP %s CAP" }

    If you’re absolutely sure you want to capitalize everything that’s not a key, just use this much simpler regex-replace: "\s*:\s*"[^"]*"

  • Help with finding prefixes & selecting entire string

    3
    0 Votes
    3 Posts
    346 Views
    Pool StripP

    Terry-R said in Help with finding prefixes & selecting entire string:

    @Miska-Virtanen said in Help with finding prefixes & selecting entire string:

    If I wanted to find all the strings starting with “bb_”, and highlight & replace the entire string, up until the next comma.

    That can be done simply with a regular expression (regex). Using the Replace function you would have
    Find What:\bbb_[^,]+
    Replace With:ZZZ
    Search mode must be set to regular expression.

    It didn’t sound as if it was only at the start of a line, hence my regex will look for that sequence in any “cell”. If this isn’t what you actually wanted you will need to elaborate.

    Terry

    Thanks.

  • Find duplicate variable declaration Regex

    5
    0 Votes
    5 Posts
    697 Views
    Stuart DyerS

    Thanks @Mark-Olson / @guy038

    Both solutions work a treat !

    Appreciate the fast turn around

  • Find specific character in a specific word

    2
    0 Votes
    2 Posts
    238 Views
    Lycan ThropeL

    @Anxo-Alvarez ,

    Why?
    I feel there’s a, “well now I want to do this, and also this” coming, so why don’t you just layout the full issue you’re thinking of doing, and let’s go from there, but in the meantime, check out the FAQ section in the Forums, particularly:

    FAQ Desk: Formatting Forum Posts
    FAQ Desk: Generic Regular Expression (regex) Formulas
    FAQ Desk: Where to find REGular EXpressions (RegEx) documentation ?

  • Macro's stopped working

    3
    0 Votes
    3 Posts
    487 Views
    wonkawillyW

    With the new version of Npp 853 the macro system has been updated: now supports Unicode chars too. So it is needed to update your macro to these new standards to make them work again. The FAQ section indicated by the previous poster will help you to do that.

  • Find Replace <filename000> with <filename001>

    9
    0 Votes
    9 Posts
    470 Views
    guy038G

    Hello, @reddreddyredd, @mark-olson, @terry-r, @lycan-thrope, @coises and All,

    @reddreddyredd, I know that you already reached your goal, with all the advices given in the previous posts, but here is an alternate method :

    Move the caret at the beginning of your first string fire_smoke_multi000

    Automatically, place any instance of fire_smoke_multi000 at the very beginning of lines with the following regex S/R :

    SEARCH \R(?!fire_smoke_multi000)

    REPLACE #

    Do a 120 × 3 rectangular selection of the string 000

    Open the **Column Editor ( ALT + C ) and replace this selection with the appropriate numbering

    Finally, replace any # character with a line-break, with the regex S/R :

    SEARCH #

    REPLACE \r\n    OR    \n ( for an UNIX file )

    Best Regards,

    guy038

  • fix html code with regex

    2
    0 Votes
    2 Posts
    318 Views
    PeterJonesP

    @Giannis-Katebakis ,

    FAQ
    => Generic Regular Expression (regex) Formulas
    => Replacing in a specific zone of text

    The “zone” you want starts with <p (BSR) and ends with </p> (ESR). You want to find newlines using FR=\R in that zone, and replace with a space character as the RR .

    Actually, since your lines are also indented, then FR should probably be \s+ – which would collapse one or more whitespace inside the tags (whether spaces or tabs or newlines or unicode whitespace) into a single space each).

    When I replace each of the bolded BSR/ESR/FR/RR with the values I listed, and did a Replace All, it converted

    <p align="justify" >The captain and the crew were taking care of the last details when someone remembered that there was no ice in the boat, nor the necessary amount of beer. A volunteer was found and he rushed to buy all that was needed. Soon he was back with a big bag full of ice and a dozen beers and other refreshments.</p> <p align="justify" >The captain decided that everything was ready and we should board the boat and sail. Five minutes later we watched the little harbour getting smaller and smaller. The trip to Ayiofarango had just started.</p>

    to

    <p align="justify" >The captain and the crew were taking care of the last details when someone remembered that there was no ice in the boat, nor the necessary amount of beer. A volunteer was found and he rushed to buy all that was needed. Soon he was back with a big bag full of ice and a dozen beers and other refreshments.</p> <p align="justify" >The captain decided that everything was ready and we should board the boat and sail. Five minutes later we watched the little harbour getting smaller and smaller. The trip to Ayiofarango had just started.</p>
  • sort failure

    3
    0 Votes
    3 Posts
    246 Views
    mkupperM

    @Bernard I’m guessing there is an invisible character at the start of the 4th to last lines that is causing them to be sorted after the first three lines.

    Try clicking on the blue pilcrow (¶) for Show All Characters in the toolbar to see if things such as ZWSP, ZWNJ, or ZWJ show up. They will have a white letters with a black background.

    Another guess is that the file you are editing is marked as read-only. The sort function will do nothing on read-only files. If you right click on the tab for that file see if there is a checkmark to the left of the word “read only” in the right click menu. If so, select that menu option and it’ll turn the read-only mode off.