• Language not being saved with file

    Locked
    2
    0 Votes
    2 Posts
    2k Views
    PeterJonesP

    NPP does not save a per-file language-lexer choice. The lexer used is determined by the extension lists in the settings for each Language > Define your language... > Ext : (for a given User Defined Language, UDL), and in the Settings > Style Configurator > User ext. and Default ext. (for a given Language lexer).

    A User ext. in the Configurator or an Ext. : in the UDL settings will override a Default ext.. If an extension isn’t found in the user extensions or UDL extensions, NPP will search the default extension lists, and hand the file off to the appropriate lexer, if found. If an extension isn’t in any of the lists, then it will be handled as a Normal text file.

    So, if you’ve set Ext. : = txt in the User-Defined Language AutoHotKey, then NPP will use the AutoHotKey UDL for the highlighting whenever you open a .txt file, rather than going thru the list of priorities down to the Normal text.

    If you don’t want NPP to apply the AutoHotKey formatting to .txt files, you have to make sure that you remove txt from the User-Defined Language settings for the AutoHotKey (and any other user-defined language or style-configurator language).

    If you want NPP to apply AutoHotKey to some .txt files, but Normal Text to others, that’s more than NPP is programmed to do. You will have to toggle some of the .txt files manually; or you might be able to figure out a way to program a PythonScript or LuaScript to recognize the specific content when a .txt file is opened, and to have the script tell NPP to either use the AutoHotKey highlighting or Normal Text…) Notepad++'s expectation is that files that want different highlighting will have different extensions (so maybe choose .ahk for AutoHotKey files – though, since I don’t know how AHK works, I don’t know if it has a default file extension, or whether it doesn’t care, or whether it only accepts .txt files).

  • php additional syntax highlighting

    Locked
    2
    0 Votes
    2 Posts
    1k Views
    PeterJonesP

    What categories there are available for a given language are defined by that language’s lexer; unfortunately, you cannot add new categories. (Well, like you saw, you can add anything you like to stylers.xml… but if the php lexer isn’t programmed to match words in that category, and to pass on the category to scintilla to mark it with a particular style, nothing will happen.)

    Many of the languages allow adding new keywords to a given category; in php, if you wait long enough on the WORD style, it pops up the default and user-defined keyword lists, so you could add words to that category – however, I don’t see that it’s implemented any other styles of keywords.

    So, with the builtin lexer, I don’t think you’re going to be able to add a separate style/category of keywords, sorry.

    You might be able to come up with a UDL to highlight the words as you desire (but UDL highlighting often falls short in areas that the custom lexers excel in, so you may have to give up something in order to get the two different categories of keywords).

  • I need help trying to run Python in Notepad++

    Locked
    1
    0 Votes
    1 Posts
    895 Views
    No one has replied
  • Quick delete/replace of lines in GPX/TCX file ?

    Locked
    4
    0 Votes
    4 Posts
    1k Views
    Terry RT

    Sorry, I need to revise slightly my previous answer. If you follow that solution you will finish with 2 lines combined. I’ve actually considered a slightly better answer.

    Find: (\R)\R+
    Replace: \1

    What this does is find the first CR/LF (you may need to replace \R with the correct CR/LF character your file has). Then there has to be 1 or more additional CR/LF characters. We only keep the first CR/LF character, removing all others. This will cater for situation of multiple empty lines together, as \R+ greedily consumes as many CR/LF characters as possible.

    I have to ask the question though, is the line truly empty or does it have 1 or more spaces in it? Spaces will require a different expression. If spaces then:
    Find: (\R)\h*\R+
    Replace: \1
    The caveat here is that \h refers to both a horizontal space, a tab and a line feed. Depending on the character set used a \h might also refer to part of your CR/LF. If so then replacing \h with \s might fix it.

    Terry

  • 0 Votes
    5 Posts
    2k Views
    Dillon EthierD

    Thank you very much! This is an adequate solution.

  • Search/Replace after ignored string

    Locked
    2
    0 Votes
    2 Posts
    823 Views
    Felixx61F

    Solved, please disregard

  • 0 Votes
    2 Posts
    886 Views
    Fade To-GrayF

    My bad - I failed to copy over the global.xml file :-/

  • regex: compare lines and find out different numbers

    11
    1 Votes
    11 Posts
    3k Views
    Vasile CarausV

    thanks guy, your solution is ok, but complex. I just found another solution.

    <li><a href=".*\.html" title=".*">.* (?:(?!\b(22|9|15|23|4|15)\b).)*<\/a><\/li>$

    Check this out: https://regex101.com/r/vRXKWj/4/

  • TextFX doesn't work

    12
    3 Votes
    12 Posts
    6k Views
    guy038G

    Hi, @Scott-sumner

    I do not understand what you mean ?

    I did added the part :

    separator = notepad.prompt('Enter the separator string, between columns:', ps_name, ',') if separator == None or len(result) == 0: return

    and I changed the lines :

    line = delimiter.join(new_interdelimiter_list) else: line = delimiter.join(old_interdelimiter_list)

    as :

    line = separator.join(new_interdelimiter_list) else: line = separator.join(old_interdelimiter_list)

    Not a great task, I agree, but, however, significant… and it works nice ;-))

    BR

    guy038

  • How to remove text between two specified strings using Notepad++?

    Locked
    3
    0 Votes
    3 Posts
    13k Views
    guy038G

    Hello, @pratap-chava and All,

    Regarding your needs, I think that a suitable regex S/R could be :

    SEARCH : (?s-i)^File created by.+?\RMessage log.+?$\R

    REPLACE Leave Empty

    Don’t forget to select the Regular expresion search mode and to tick the Wrap-around option

    Notes :

    At beginning of the regex, the modifiers (?s-i) mean that :

    The . dot regex character will match any single character ( Standard and EOL chars )

    The search is performed in a sensitive way. If you prefer insensitive matches just change that part with (?si) !

    Then the part File created by.+?\RMessage log looks, from beginning ( ^ ) of line, for any text, beginning with File created by and ending at the first expression Message log, preceded by a line-break ( \R )

    Now, the final part .*?$\R tries to match a range of any character, ending at the nearest end of line ( $ ), and followed with a line-break ( \R )

    And, due to the empty replacement zone, all that block of text is, then, simply deleted !

    Cheers,

    guy038

  • Keep “Remember current session” AND prompt to save unsaved files?

    Locked
    5
    0 Votes
    5 Posts
    6k Views
    Scott SumnerS

    @Matt-McDowall

    Suggestion: Consider the TakeNotes plugin.

  • Search/Replace of Multiline Text Blocs

    6
    0 Votes
    6 Posts
    20k Views
    Scott SumnerS

    @James-Faction said:

    but it wasn’t very intuitive

    So what are your ideas for making it more intuitive?

    line breaks should be handled by copy/paste to make the find and replace function vastly more useful

    What does this mean?

    We want to help but first we have to understand…

  • I don't see the highlighting for PHP, HTML,

    Locked
    8
    0 Votes
    8 Posts
    7k Views
    Jelle RubenJ

    @Mikhail-V Who thanks that was the Issue
    @PeterJones You also thanks for your help…

  • Replace the math expression with the calculated result

    Locked
    2
    0 Votes
    2 Posts
    3k Views
    PeterJonesP

    There’s also a plugin for Notepad++ called MathPad, which can be installed via the Plugin Manager, with more info at it’s homepage. I don’t know whether it will meet your needs, but it’s something to look into.

    Here is me helping you write the script: study the VBScript and/or PowerShell script at the SuperUser question you linked. Tweak it, and see how those changes affect the results. Experiment until it no longer requires the quote marks. Continue experimenting until it does everything you want it to. If you have shown some effort, but still cannot get it to work, ask a question in an appropriate forum, where the topic is about the scripting language you are using (SuperUser/StackOverflow might be a good location).

    Some here would be able to use the PythonScript plugin to automate those calculations inside Notepad++. Others might suggest skipping the middle-man: if you have a file with 14000 instances, it might be simpler to run it through an offline script, which could be written in VBA, Python, Lua, Perl, or your favorite scripting language. But it might take a few hours to write something: and that brings me to my last point:

    But if by “help me to write a script” you mean, “write a script for me”, then you’ve come to the wrong place. It sounds like you’re asking for custom coding services, which will likely cost you something. Good luck in presenting the question, as framed (ie, without showing any effort of your own), in any coding forum and getting the exact script you want.

  • Launch in Administrator mode not reopen edited file but original file

    8
    1 Votes
    8 Posts
    3k Views
    Sauro DellapittimaS

    Hello.
    Excuse me all for late (I’m absent in that period).

    Thanks, many thanks @Claudia-Frank, you are right.
    "Settings->Preferences->Backup->Enable session snapshot and periodic backup " wasn’t enabled where the problem exist.
    Activated this option, the problem is solved.

    Renew thanks.
    Cheers
    Sauro

  • How to completely turn off auto-complete.

    4
    1 Votes
    4 Posts
    2k Views
    Guillaume LaHayeG

    Although from time to time (especially after upgrades), I’ve noticed Auto-Completion gets re-enabled automatically. :(

  • URL to always download the current version of software

    3
    0 Votes
    3 Posts
    1k Views
    J TamJ
    The keeper of the repository could add a DOS JUNCTION (junction.exe) or a *nix symbolic link (ln -s) named LATEST_VERSION in the top level directory of the “repository/” host. Have you thought about writing code and submitting it? You could get the all-versions.html file, and parse it for the regexp: “Current Version”, then parse the line(s) the expression occurs on. This yields the canonical versionNumber. Now back-substitute this into the standard download URI and Robert is your aunt’s brother.
  • File-Open dialog not showing all files/folders

    Locked
    4
    1 Votes
    4 Posts
    2k Views
    PeterJonesP

    @Brian-Phillips,

    As it says on the File System Redirector page that ++@Scott-Sumner linked, “32-bit applications can access the native system directory by substituting %windir%\Sysnative”, so if you are using 32-bit Notepad++, and want to edit a file in the OS’s 64-bit system32\Drivers directory, you can browse to %windir%\Sysnative\Drivers or c:\windows\sysnative\Drivers (you can paste that in the File name box, or in the path-box at the top, if you’ve got that displayed), and it will be the files you expected.

  • Can I make NotePad++ auto-replace a string?

    Locked
    3
    0 Votes
    3 Posts
    2k Views
    Scott SumnerS

    @Henry-Vistbacka

    As @Mikhail-V suggests, you could do such a thing if you are willing to install and use the PythonScript plugin. Maybe there are other ways as well, but all would involve installing something extra, so why not the PS plugin? :-)

    Here’s some quick sample PS code, modify/experiment/enhance as you like:

    search_text = '--' replacement_text = 'en-dash' # <----- this is just placeholder, put what you want here def callback_sci_CHARADDED(args): if chr(args['ch']) == search_text[-1]: cp = editor.getCurrentPos() search_text_length = len(search_text) start_of_search_text_pos = cp - search_text_length if editor.getTextRange(start_of_search_text_pos, cp) == search_text: editor.beginUndoAction() editor.deleteRange(start_of_search_text_pos, search_text_length) editor.insertText(start_of_search_text_pos, replacement_text) editor.endUndoAction() end_of_search_text_pos = start_of_search_text_pos + len(replacement_text) editor.setCurrentPos(end_of_search_text_pos) editor.setSelection(end_of_search_text_pos, end_of_search_text_pos) editor.chooseCaretX() editor.callback(callback_sci_CHARADDED, [SCINTILLANOTIFICATION.CHARADDED])
  • Rename bulk xml tag with current value

    Locked
    1
    0 Votes
    1 Posts
    559 Views
    No one has replied