• 1 Votes
    2 Posts
    372 Views
    Terry RT

    @Ed-Klein said in If I have multiple desktops active can there be an open Notepad++ window on each:

    Is there a way to start an additional session in each desktop

    There are a number of methods which might help, I will explain them but I haven’t given you all the solution, you will need to complete that yourself based on which idea you decide on.

    Multi-instance mode. That comes with a caveat, last session to close will generally be the one to write the persistent version of config data ready for the next time. So for example if you say you set Dark Mode enabled (Preferences, Dark Mode) and that session is the last to close, then the next time Notepad++ starts Dark Mode will be enabled, even if the other sessions previously did not have it enabled.

    Notepad++ allows for a commandline setting to determine where on the displays it will appear. These are -x and -y settings for the upper left corner of Notepad++. See the online manual here.

    There is also another commandline setting that might alleviate any issues with using multi-session, -settingsDir. So you could elect to have multiple settings directories, one for each monitor/desktop. Each directory would contain all the config files that appear in the normal folder %appdata%\Notepad++. So with this method you would not need to set the x and y coords, rather with multi-instance enabled and using the settingsDir you would open Notepad++, move each instance to the required desktop and then close. On the next opening, the Notepad++ window would appear in the correct monitor. So each shortcut would need to refer to the correct alternate settingsDir

    You could install multiple “Portable Notepad++” installations. In this case updating them is more of a pain since that will overwrite all the config data in each portable installation. Details are here

    I suggest reading up on each, run some tests at the commandline to see which might best help you, then set about creating the right shortcuts to aid in running the preferred method.

    Terry

  • Issues with copy/paste on v8.6

    8
    1 Votes
    8 Posts
    4k Views
    Alan KilbornA

    @mkupper said in Issues with copy/paste on v8.6:

    If you have been used to holding the Ctrl key down in preparation for a Ctrl+C or Ctrl-V then I suspect it’s very difficult to unlearn it.

    When new features are added to software, you have to learn how to use them. Sometimes that involves some unlearning, and yes, that may be difficult. But, in theory, at the end, you are in a better place.

    But with all the bugs with this new feature, we are seemingly far from that “better place”. Hopefully it can all be sorted out and fixed (multi-select mode coexisting alongside column-block-select mode), and hopefully the N++ developer has interest in doing so.

  • "Autohide tabs bar if one document opened"

    6
    0 Votes
    6 Posts
    348 Views
    Alan KilbornA

    Have you tried the script solution that was presented HERE?

    Just noting this: There’s also the case of two views to consider. I suppose if both views were open, that counts as a multiple tab situation, so the tab bar would have to be shown.

  • Convert multiline data to CSV - Regex not working

    9
    1 Votes
    9 Posts
    799 Views
    S

    Thank you to everyone for their input, lots of things to try and I’ll certainly be taking a look at the Json plugin as well.

    Coises comment here in particular kicked me into the right way of thinking…

    @Coises said in Convert multiline data to CSV - Regex not working:

    @Schmill said in Convert multiline data to CSV - Regex not working:

    I’m assuming that the Regex is evaluating the first line, running the replace (which now places line 2 as an append to line 1), but now considers that line 1 is “done”, and moves onto line 2 (which is the old line 3 before the replace joined lines 1 and 2).

    It’s not that (the new) line 1 is done; it’s that the beginning of the old line 2 is no longer the beginning of line, so the ^ doesn’t match.

    Changing my “Find What” to be:
    (.+)\R
    and my replace to be:
    “\1”,

    Means that everything is converted as expected - I had overcooked my regex!

    Many thanks again all!

  • Regex: Find html tags that only contain numbers

    4
    0 Votes
    4 Posts
    371 Views
    Hellena CrainicuH

    I believe I find the solution:

    FIND: <[^>]*>(\d+(\.\d+)?(\s*\w*)*)<\/[^>]*>

  • Opening .cfg by default with Notepad++

    7
    1 Votes
    7 Posts
    4k Views
    CoisesC

    @Julian said in Opening .cfg by default with Notepad++:

    @Coises It opens in normal Notepad when I double-click at the moment.

    If you’re familiar with the registry editor, take a look at HKEY_CLASSES_ROOT\.cfg and see what is there.

    If it has a single value, Default, which reads cfg_auto_file, take a look at HKEY_CLASSES_ROOT\cfg_auto_file.

    If one of those has a shell\open\command pointing to notepad.exe, you could try changing it to the path to Notepad++. No warranties, express or implied, about what happens if you change things in the registry, though… I mean that.

  • How to remove ALL the duplicates WITHOUT deleting the empty lines?

    11
    0 Votes
    11 Posts
    15k Views
    Mark OlsonM

    @guy038 proposed a very simple solution to this, but I have a multi-step solution using no plugins, without having to perform the same find-replace multiple times in a row:

    Make sure Regular expressions are ON in the find/replace form before starting this.

    The document starts looking like this:

    foo bar baz foo foo bar bar baz quz foo Use the find/replace form to replace ^ with \x07. This adds a BEL character (convenient because it does not show up naturally in most text documents) to the beginning of each line. Make a column selection in the first column of every line of the file, then use the column editor to insert a number (with leading zeros to facilitate sorting). This numbers the rows, so they can later be put back in order.
    6e8abd36-ff51-41a8-96d7-7306ab623669-image.png Use the find/replace form to replace (?-s)^(\d+)(\x07)(.*) with ${3}${2}${1}. This puts the column numbers after everything else. Use the menu command Edit->Line Operations->Sort Lines Lex. Ascending Ignoring Case. Now all the lines with the same text are grouped together, and a single regex-replace can get rid of all but the first line with given text.
    3c2274bc-a772-4b8f-8f5d-2f4f7149f143-image.png Find/replace (?-s)^(.+)\x07\d+(?:\R\1\x07\d+)* with ~~~~${0}. This marks the first instance of each line, so that it won’t be deleted later. Note that the ~~~~ in this example should be replaced with some other text that occurs nowhere in your document.
    c755e9c0-d0f2-4c5d-bd1c-cb8a5b008180-image.png Find/replace (?-s)^(?!~~~~).*(\x07\d+) with ${1}. This clears the text but not the line number of any line that does not have the first instance of its text.
    1d2fdb73-56c6-48f7-a59b-0a41ee2181a1-image.png Find/replace ^~~~~ with nothing. This removes the starting marker. Find/replace (?-s)^(.*)(\x07)(\d+)$ with ${3}${2}$1. This brings the line numbers back to the front so that the lines can go back in order. Use the menu command Edit->Line Operations->Sort Lines Lex. Ascending Ignoring Case. Now all the lines are back in their original order.
    15e0de09-df0e-4c9a-97b7-0e0314d296dc-image.png Find/replace ^\d+\x07 with nothing. This removes the line numbers and separator.

    Finally, you are left with the original document with the non-first instances of each line’s text replaced with nothing! A lot of steps, but every step is highly scalable and won’t exhibit bad performance on very large files.

    foo bar baz quz
  • Regex - Find URLs with Embedded Spaces

    4
    0 Votes
    4 Posts
    481 Views
    PeterJonesP

    @Terry-R said in Regex - Find URLs with Embedded Spaces:

    has already made some posts here.

    And as slightly more of a hint: the search zone would begin with href=" and end with " . (If you tried the simpler begin with " , you would find that it would sometimes match between the end of one URL and the beginning of the next, and it wouldn’t work, which might frustrate you; the zone-matching works best when the start and end markers can be distinguished.)

  • Regex Custom UDL Parser

    7
    2 Votes
    7 Posts
    480 Views
    Khundian TwitchK

    @PeterJones

    You’re a star! That looks awesome!
    If you’re ever in Belgium I owe you some beers! :)

  • Why Carets?

    6
    0 Votes
    6 Posts
    908 Views
    Dave RowlandsD

    According to Encyclopedia MDPI

    The caret was originally and continues to be used in handwritten form as a proofreading mark to indicate where a punctuation mark, word, or phrase should be inserted into a document.[1] The term comes from the Latin caret, “it lacks”, from carēre, “to lack; to be separated from; to be free from”

  • How to sort data by number in ascending order - within specific ranges

    2
    0 Votes
    2 Posts
    247 Views
    guy038G

    Hi, @marcos-miguel and All,

    well…, just use the built-in N++ sort feature !!

    So, select your text :

    CITY Total London 5 London 3 London 4 London 1 London 2 NYC 40 NYC 30 NYC 50 NYC 70 NYC 60

    Use the Edit > Line Operations > Sort lines Lexicographically Ascending option

    And you get your expected text :

    CITY Total London 1 London 2 London 3 London 4 London 5 NYC 30 NYC 40 NYC 50 NYC 60 NYC 70

    Best regards,

    guy038

  • Npp v8.6 cursor oddity with copy paste into a 2x0 column

    4
    1 Votes
    4 Posts
    332 Views
    mkupperM

    I did more testing and discovered that the version of misbehavior that @Coises observed also happens with npp 8.3.3 and 8.5.8 and thus it’s no longer just a npp 8.6 issue. I experimented more and discovered the reason my installed copy of npp shows the behavior right away, instead of when I switch tabs is that I had:

    My plugins\config\PythonScriptStartup.cnf has SETTING/STARTUP/ATSTARTUP My plugins\config\PythonScript\scripts\startup.py has: from Npp import editor, editor1, editor2, SCINTILLANOTIFICATION, INDICATORSTYLE def revert_url_indicator(args): editor1.indicSetHoverStyle(8, INDICATORSTYLE.TEXTFORE) editor2.indicSetHoverStyle(8, INDICATORSTYLE.TEXTFORE) editor.callbackSync(revert_url_indicator, [SCINTILLANOTIFICATION.UPDATEUI]) Apparently as the UI gets updated Python is sweeping through all of the tabs which is why for me I did not need to switch to another tab and back to trigger the behavior I reported. That scriptlet came from this forum thread in July 2020.
  • Wanting to change every other time a word comes up.

    8
    1 Votes
    8 Posts
    357 Views
    no hanksN

    @Alan-Kilborn

    Sorry that one was on me, im still new at using notepad++ and wasn’t sure how to word my question. I do again apricate your effort.

  • Syntax Highlightning for folder path in custom language

    2
    0 Votes
    2 Posts
    213 Views
    PeterJonesP

    @Mad-Rheeza ,

    The User Defined Lanauge (UDL) system is not that powerful on its own.

    If you use the EnhanceAnyLexer plugin, you can use a regular expression to define it.

    But good luck in coming up with a regex that can distinguish between two similar (or identical) sets of text which mean two different things:

    I want to rename c:\path\filename as blah.txt I want to rename c:\path\filename as blah.txt

    In the first instance, it’s really implying “I want to rename c:\path\filename as blah.txt” to mean a single filename with spaces. The second is really implying “I want to rename c:\path\filename as blah.txt”

    And by “good luck”, I meant, “that’s an impossible task, without caveats”.

    If you have the caveat of “each line that starts with a drive letter then a colon then forward-or-backward-slash is a single filename, which may or may not include spaces, all the way to the end of the line”, then it’s easy. Something like ^[A-Z]:[\\/].*?$ will handle that.

    Or if you defined that all filenames with spaces must have double-quotes around (like the cmd.exe prompt and Windows > Run dialog require), then it’s also not too bad: Something like [A-Z]:[/\\]\S+|"[A-Z]:[/\\].+?" might work (the left half of the alternation before the | is for filenames without spaces, and the right half is for filenames in quotes, which might contain spaces.

    Or if you always have a three-letter extension, then [A-Z]:[/\\].*\.[A-Za-z]{3} would likely work.

  • UCS-2 encoding option missing

    3
    1 Votes
    3 Posts
    963 Views
    Alexis GuerinA

    @PeterJones

    Thanks for your answer.

  • Proper syntax for \s (spaces) in replace expression

    17
    0 Votes
    17 Posts
    4k Views
    Alan KilbornA

    @guy038 said in Proper syntax for \s (spaces) in replace expression:

    REPLACE ( )

    There are two space chars between the parentheses !

    Tricky. :-)
    The parens are only used because the OP was “uncomfortable” with whitespace he couldn’t really see in the Replace with box.

  • 1 Votes
    2 Posts
    523 Views
    PeterJonesP

    @victor-sahag ,

    My first guess is that your theme doesn’t include the definitions – which may have happened if you had an installation from before v8.5.1 (which added MS T-SQL), then upgraded to a newer version (like the v8.5.8 that you show), or if you’re using one of the themes that hasn’t been updated (“mssql” is only present in stylers.xml or DarkModeDefault.xml)

    Starting from a fresh Notepad++ v8.5.8 portable, it does syntax highlight MS T-SQL
    9dd4dae3-7230-445a-b960-f7625857c1b0-image.png

    So if you go to Settings > Style Configurator and do not see the MS T-SQL in the list of Languages on the left, you can grab that section from your installed directory’s stylers.model.xml: copy the mssql section (<LexerType name="mssql" desc="MS T-SQL" ext="">...</LexerType>) and paste it into the installed version of your theme (either %AppData%\Notepad++\stylers.xml for the default theme, or for other themes, go to %AppData%\Notepad++\themes\ThemeName.xml if you have a personal copy or <install_dir>\themes\ThemeName.xml if you just have the installed copy of the theme), then save the file and restart Notepad++. After that, MS T-SQL should be in your Style Configurator, and it should syntax highlight. If the colors don’t match with your theme, you will need to update the colors using the Style Configurator to make it look more like the other languages in your chosen theme.

  • Merging xml files

    2
    0 Votes
    2 Posts
    727 Views
    Alan KilbornA

    @Bela-Barton

    Unless there’s a way to do it with the XMLTools plugin (which I doubt), then this question is off-topic for this forum.

  • Color User defined global variable words e.g. TEST=

    7
    0 Votes
    7 Posts
    525 Views
    PeterJonesP

    @Christopher-Rotolo said in Color User defined global variable words e.g. TEST=:

    If I wanted to ‘request an update’ to the smalltalk language, any idea what is my best route

    The Lexilla project has an issues page, which is where official feature requests for the Smalltalk lexer would go.

    Again, given that they haven’t updated the Smalltalk lexer in 18 years, I am doubtful that they will add any new features to the lexer; but I have been wrong about such guesses before.

  • Regex: Delete group of many \\ on the same line

    3
    0 Votes
    3 Posts
    253 Views
    mkupperM

    @Hellena-Crainicu I suspect the reason your first expression did not work is that you may have Windows end-of-line with \r\n rather than the Unix style \n end-of-line that your expression expected. If you use \R then it will match any style of end of line. \R works with Windows, Unix, and Macintosh style end of lines which use \r.

    If you replaced the \n with \R we have \\\\u[0-9a-fA-F]{4}.*?\R{2,}

    That will match from the first \\uxxxx on to the end of the line followed by two or more end of line marks. The expression matches your example data if it’s followed by two or more blank lines.

    In your follow-up you used \\\\.*$ implying you had not intended to also include the end-of-line marks as part of the pattern nor the followed-by-blank-line requirement.

    This will work \\\\u[0-9a-fA-F]{4}.*$ though as you probably noticed, the data also includes \\ sequences such as \\n which is a newline plus some unusual things such as \\ n with a space between the \\ and n. The underlying HTML that this is intended to decode to is badly formatted meaning it’s likely not worthwhile to fully parse the data.

    Your \\\\.*$ just gets rid of it which is probably good.