• Modify autocomplete options

    5
    1 Votes
    5 Posts
    337 Views
    Hiker GuyH

    @Mark-Olson
    Wasn’t aware of the plugin. Thanks for letting me know. Got it installed and configured now.

    Thanks!

  • Search and replace with increasing interger

    5
    1 Votes
    5 Posts
    265 Views
    PeterJonesP

    @Coises ,

    Fixed. In the future, you could just chat-message the FAQ author (in this case, me).

  • Creating two columns from two files via copy-paste?

    9
    0 Votes
    9 Posts
    2k Views
    Mark OlsonM

    @YutMarma
    I bet that syntax error comes from you using PythonScript 2, which very out-of-date version that’s still on the plugin list. I recommend upgrading to PythonScript 3, but in case you don’t have time for that, it’s pretty easy to make this script compatible with Python 2:

    ''' Uses PythonScript v3.0.16 or higher: https://github.com/bruderstein/PythonScript/releases First referenced in this Notepad++ community discussion: https://community.notepad-plus-plus.org/topic/25950/creating-two-columns-from-two-files-via-copy-paste == SUMMARY == This script can paste together any number of files line-by-line. == EXAMPLE == For example, if you have the following files: ---------------- ---------------- file A line 1 of file A line 2 of file A line 3 of file A ---------------- file B line 1 of file B line 2 of file B ---------------- file C line 1 of file C line 2 of file C line 3 of file C ---------------- ---------------- and you entered this into the first dialog: [ 3] file A [2 ] file B [1 ] file C and you clicked Yes for the second prompt and you entered FOOBAR into the third dialog and you clicked Yes for the fourth prompt you would get a new buffer opened with the following text: line 1 of file CFOOBARline 1 of file BFOOBARline 1 of file A line 2 of file CFOOBARline 2 of file BFOOBARline 2 of file A == NOTES == This script does basic data validation. Specifically, if the files you wanted to paste together have different numbers of lines, final file will have as many lines as the file with the fewest lines, assuming you click Yes on the dialog that notifies you of this. I intentionally did not provide an option for the final file to include lines from files that are longer than the shortest file, because the result could be confusing or ambiguous. ''' from Npp import editor, notepad import re def pl1of2al1of1(): all_filenames = [x[0] for x in notepad.getFiles()] if len(all_filenames) < 2: notepad.messageBox("only one file is open, so this script can't work") return # find the user's preferences print(all_filenames) selected_files = [] while True: txt = notepad.prompt(("Put a whole number in the box for each file you want to combine, or hit Cancel to exit.\r\n" "The numbers determine the order in which the lines of each file are pasted."), 'Select files to combine', '\r\n'.join('[ ] ' + fname for fname in all_filenames)) if txt is None: return selected_file_text = re.findall(r'^ *\[ *([+-]?\d+) *\] *(\S[^\r\n]*?) *\r?$', txt, re.MULTILINE) print(selected_file_text) if len(selected_file_text) < 2: notepad.messageBox('You must put whole numbers in the boxes for at least two files') continue selected_nums = set(int(x[0]) for x in selected_file_text) if len(selected_nums) < len(selected_file_text): notepad.messageBox('Each chosen file must have a distinct number') continue selected_files = [x[1].strip() for x in sorted(selected_file_text, key=lambda x: int(x[0]))] if not all(file in all_filenames for file in selected_files): notepad.messageBox('You accidentally changed the name of a file you selected. Make sure not to enter any text, other than putting numbers in the boxes.') continue if notepad.messageBox(('The n^th line of the combined file will have the n^th lines of each of the chosen files in the order shown:\r\n' + '\r\n'.join(selected_files) + '\r\n---------------\r\n' + 'Is that what you want?'), 'confirm files and order', MESSAGEBOXFLAGS.YESNO ) == MESSAGEBOXFLAGS.RESULTYES: break sep_str = notepad.prompt('Enter some buffer text to put between the n^th line of file N and the n^th line of file N+1', 'Enter buffer text', '') if sep_str is None: return # get the text lines_by_file = [] eol = '\r\n' previously_opened_file = notepad.getCurrentFilename() for file in selected_files: notepad.open(file) eol = ['\r\n', '\r', '\n'][editor.getEOLMode()] lines_by_file.append(editor.getText().splitlines()) notepad.open(previously_opened_file) # combine the text all_nlines = [len(x) for x in lines_by_file] min_nlines = min(all_nlines) if len(set(all_nlines)) != 1: if notepad.messageBox(('Not all files have the same number of lines.\r\n' + 'As a result, all lines past line {0} will be cut off.\r\n' + 'Yes: Trim off all the extra lines.\r\n' + 'No: Cancel the operation.').format(min_nlines + 1), 'Choose what to do with extra lines', MESSAGEBOXFLAGS.YESNO ) == MESSAGEBOXFLAGS.RESULTNO: return combined_text = eol.join( sep_str.join(lines[ii] for lines in lines_by_file) for ii in range(min_nlines) ) notepad.new() editor.setText(combined_text) if __name__ == '__main__': pl1of2al1of1()
  • Any way to display the color represented by its code (like #CC90A0)

    7
    0 Votes
    7 Posts
    372 Views
    Terry WysockiT

    @PeterJones Perfect! I didn’t initially see that the underlines were colored appropriately. This double-click gives me exactly what I wanted. Thanks!

  • npp v8.6 reverses the order of lines on column copy/paste

    21
    1 Votes
    21 Posts
    3k Views
    CoisesC

    @Theo-Pavloudis said in npp v8.6 reverses the order of lines on column copy/paste:

    @Alan-Kilborn @mkupper it’s still there in 8.6.8 either with Column Selection to Multi-Editing on or off.

    This was fixed in 8.6.9 (item 13 in the announcement).

  • String search functionality

    3
    0 Votes
    3 Posts
    208 Views
    D

    @PeterJones many thanks, this particular task involves 400,000 rows of data so the search results window is helpful to group the results, but is not used by the incremental search. My use of npp++ for this task is a bit off-piste as it more a database task, Excel would be my normal choice but it is slow when the range is this large.
    Will continue using the existing facilities.
    Thanks again
    Duncan

  • Auto/silent updating worked yesterday, but not today

    5
    0 Votes
    5 Posts
    568 Views
    T

    @PeterJones Thank you for clarifying the differences. I was not aware. In this case, I am just watching to logs. I solved the issue by going to View, Monitoring (tail-f).

  • Match consecutive lines that start with the same word

    5
    2 Votes
    5 Posts
    732 Views
    Ross BrownR

    @PeterJones Thanks Peter
    Noted and thanks for the helpful links.

  • 0 Votes
    5 Posts
    236 Views
    D

    @PeterJones
    Thanks for suggestion.
    However, I use an unusual windows version that only remain a ADMINISTRATOR account, many functions was striked out, like switching accounts.
    Thus, NP++ just can only run as a super administrator.
    My old Laptop just can’t carry newer windows’ softwares

  • Search&Replace certain string text, and replace/remove it

    4
    0 Votes
    4 Posts
    287 Views
    PeterJonesP

    @Joc-Bedenčič ,

    FIND WHAT = ABC.*DEFGH
    REPLACE WITH = ABCDEFGH
    SEARCH MODE = Regular Expression
    uncheck “dot matches newline”

    … and you really need to read and understand at least the Template for Search/Replace Questions from my list of useful references.

  • Notepad++ minimal (7.9.5 64bit) just can't remember plugins' settings

    4
    0 Votes
    4 Posts
    314 Views
    D

    @Mark-Olson I just create a dir called config under the plugins folder, and then it remembers the settings, thank you again

  • Importing a picture file in Notepad++

    2
    0 Votes
    2 Posts
    197 Views
  • Finding a value in one line and prepending it to the next line

    3
    0 Votes
    3 Posts
    196 Views
    MaximillianMM

    @Coises said in Finding a value in one line and prepending it to the next line:

    (00:05:[^\r\n]+[\r\n]+)

    Thanks so much!

  • Poor Man's T-SQL Formatter compatibility issue

    5
    0 Votes
    5 Posts
    5k Views
    PeterJonesP

    @Thomas-Korosa said in Poor Man's T-SQL Formatter compatibility issue:

    Can anybody please remove that plugin from the supported list? It’s basically malware at this point!

    Not from this Forum, we cannot; here, we are just fellow users. There are two ways that such a request would have a chance: either go to the main application issue list or maybe the Plugin List repo , and create a request. The two ways I would guess they might take care of it: either in the application itself, they could trigger the logic that would move it to the “disabled” subfolder, or they could just remove it from the Plugin List.

    “remove this plugin from np++”

    Unfortunately, for whatever reason, the author has never gotten “remove a plugin” to work as reliably as “install a plugin”

    It’s not listed in plugins or in the folder,

    I’d be really surprised if it’s not listed in the folder. Could you share your ?-menu’s Debug Info, and a recursive directory listing of c:\program files\notepad++\ (or wherever Notepad++ is installed) – if you do that, we can tell you where to go to delete the plugin.

    tryinf to add or remove it does not change anything.

    This statement seems to contradict your statement that it’s not listed in Plugins Admin, because you cannot “try to remove it” if it’s not there. But maybe I’ve misunderstood something.

    And if the plugin really is gone from the Notepad++ hierarchy, then whatever is triggering the .NET request is somewhere other than the Notepad++ hierarchy. Maybe that plugin installed some component somewhere else. In general, that’s not considered “polite” of plugins, but that doesn’t mean they cannot, especially if they need an external executable to be able to perform their function. I don’t remember the details of my experiments from three years ago, but if I had noticed it install an executable somewhere else, I think I would have noticed it.

    It seems I will have to do a complete reinstall of notepad++ to get rid of this thing.

    If such a thing worked, then it would have been equally as effective to manually delete its folder; and if there is some external trigger that it’s set off, re-installing Notepad++ won’t work. I highly recommend sharing the info I requested a few paragraphs up in this post before trying to fully re-install.

  • How to start Notepad++ with a clean slate?

    3
    0 Votes
    3 Posts
    320 Views
    M

    @Coises

    Brilliant. I don’t know how I missed that.

    Many thanks.

    Mike

  • how to automatically make a numbered list

    4
    0 Votes
    4 Posts
    2k Views
    Ibraheem raadI

    @PeterJones ok, thx for clearing things up

  • Diff attributes new line to the wrong line.

    3
    0 Votes
    3 Posts
    228 Views
    Alan KilbornA

    @mkupper said:

    I’ll need to think about Notepad++'s result and why the author of Notepad+++ did not mark both lines as modified.

    You’ll probably want to think about why the authors of Scintilla did what they did, instead.

    IMO this (the whole topic) may not be worth a lot of pondering.

    I positioned the text cursor or caret in the middle of line of text and pressed Enter which split the line. Notepad++ marked the first part of the line as “modified” but not the latter part of the line that is now below the first part.

    One (of probably several) rationalizations for this:

    the original line is marked modified as something (line-ending) was inserted into it the inserted line is “entirely new” and hasn’t been modified yet
  • Script issue not showing in Notepad++

    2
    0 Votes
    2 Posts
    216 Views
    PeterJonesP

    @Dr-Sylvain-J-R-Garceau-Bergeron ,

    I am going to assume that you don’t actually type RUN $(FULL_CURRENT_PATH) into the Run dialog, because that’s obviously not what you’d type at a command line to get it to work – because python is the name of the interpreter, not run …

    When I do Run > Run… > python "$(FULL_CURRENT_PATH)" , it does exactly what I’d expect with your code: it opens the cmd.exe window, prompts for the inputs, then prompts to press any key to continue, then closes after it has cleared the screen.

    (Note: I use quotes around the $(FULL_CURRENT_PATH) so that the whole path will be passed to python, even if there is a space somewhere in the directory or filename)

  • Percentage Calculator

    5
    2 Votes
    5 Posts
    581 Views
    CoisesC

    @Alan-Kilborn said in Percentage Calculator:

    Can this be tied to a shortcut keycombo?

    Not really, since it’s a dialog-based function; but the dialog is non-modal, so you can leave it open while working. I suppose it would be possible to use the dialog accelerator keys while the dialog retains focus, but that would be more clumsy than just using the mouse, I think.

    The PythonScript solution you suggested is probably superior if you want to manually select instances to convert rather than do a batch, either by column or by regular expression.

    Can the number of decimal digits be controlled?

    Yes. That’s described in the help for Formulas. The short version is that you enter it like this:
    (?=format:formula)
    where the format gives the minimum number of integer digits, and if decimals are wanted, a decimal point and the number of decimal places to be shown. Specifics are given in the help, but as examples, you could use:
    (?=6:reg(1)*.9)
    if you wanted leading zeros to make a minimum of six digits, and no decimals; or:
    (?=2.3:reg(1)*.9)
    if you wanted always at least two digits to the left of the decimal point and exactly three digits to the right; or:
    (?=0.-4:reg(1)*.9)
    if you wanted up to four digits after the decimal point but with trailing zeros suppressed, no decimal point if there are no non-zero digits after the decimal point, and no zero before the decimal point when the integer portion is zero and the decimal portion is not zero.

    The default when using just (?=formula) is (?=1.-6:formula), meaning up to six decimals, suppress trailing zeros, suppress decimal separator if nothing follows, no leading zeros except that at least one digit is required before the decimal point, even if it is a zero.

  • I need to reach the administrator forum please

    2
    0 Votes
    2 Posts
    164 Views
    PeterJonesP

    @Fire-Panda ,

    I’ve sent you a private message. Feel free to reply there with details of what help you need.