Community
    • Login

    Notepad++ creates new files for elements of the copied text when opening a new file

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 3 Posters 763 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Acortez AlexA
      Acortez Alex
      last edited by

      Hi,
      When I copy from Notepad++ and then press Control+n to open a new Notepad++ file, numerous popups appear (one by one) saying “notepad ++ <…> doesn’t exist. Create it?” where <…> contains some elements of the copied text. Depending on the text copied there may be dozens of popups. How to get rid of this weird behavior? v.8.6.5.

      PeterJonesP CoisesC 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Acortez Alex
        last edited by

        @Acortez-Alex ,

        It doesn’t happen for me.

        Your description makes me think that Edit > On Selection > Open File is being run instead of New File for Ctrl+N.

        Can you look at Settings > Shortcut Mapper. New is the first entry on the Main Menu tab. Does it look peach or red

        5b924f55-a185-483f-a831-24a9160ebab1-image.png 85bf7676-da95-4779-9036-3b87663d8ee2-image.png

        If so, that means Ctrl+N is mapped to multiple things, and it will tell you at the bottom what it’s mapped to (you might have to click on New first, to make it fully red). My guess is that it will reference the Open File entry about 100 lower down.

        c55560fb-e38f-42b8-9892-2395eacfdac5-image.png

        You can click on that later Open File and hit Clear to get rid of that conflict.

        Alternately, maybe New at the top didn’t have a shortcut applied, and only Open File has Ctrl+N.

        Maybe I’ve misunderstood your symptoms, so if you would share screenshots similar to what I showed, with New at the top, and the Open File about 100 down, so that we can see what those shortcuts are. You could also use the Shortcut Mapper’s Filter to look for Ctrl+N (espsecially if neither New nor Open File are using Ctrl+N), and share that screenshot, like:

        5aa5076f-ccf4-493d-8d92-6338535cbff3-image.png

        Also, maybe a plugin is interfering, so share your ?-menu’s Debug Info, which will tell us your plugins. (And also see our FAQ for debugging whether an issue is caused by a Plugin or by Notepad++ itself.)

        1 Reply Last reply Reply Quote 1
        • CoisesC
          Coises @Acortez Alex
          last edited by

          @Acortez-Alex said in Notepad++ creates new files for elements of the copied text when opening a new file:

          When I copy from Notepad++ and then press Control+n to open a new Notepad++ file, numerous popups appear (one by one) saying “notepad ++ <…> doesn’t exist. Create it?” where <…> contains some elements of the copied text. Depending on the text copied there may be dozens of popups. How to get rid of this weird behavior? v.8.6.5.

          First, as Peter Jones also mentioned, please click the ? at the right of the main menu, select Debug Info…, click the Copy debug info into clipboard button, and paste what was copied into a reply here. That will give us some details that might help.

          Does this happen when you select File | New from the main menu, or only when you use the keyboard shortcut?

          Are you running anything like AutoHotKey that might set keyboard shortcuts?

          Acortez AlexA 1 Reply Last reply Reply Quote 2
          • Acortez AlexA
            Acortez Alex @Coises
            last edited by

            I now understand the cause. The thing is Ctrl+n opens a new tab, while I need it to open a new window. That’s why I had changed the default shortcut for New from Ctrl+n to Ctrl+Shift+n so that I could remap Ctrl+n. I don’t remember how exactly I did it, but In the Run Commands tab there is now command “Open selected file path in new instance” fired by Ctrl+n. There is no option to add or modify a command. So how can I open a new window with Ctrl+n without these popups?

            Debug info:

            Notepad++ v8.6.5 (64-bit)
            Build time : Mar 29 2024 - 17:04:43
            Path : C:\Program Files\000\Notepad++\notepad++.exe
            Command Line :
            Admin mode : ON
            Local Conf mode : OFF
            Cloud Config : OFF
            Periodic Backup : OFF
            OS Name : Windows 11 Home (64-bit
            OS Version : 23H2
            OS Build : 22631.3374
            Current ANSI codepage : 1251
            Plugins :
            mimeTools (3.1)
            NppConverter (4.6)
            NppExec (0.8.8)
            NppExport (0.4)
            _CustomizeToolbar (5.3)

            PeterJonesP 1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @Acortez Alex
              last edited by

              @Acortez-Alex:

              So how can I open a new window with Ctrl+n without these popups?

              By having the command you run not give invalid files to notepad++.exe as arguments.

              There is no option to add or modify a command

              To add a command, you just do a new Run > Run… and Save it. (That’s most likely how you created your command in the first place.)

              Unfortunately, there is no GUI interface to modify an existing Run-menu command. Instead, you have to look in %AppData%\Notepad++\shortcuts.xml, and look for the command, edit it, save the file, then restart Notepad++.

              You’ll need to share the contents of the command with us for us to know for sure, but based on your problem description, I am guessing that you included $(CURRENT_WORD) or $(CURRENT_LINESTR) as a command-line option in the command; if I am right, that’s definitely not what you want to do.

              You should just be able to run the command "$(NPP_FULL_FILE_PATH)" -multiInst -nosession and it will launch a new instance of Notepad++, with just a single empty document. After running that, then you can paste in the contents of the clipboard into the new document.

              References

              • User Manual: User Defined Commands syntax
              • User Manual: Command Line Arguments
              Acortez AlexA 1 Reply Last reply Reply Quote 1
              • Acortez AlexA
                Acortez Alex @PeterJones
                last edited by

                @PeterJones Indeed, I had

                <Command name="Open selected file path in new instance" Ctrl="yes" Alt="no" Shift="no" Key="78">$(NPP_FULL_FILE_PATH) $(CURRENT_WORD) -nosession -multiInst</Command>
                

                I have removed $(CURRENT_WORD) and it now works as intended! Thanks a lot!

                While I am about it, do you mind if I ask about this macro, titled “Blank lines”, in the Macro tab, because I’d like any new Notepad++ file to open with say 50 blank lines (as if I pressed Enter 50 times). Is it the macro I need and if so how to tweak it and how to connect it to the Ctrl+n hotkey?

                PeterJonesP 1 Reply Last reply Reply Quote 0
                • PeterJonesP
                  PeterJones @Acortez Alex
                  last edited by

                  @Acortez-Alex said in Notepad++ creates new files for elements of the copied text when opening a new file:

                  ask about this macro, titled “Blank lines”, in the Macro tab

                  “Trim Trailing Space and Save” is the only Macro that ships with Notepad++. Everything else is something that you (or your IT group) added.

                  Without sharing the contents of your “Blank lines” macro, we cannot answer questions specifically about it.

                  However, even without the contents of the macro, I can tell you that there is no way (that I am aware of) to make a macro run automatically when you launch a new instance of Notepad++ or when you create a new file.

                  Using a scripting plugin, like PythonScript, you could automate both the launch of the new instance and inserting the 50 blank lines… (I have never tried to use PythonScript from one instance to insert text in another instance… so what you might need to do is launch the new instance from the Run command, but have the command line argument -pluginMessage="...", and give it some value that a PythonScript callback would handle from the NPPN_CMDLINEPLUGINMSG notification, or just process it at startup. It would take some development effort to get working.)

                  However, what is your reason for wanting 50 blank lines? With Settings > Preferences > Editing 1 > ☑ Enable scrolling beyond last line checkmarked, you can scroll wherever you want

                  Acortez AlexA 1 Reply Last reply Reply Quote 0
                  • Acortez AlexA
                    Acortez Alex @PeterJones
                    last edited by

                    @PeterJones I see, that’s too complicated, not worth it. The reason is simple: I often paste stuff so I want to be able to paste (or sometimes type) text into a file without the need to first click on the last line and then pressing Enter. In MS Word you can double-click on any blank space below and start typing or pasting, so here I want something like that.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors