• Notepad ++ .txt association keeps reverting to Windows Notepad

    2
    0 Votes
    2 Posts
    1k Views
    PeterJonesP

    @Terry-Musser,

    Sorry that’s happening to you. Windows 10 is annoyingly difficult to get stable file associations in. The NPP developers do their best to set the right registry settings, but sometimes there is a buried entry that gets in the way.

    this recent discussion talks some about registry locations that might be interfering with the association attempts – especially my final post. That might give you some pointers where to look next.

  • Notepad and latexml

    2
    0 Votes
    2 Posts
    151 Views
    PeterJonesP

    @Klaus-Lang said in Notepad and latexml:

    Is notepad the culprit?

    A warning, you said “notepad” throughout your question. Notepad is a Microsoft application that ships with Windows OS. Notepad++ is a standalone open-source application that we discuss here. They are two separate applications, despite sharing some letters in the name. If you are really asking about the editor that ships with the Windows OS, then this forum is not the right place for help.

    I doubt that your text editor is the culprit in the above scenerio – firstly, because text editors (whether wimpy ones like MS Notepad, or great and powerful editors like Notepad++) are really good at editing text and asking Windows to save the file to disk. My guess is that your problem lies with your sequence of events, or things aren’t in the state you seem to think they are.

    If you are really using the Notepad++ editor, and you think that the culprit really is the Notepad++ editor, please more fully describe your sequence of events, being careful with the details (like not confusing Notepad with Notepad++) and the exact sequence of events.

  • Keep certain blocks of text

    2
    0 Votes
    2 Posts
    226 Views
    PeterJonesP

    @737simpilot ,

    No plugin, specifically. But I think your goal can be met with the regular expression searching (regex) and bookmarking built into Notepad++.

    It’s hard to tell exactly how bad your text has been mangled by the forum (use the </> button when making your post to make sure the text is treated as plain text, rather than being in forum markdown), which might influence the exact makeup of the regex. But my first guess for a solution, assuming it’s always exactly 8 lines in the match, and that the port always has to say exacty 53/tcp open cwmp on the eighth line.

    Search > Mark FIND WHAT = ^Nmap scan report for(.*\R){7}^53/tcp open cwmp start of line, the literal text Nmap scan report for, followed by 7 instances of anything up to the newline sequence, followed by exactly 53/tcp open cwmp Search Mode = regular expression enable ☑ Bookmark Line click Clear all marks if you already have previous bookmarks that you want to get rid of click Mark All

    What you do next depends on what you want to do with the matching data.

    If you want all the matching data in the Windows clipboard to paste somewhere else, Copy Marked Text in the dialog, and paste it wherever you want If you want to delete everything that’s not a matching section, then go to the Search menu, then the Bookmark > submenu, and Remove Unbookmarked Lines That **Search > Bookmark > ** submenu has many other options for manipulating the bookmarked

    For more info on bookmarking, see https://npp-user-manual.org/docs/searching/#highlighting-and-bookmarking

    Example Data (using the formatting hint from above, also mentioned in the footnote at the bottom):

    Nmap scan report for such*such.net (12.3.4) Host is up (0.14s latency). PORT STATE SERVICE 53/tcp filtered cwmp Nmap scan report for such&such.com (4.3.2.1) Host is up (0.14s latency). PORT STATE SERVICE 53/tcp open cwmp Nmap scan report for such*such.net (12.3.4) Host is up (0.14s latency). PORT STATE SERVICE 53/tcp filtered cwmp Nmap scan report for such&such.com (4.3.2.1) Host is up (0.14s latency). PORT STATE SERVICE 53/tcp closed so don't match Nmap scan report for such*such.net (12.3.4) Host is up (0.14s latency). PORT STATE SERVICE 53/tcp filtered cwmp Nmap scan report for such&such.com (4.3.2.1) Host is up (0.14s latency). PORT STATE SERVICE 53/tcp open cwmp

    In this example, I believe you want the first 8 lines and the last 8 lines to match, but not the center 8 lines.
    For me, it does match:
    a660329c-6fae-4a36-aa2d-6bdceab16033-image.png

    If this isn’t sufficient for you, please follow the advice below and clarify.

    ----

    Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as literal text using the </> toolbar button or manual Markdown syntax. To make regex in red (and so they keep their special characters like *), use backticks, like `^.*?blah.*?\z`. Screenshots can be pasted from the clipboard to your post using Ctrl+V to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get. Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.

  • Link on Html page

    2
    0 Votes
    2 Posts
    135 Views
    PeterJonesP

    @FANT-OME ,

    I would like to insert a link which, when I click on it, takes me to a sentence on my page

    If you mean, “I want to insert in my HTML source code a link which, when I click on it while viewing the file in my browser, takes me to a sentence on my page in the browser”, that’s an HTML question, and off-topic here (but I will give you the hint to search the web for documentation on how to create HTML anchors 🛈 and how to link to anchors 🛈 – that’s pretty basic HTML technology, and quite well documented)

    If you mean, "I want to insert a link which, when I click on it inside the Notepad++ editor window, takes me to a sentence on my page inside the Notepad++ editor window so that I can edit there, then I’m sorry to say, there is no built-in way of doing that. There are things you can do in a plugin (either purpose-written, or one of the generic scripting plugins like PythonScript). If you choose to go down that route, but need some pointers in the right direction, you can show what you’ve tried and we can give you some help.

  • NOTEPAD++ TEXT STAYS THE SAME WHEN VIEWED IN BROWSER

    4
    0 Votes
    4 Posts
    3k Views
    Newbie104N

    Thank you for insight guys! I guess I’ll be paying attention to what type of file I am saving Ha ha ha. Cheers!

  • Basic Language and Folding Questions

    12
    0 Votes
    12 Posts
    776 Views
    David LinD

    @PeterJones said in Basic Language and Folding Questions:

    @David-Lin said in Basic Language and Folding Questions:

    maybe indent-based code folding as an option could help

    I know the Python language lexer uses indent-based folding. But once again, that’s not transferrable to any other arbitrary lexer, and the UDL does not implement indent-based folding.

    Especially since, from my perspective, nesting /folding of code across all languages isn’t a property unique to a language the way keywords and specific functions are.

    From my perspective, it very much is language dependent. In Python, indenting is the only way of indicating blocks; in Perl, indentation only matters for the human reader, and blocks are defined by {}. In other languages, there are keywords like BEGIN/END or FOR/NEXT or IF/ELSE IF/ELSE/ENDIF which will define levels. Each lexer only codes in the level-determining code necessary for its language, because each lexer is completely separate. (And, once again, that’s not something that’s likely to change in Notepad++, because Notepad++ just passes along the lexers that were released with Scintilla.)

    Got it. thanks for the explanation - now i understand why my use case in SQL is different than the intent of the built-in code folding. For me, there are not generally large blocks of code between “level-determining code necessary for its language”, because in my use for preparing data tables, there is little purpose to long nested statements or loops, just moving around and rearranging data for other programs to eventually access and do analysis looping etc… occasionally there is a very long nested query. Procedures that might involve longer segments of code within loops are quite painful in SQL.

    For my use, I am separating large sections of code into my subjective segments that I would like to see nested, but these are not exactly “necessary” for the language.

  • remove string after a limiter

    6
    0 Votes
    6 Posts
    426 Views
    Alan KilbornA

    @guy038 said in remove string after a limiter:

    Alan beat me too. Moreover, with exactly the same regex :-)

    Haha, well does this show that some of us are learning?
    See, it can happen, people!

  • question about saving themes

    7
    0 Votes
    7 Posts
    365 Views
    PeterJonesP

    @mere-human , @Alan-Kilborn

    I believe what I had seen was pull #9339 commit 52e8c68 … though it looks like it’s not working yet.

    AFAIK, that is separate from wingup commit 9b193fa.

  • Need to compile VHDL file using external ModelSim

    4
    0 Votes
    4 Posts
    793 Views
    PeterJonesP

    It’s been asked enough times; I created a FAQ Desk entry for this topic.

  • How many files are opened (show number)

    12
    0 Votes
    12 Posts
    3k Views
    astrosofistaA

    Hi @M-FR

    For different reasons as yours, I found this information useful to my working setup, so and though I am not a real programmer, managed anyway to write — based on countless examples buried in the forum archives — this little Python script, tested in npp7.9.1.portable.x64, which will show how many files are opened in the status bar.

    If there is any issue with it, lets hope that the Pythoniers of the forum chime in.

    from Npp import * def StatusbarFilesAddition(args): Cur_Lang = notepad.getLanguageDesc(notepad.getLangType()) Open_Files = 0 for file in notepad.getFiles(): Open_Files += 1 notepad.setStatusBar(STATUSBARSECTION.DOCTYPE, '{} - Open files: {}'.format(Cur_Lang, Open_Files)) editor.callback(StatusbarFilesAddition, [SCINTILLANOTIFICATION.UPDATEUI]) # register callback

    If you want to try the script, here are some instructions to install it:

    First off, install PythonScript using Plugins > Plugins Admin.

    Then go to Plugins > Python Script > Scripts, Ctrl+Click on startup, and paste the script at the bottom of the file. Save and close startup.

    Now go to Plugins > Python Script > Configuration…, and change the “Initialisation” setting from LAZY to ATSTARTUP. Exit Notepad++ and reload.

    From now on the first section of the status bar will show how many files are opened in Notepad++ after the current language.

    Take care and have fun!

  • Regex replacement not working

    2
    0 Votes
    2 Posts
    297 Views
    PeterJonesP

    @Paul-Moloney said in Regex replacement not working:

    Any help on the valid syntax for Notepad++ appreciated (what flavour of regex does it use?

    The docs explain Notepad++ uses the Boost regular expression library (v1.70).

    But in every regex version I’ve used, [A-Za-z0-9-_\.%] would cause problems; in general, hyphens mean “range” inside a character class, unless they are escaped or the last character in the class. So [0-9-] is okay, [0-9-_] is not, but [0-9_-] is (non-range hyphen last) and [0-9\-_] is.

  • Replace characters only when a certain number exist

    11
    0 Votes
    11 Posts
    702 Views
    Jim MillerJ

    @guy038
    I tried to run it on another machine and it executed successfully. I suppose I should have tried the first ;-)
    Anyway, thank you very much for your help

  • [UDL] Code fold get incrementally out of alignment.

    6
    0 Votes
    6 Posts
    4k Views
    Michael NooneM

    Replying to this as this showed up in Google - I know this is very old, but this solved my problem where when I added a comment block, it then the folding was not aligned with the foldable elements.

  • Getting AppCrash

    Locked
    2
    0 Votes
    2 Posts
    150 Views
    PeterJonesP

    @Richard-Woods-Jr ,

    see “FAQ Desk: Request for Help without sufficient information to help you” and then reply here with more detail.

    If this is the same issue as your other post, please only ask it in one place; choose whether you think it’s generic help with Notepad++ (this post), or a problem with you developing a plugin (the other post), and only reply in one of the two topics.

  • Кодировка из UTF-8 в ISO 8859-1

    4
    0 Votes
    4 Posts
    2k Views
    PeterJonesP

    @Michael-Khmelnitskiy ,

    When the Settings > Preferences > MISC auto-detect is turned off as @litos81 suggested, that means it is not going to try to auto-detect. When that preference is off, you will likely need to manually change the encoding to ISO 8859-1.

    The problem is that Windows does not store the encoding information as metadata in the directory entry, nor as metadata attached directly to the file. Because of this, Notepad++ has a mode where it tries to guess what the encoding is, based on the sequence of bytes found in the file – but that mode guesses wrong, because all bytes just look like bytes and the guessing-algorithm cannot be perfect. When you turn off that guessing mode, then Notepad++ no longer guesses.

    Further, if your ISO 8859-1 document doesn’t have any characters that aren’t in the 7bit ASCII range, then it doesn’t matter whether Notepad++ says your document is ISO 8859-1 or UTF-8 – the bytes on disk will be the same.

    If you do have characters above 127 in your document, then you can just choose that 8859-1 character set for the encoding. To make it easier, you can go to Settings > Shortcut Mapper, and type 8859-1 in the Filter box, then Modify the shortcut for that to some unused keyboard shortcut that you will remember means “make this file 8859-1”.

    ------

    Когда “Настройки” > “Предпочтения” > “Автоопределение MISC” отключены, как было предложено в @litos81, это означает, что not будет пытаться выполнить автоопределение. Когда эта настройка выключена, вам, скорее всего, придется вручную изменить кодировку на ISO 8859-1.

    Проблема в том, что Windows не хранит информацию о кодировке в виде метаданных в записи каталога, а также в виде метаданных, прикрепленных непосредственно к файлу. Поэтому в Блокноте++ есть режим, в котором он пытается угадать, что такое кодировка, основываясь на последовательности найденных в файле байт – но этот режим угадывает неправильно, потому что все байты просто выглядят как байты, а алгоритм угадывания не может быть совершенным. Когда вы отключите этот режим угадывания, Блокнот++ больше не будет угадывать.

    Далее, если в вашем документе ISO 8859-1 нет символов, которые не находятся в 7-ми битном диапазоне ASCII, то не имеет значения, говорит ли Блокнот++ о том, что ваш документ ISO 8859-1 или UTF-8 - байты на диске будут теми же самыми.

    Если у вас do в вашем документе есть символы выше 127, то вы можете просто выбрать этот набор символов 8859-1 для кодировки. Чтобы сделать это проще, вы можете зайти в Settings > Shortcut Mapper, и набрать 8859-1 в поле Filter, затем Modify ярлык для этого на какой-нибудь неиспользуемый ярлык клавиатуры, который вы запомните, означает “сделать этот файл 8859-1”.

    Переведено с помощью www.DeepL.com/Translator (бесплатная версия)

  • Add Increment Number End Of Word

    3
    0 Votes
    3 Posts
    451 Views
    Terry RT

    @Terry-R said in Add Increment Number End Of Word:

    although I do believe there are various snippets of code already supplied in this forum, that if one looked for them they could be easily adapted to solve this.

    It turned out that such a question has already been answered and I was involved in an alternate solution using only regex (not recommended as much massaging of the data). Have a look at:
    https://community.notepad-plus-plus.org/topic/20462/how-to-append-the-numbers-with-specific-string
    See if it helps in any way.

    Cheers
    Terry

  • Synchronize lines in cloned window?

    2
    0 Votes
    2 Posts
    330 Views
    Terry RT

    @Igor-Itkin said in Synchronize lines in cloned window?:

    synchronize lines in a cloned window with word wrap?

    AFAIK no. Actually although you mention “cloned window” your image suggests otherwise. A clone is an exact replica of the original, clearly you have 2 different files open, 1 in each view. So you are just viewing 2 files, one in the “main” view, the other in the “other view”.

    I presume you are aware of the “synchronize vertical scrolling” as appears under the “View” menu. Note it mentions vertical scrolling, not lines, which is in essence what you want. So with word wrap on of course the “real” lines will quickly get out of synch. And as you mention word wrap, you probably already know the “synchronize vertical scrolling” will work if word wrap is off in both views.

    As a suggestion, if you have a need to keep the “lines” together for purposes of editing or such like, then maybe consider having the 2 files merged. You can opt to put even line numbers at the start of every line for file #1, and odd numbers for file #2. Then merge and sort by line numbers. At the end if you are primarily just wanting the content of 1 file, then by using a “a” and “b” appended to the line numbers you could easily remove the 'a" or “b” lines. Alternatively a regex could grab both lines (in pairs), then just return the first or second line, achieving the same result.

    Terry

  • mass replace diffrent text in file

    8
    0 Votes
    8 Posts
    289 Views
    Clyde ParkerC

    thanks everyone for your help, i’ve got how to make this work

  • Select all exclamation marks ! from a specific html tag

    15
    0 Votes
    15 Posts
    1k Views
    Alan KilbornA

    @guy038 said in Select all exclamation marks ! from a specific html tag:

    So the generic regexes, of my previous post, should be improved as :
    SEARCH (?s)(?:BR|(?!\A)\G)(?:(?!ER).)?\K(?:SR)    OR    (?-s)(?:BR|(?!\A)\G)(?:(?!ER).)?\K(?:SR)

    So, Guy, just a note again to say thanks for this.
    I have employed it 3 or 4 times in the last week, and I anticipate much more usage in the future.
    Very handy!

    One good example is in a section of a log file I have to process repeatedly.
    The section starts with certain line contents and ends with certain other line contents (thus BR and ER).
    Inside this section there are subsection headers (that have a consistent pattern to their format), and also “WARNING”, “ERROR”, “FAILED” , etc. text that follow the subsection headers (identifying problems within that subsection).
    By combining the headers and the error text bits in an OR’d together regex (to form the SR),I can create some nice output (in the Search result window) that identifies clearly the subsections that have “problems” and those that are “clean”.

    So very nice.

  • 2 Votes
    5 Posts
    238 Views
    guy038G

    Hello @snmnarum,

    Possessing some administrative rights, I took the liberty to modify your last link, to Github, which was wrong, because of a missing slash /, in front of the issue number 9478

    INITIAL link : https://github.com/notepad-plus-plus/notepad-plus-plus/issues9478 MODIFIED link : https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9478

    Best Regards,

    guy038