• xml lost after choosing user language

    2
    0 Votes
    2 Posts
    202 Views
    Terry RT

    @yehuda-levi said in xml lost after choosing user language:

    how to keep it as XML when choosing user language ?

    Notepad++ doesn’t (as far as I know) allow a combination of 2 languages to be selected at the one time, that would be sort of contradictory.

    But I believe a plugin called EnhanceAnyLexer here is where you should be looking. You install it from the Plugins/Plugins Admin menu option. So you would leave XML as the language and use the EnhanceAnyLexer plugin to supplement XML with the additional key words that form your custom language.

    My 2cents worth
    Terry

  • More than one Commen Line type in UDLs?

    3
    0 Votes
    3 Posts
    438 Views
    Sam MarroccoS

    Thank you, Peter.
    Your suggestion does exactly what I needed. Thank you.

  • WIndows 11 Plugins Admin Install Button Disabled

    3
    0 Votes
    3 Posts
    911 Views
    Ben SwansonB

    I appreciate your response and shamefully admit I overlooked the checkboxes. Thank you, Coises , that’s all it was. Plugins are installing juuuuust fine now.

    Hopefully this post doesn’t give false hope to someone seeking help for legitimate Windows 11 issues!

  • 0 Votes
    3 Posts
    371 Views
    Paolo LinxP

    @ Alan-Kilborn

    Wow! I missed your post…
    Thank you so much!

  • Keep custom settings during silent uninstall

    2
    0 Votes
    2 Posts
    392 Views
    Michel GaumontM

    Uninstalling the app was not the better solution in this case.

    I had to make sure NP++ was not running while transitioning to PatchMyPC.

    Afterwards, I had to delete whatever’s left of Chocolatey.

    I’d still be interested to know if there’s a silent option for keeping local profiles ^^

  • Replace random values with 0

    3
    0 Votes
    3 Posts
    304 Views
    Raoul EmilR

    @ Coises You are amazing,thank you very much.

  • Merge 2 Ascii Files in one

    10
    0 Votes
    10 Posts
    2k Views
    Mark OlsonM

    A proposal to clarify posts like this, so that people don’t waste time solving the wrong problem:

    use the word concatenate to refer to the process of taking a bunch of things and adding them one-after-the-other. use the word merge to refer to the process of taking a bunch of things and putting them together so that they overlap.

    For example, the link Doğancan posted above goes to a thread where I made a tool to merge files (examples in that thread).

    What everyone has been discussing above appears concatenation and should be labeled as such.

  • URL to XML Structure

    3
    0 Votes
    3 Posts
    736 Views
    L

    Thanks PeterJones, it worked flawlessly.

    Now I also understand the principle, so I can easily adapt it. You just have to have seen once :-)

    Thanks!

  • XML pretty print not working

    2
    0 Votes
    2 Posts
    1k Views
    gerdb42G

    @Hao Please note the following hints to formatting in this forum. There you can find how to mark text to be inserted literally and thus avoiding to get it mangled by the forum software.

    The CR LF is most likely shown because you have activated the option to show special characters which are normally invisible. Just hit the Pilcrow Symbol (“¶”) in the toolbar to disable.

    In the XMLTools Menu disable the Option “Enable auto Validation” and reload the file. That should prevent the other lines form appearing.

    Your version of Notepad++ is pretty outdated. Maybe you should ask your Admin about possibilities to update.

  • Find and replace across multiple rows

    3
    0 Votes
    3 Posts
    385 Views
    Ricardo GonzalezR

    That worked like a charm. Saved me hours worth of work. Thanks so much, I REALLY appreciate it.

  • Using Notepad++ on hosting

    2
    0 Votes
    2 Posts
    4k Views
    PeterJonesP

    @Саяд-Махмудов said in Using Notepad++ on hosting:

    Hello everyone! Does anybody know how to use notepad++ on hosting using the ssh protocol,

    The plugin NppFTP has the ability to make FTP or FTPS or SFTP (the last of which uses the SSH protocol for doing file transfers), to allow you to edit remote files in Notepad++.

    in order to edit all files on the server at once without downloading them to computer?

    Technically, that won’t happen; in order to be able to use an app on your local machine (ie, Notepad++) to edit a file on a remote machine (at the other end of the SSH/SFTP link), the bytes for the file must come over the network to be at least temporarily on your local machine; the NppFTP plugin will keep a local cache of the remote files, which is technically what is being edited, but every time you save in Notepad++, the NppFTP plugin sends the data back to the remote machine, via SFTP.

  • .TXT filenames don't get passed to NotePad++

    5
    1 Votes
    5 Posts
    390 Views
    afk afkA

    OK!! (maybe)

    You were right. I found the registry entry
    \HKEY_LOCAL_MACHINE\SOFTWARE\Classes\txtfile\shell\open\command
    with the entry
    //“c:\Program Files\NotePad++\NotePad++.exe”
    and added “%1” and it worked first time, every time.
    Thanks very much.
    I tried to upvote your answer but I don’t have enough “reputations”
    Austin Kelly

  • How to highlight using plugin

    2
    0 Votes
    2 Posts
    281 Views
    PeterJonesP

    @Eileen-Ling said in How to highlight using plugin:

    highlight a certain word in red color using enhanceanylexer.

    If by “highlight” you mean “change the background to red” – no, EnhanceAnyLexer only changes foreground.

    If by “highlight”, you mean “change the foreground text color to red”, then yes.

    [LexerOrUdlNameHere] 0x0000FF = hello
  • User Defined Language

    2
    0 Votes
    2 Posts
    245 Views
    PeterJonesP

    @Eileen-Ling ,

    With just the User Defined Language (UDL) syntax, what you want is probably not achievable.

    However, if you install the EnhanceAnyLexer plugin (using Plugins > Admin tool), then you can make sure your file has the right UDL active, then use Plugins > EnhanceAnyLexer > Enhance Current Language to edit the plugin’s config file. You can then define foreground color changes using “0xBBGGRR = regex” pairs.

    32d726da-3676-466c-b50b-0f889bb555b6-image.png

    [udf] ; color each word, 0x66ad1 is the color used, see the description above for more information on the color coding. 0x0080FF = \([^)\\]]*?\) 0x0080FF = \\[[^)\\]]*?\\] 0x00FF80 = \([^)\\]]*?\\] 0x00FF80 = \\[[^)\\]]*?\) ; check in the respective styler xml if the following IDs are valid excluded_styles = 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,20,21,22,23

    In my example, I defined four regular expressions: two will match the balanced [...] and (...); the other two match the imbalanced [...) and (...]

    If you don’t want it to match multiline, change each of those four regex to have \r\n right after the ^, so that it doesn’t look for parenthesized text that spans across newline characters.

    note: mine used [udf] as the header, because I was in an unnamed UDL. If you follow my instructions above, yours will have [YourUdlNameHere] instead.

  • Default User Defined Language ?

    7
    0 Votes
    7 Posts
    3k Views
    Bobbster LobsterB

    Very old thread, but little hack-around I found. Suppose you want .md to be the default extension (and assuming your current default language is “None (Text)”:

    open langs.xml just add the md extension to the “normal” language, i.e. <Language name="normal" ext="md txt"/>

    Now md will be the default extension!

    By the way thanks @PeterJones for your md UDL!

  • Change Autocomplete background color

    14
    0 Votes
    14 Posts
    2k Views
    Mark OlsonM

    This is kind of necroposting, but I just wanted to share a PythonScript script I made that hopefully makes it reasonably easy to improve the contrast of the autocompletion list selected line.

    # https://community.notepad-plus-plus.org/topic/20320/change-autocomplete-background-color/13 from __future__ import print_function from Npp import * def caret_line_and_selection_back(): ''' WORDSTYLESUPDATED notifications don't give anything like style names when they fire so we identify each style by a tuple of (caret line back, selection back) which is hopefully unique to that style. ''' return (editor.getElementColour(ELEMENT.CARET_LINE_BACK), editor.getElementColour(ELEMENT.SELECTION_BACK)) class ALSMCT(object): def __init__(self): self.off = False self.style_list_defaults = {} def reset_autocomp_list_colors(self): caret_selback = caret_line_and_selection_back() list_defaults = self.style_list_defaults.get(caret_selback) if list_defaults and 'back' in list_defaults and 'fore' in list_defaults: list_default_fore = list_defaults['fore'] print('resettting autocompletion list fore to style default %s' % (list_default_fore,)) editor.setElementColour(ELEMENT.LIST_SELECTED, list_defaults['fore']) list_default_back = list_defaults['back'] print('resettting autocompletion list back to style default %s' % (list_default_back,)) editor.setElementColour(ELEMENT.LIST_SELECTED_BACK, list_defaults['back']) else: # couldn't find current style, so just use global defaults print('resetting autocompletion list colors to global defaults') editor.resetElementColour(ELEMENT.LIST_SELECTED) editor.resetElementColour(ELEMENT.LIST_SELECTED_BACK) def on_wordstyles_updated(self, notif): # map current (caret line back, selection back) (which this script doesn't change) # to LIST_SELECTED and LIST_SELECTED_BACK (which it does change) # that way we can later restore the defaults for the current lexer. # Note that editor.resetElementColour just resets to global defaults # NOT the default for the current style caret_selback = caret_line_and_selection_back() list_selected_defaults = { 'fore': editor.getElementColour(ELEMENT.LIST_SELECTED), 'back': editor.getElementColour(ELEMENT.LIST_SELECTED_BACK) } self.style_list_defaults.setdefault(caret_selback, list_selected_defaults) print('default autocompletion list style is %s when caret line back is %s and selection back is %s' % (*caret_selback, list_selected_defaults)) # now change the list styles to caret line styles (if not ALSMCT_OFF) self.on_bufferactivated(notif) def on_bufferactivated(self, notif): if self.off: return caret_line_back = editor.getElementColour(ELEMENT.CARET_LINE_BACK) list_fore = editor.getElementColour(ELEMENT.LIST) # match list fore color to caret line fore color as well to avoid low contrast # (since default LIST_SELECTED may be similar to CARET_LINE_BACK) print('setting autocompletion list back color to %s' % (caret_line_back,)) editor.setElementColour(ELEMENT.LIST_SELECTED_BACK, caret_line_back) print('setting autocompletion list fore color to %s' % (list_fore,)) editor.setElementColour(ELEMENT.LIST_SELECTED, list_fore) if __name__ == '__main__': try: alsmct.off = not alsmct.off # running script multiple times toggles it if alsmct.off: alsmct.reset_autocomp_list_colors() else: alsmct.on_bufferactivated({}) except NameError: alsmct = ALSMCT() alsmct.on_wordstyles_updated(1) notepad.callback(alsmct.on_bufferactivated, [NOTIFICATION.BUFFERACTIVATED]) notepad.callback(alsmct.on_wordstyles_updated, [NOTIFICATION.WORDSTYLESUPDATED])

    Running the script changes the autocompletion list style as follows:

    running it an odd number of times (including once) causes the text color for the selected autocompletion line to match the text color for the other autocomp lines, and causes the back color of the selected autocomp line to match the back color of the caret line in the document.
    5d506c34-392c-4ad8-93d9-89975828cb87-image.png running it an even number of times resets the style for the selected autocompletion line restores it to the defaults for the theme.
    4f6af084-acca-46c7-a012-3ae2dbe33f1d-image.png
  • any way to recover my data saved in notepad++ in my previous window

    2
    0 Votes
    2 Posts
    2k Views
    PeterJonesP

    @Anas-Ibrahim ,

    You don’t tell us anything about how you lost that data:

    did you close the tab or close Notepad++ and tell Notepad++ that you didn’t want to save? If so, it did what you told it, and didn’t keep that information anymore did you have an OS crash? if so, then the OS probably stopped letting Notepad++ take action, so Notepad++ may not have been able to save, despite trying to. (Look to see if %AppData%\Notepad++\nppLogNulContentCorruptionIssue.log exists; if so, you might be able to share that with the developers, to help them see if they can improve Notepad++'s behavior to try to overcome aggressive OS crash problems.) did you close a saved file, and just don’t know where it was saved? or did Notepad++ forget that you had that file open-but-saved, and you’ve just forgotten where it was? The File menu’s “Recent Files” section will allow you to re-open recently-closed-files, unless Notepad++ has forgotten those, too

    Unfortunately, while Notepad++ has certain features to try to save unsaved data, and can be made to do more to make true backups by using the backup-on-save feature or the AutoSave plugin – see our FAQ:

    it will describe those features in more detail, so that you can take an active role in taking responsibility for your critical data by setting those to better work with your workflow, hopefully avoiding data loss in the future it gives ideas as to where to look for the current location of backup files, like telling you that the “unsaved data” might be in a file in the %AppData%\Notepad++\backup\ folder it mentions an external file recovery application which may help you recover lost data (though we make no guarantees)

    I’m sorry for your loss.

  • Freezing, slow on (somewhat) large files lately

    4
    0 Votes
    4 Posts
    1k Views
    gstaviG

    @AndersWa said in Freezing, slow on (somewhat) large files lately:

    Just now opening a 1.3 MB XML file, it takes about 20 seconds to open the file and for N++ to become “active” again, after that editing a few elements in the XML and scrolling through it

    Large files and syntax highlighting does not work well together.
    Syntax highlighting is designed for hand crafted files. The highlighting help the writer. It is costly to compute but the cost is unnoticeable on modern CPUs for a few thousands of line.
    Large files are auto generated. The generator does not need syntax highlighting. The cost of highlighting 100 thousand lines and re-highlighting them for every edit is huge.
    Change the language to Normal text (disable highlighting).

  • User Defined Language: what do I do wrong ?

    6
    0 Votes
    6 Posts
    1k Views
    PeterJonesP

    @Hans-Troost said in User Defined Language: what do I do wrong ?:

    My apologies for not reacting to you up to now: I think I did not configure my email-notification correct and I was waiting for email notifications. Sorry, sorry…

    This forum software rarely correctly handles email notifications, even if you think you have them turned on. It’s best just to come back and check for yourself.

    but in the 1st reference the word Intellisense is mentioned but better reading: the implementation is less than that, but at least “Autocomplete”. I will try that again, after this better reading.

    We in the Notepad++ Community Forum have no control over a blog written on some other site; if they are providing misinformation about Notepad++, there’s nothing we can do there. “IntelliSense” is Microsoft’s implementation of “intelligent code completion”, and that trademark is owned by Microsoft. No other company is allowed to use that term for their own product (and any that do are likely to get a trademark infringement lawsuit), and any blogger who uses it as a generic term for auto-completion or even for intelligent code completion has misunderstood what “IntelliSense” is.

    Notepad++ only does auto-completion, it doesn’t have “intelligent code completion” by default (though there are plugins that are being slowly developed which will hopefully allow Notepad++ to connect to LSP servers, which may eventually enable more intelligent code completion). So for now, you have to follow the instructions I linked in order to manually set up a Notepad++ auto-completion file for your M UDL.

    2nd Question: about the position of the M Language (the UDL) in the menu. Is’nt that strange? Anyone of you an idea? Of course I can live with it, I’m just surprised with this behavior.

    I thought that was pretty clearly answered above: no, it’s not strange. All the built-in languages go above the horizontal line in the menu, sorted alphabetically. All user-defined languages (UDL) go below the line. That way, you can tell whether the active language for your file is built-in (if it’s above the line) or a UDL (below the line). It’s done on purpose, and will not be changed.

  • Can't save new files after the update

    7
    0 Votes
    7 Posts
    1k Views
    TBugReporterT

    @Damon-Bush

    No offense meant; I was just pointing out a common mistake that many users make, for the benefit of those that don’t know better. (Also for their benefit: it can seem logical to keep the data files produced by a program alongside the program itself, but it increases the chance of a user altering or removing essential files, which is why Windows tries to prevent this. Of course, an Administrator account can do almost anything - which is why users shouldn’t use Administrator accounts for anything other than administrative tasks.)
    I realize that this is far off topic for this discussion, but I’m sure that a significant percentage of the people reading this in the future will be unaware of what I just wrote.