Community
    • Login

    Always open file in last tab

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    7 Posts 4 Posters 1.0k 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.
    • Jeff SchindlerJ
      Jeff Schindler
      last edited by

      So, if I am opening a file via right-click in the file explorer and that file is already open in a tab in notepad++ (i have A LOT of tabs), is there any way to always force that opened file to be the last tab in the list? The reason for this is that many times I open 2 or more files and want to easily bounce back and forth between them, but if they’ve been open (a long time) before, the tab disappears way to the left. Thanks.

      Alan KilbornA mkupperM 3 Replies Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Jeff Schindler
        last edited by

        @Jeff-Schindler

        Sorry, no way to do that, at least not an easy way.

        1 Reply Last reply Reply Quote 0
        • Mark OlsonM
          Mark Olson
          last edited by

          NavigateTo doesn’t solve the exact problem you’re trying to solve, but it does make it easier to work with large numbers of open tabs, so you might want to give it a go.

          1 Reply Last reply Reply Quote 2
          • mkupperM
            mkupper @Jeff Schindler
            last edited by

            @Jeff-Schindler You can move a tab to the right using the Ctrl-Shift-Page Down. Let the keyboard’s auto-repeat move a tab to the far right. Ctrl-Shift-Page Up moves a tab to the left.

            Edit your shortcuts.xml file and add this to your <Macros> section:

                    <Macro name="Move to last tab" Ctrl="yes" Alt="yes" Shift="yes" Key="84">
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                        <Action type="2" message="0" wParam="44098" lParam="0" sParam="" />
                    </Macro>
            

            Restart Notepad++. You now have a macro activated by Ctrl+Shift+Alt+T that moves the current tab over to the right by 25 tabs. If you normally have more than 25 files open then just add more of those <Action type="2" ... lines.

            I thought you could set this up via Notepad++'s macro recorder thing but I discovered the recorder would not record a bunch of Ctrl-Shift-Page Down. It saved one in the macro and so I edited my shortcuts.xml and added a bunch of duplicate <Action type="2" ... lines in my macro.

            This macro is not perfect but at least allows you to snap a file/tab to the rightmost position.

            You could also record a macro that first snaps to the rightmost position and then backs up by one with a single Ctrl-Shift-Page Up by adding a line at the end of your macro with

            <Action type="2" message="0" wParam="44099" lParam="0" sParam="" />
            

            I used Ctrl+Alt+Shift+T for my example but you can use any combination including those that use the arrow keys or whatever you prefer.

            If you have not edited your shortcuts.xml before then see https://npp-user-manual.org/docs/config-files/#editing-configuration-files That section of the manual talks about the config.xml file but I would use the same approach for the shortcuts.xml.

            1 Reply Last reply Reply Quote 2
            • Alan KilbornA
              Alan Kilborn @Jeff Schindler
              last edited by Alan Kilborn

              I was thinking about @mkupper 's approach, and I recalled what OP said:

              …many times I open 2 or more files

              I took this statement to mean selecting multiple files in Explorer, and then using its right-click to send files to Notepad++.

              Consider the case of exactly two files, where one is already open in Notepad++ and one is not. Notepad++ loads the unopen file and makes it active (as the rightmost tab – it could happen, depending on the order in which Explorer passes the files). Now there is no easy way to get to the other tab, in order to run the macro on it that moves it to the right-most position.

              My thought was that you could close the file that was originally unopen (now the active tab) and then the previously-open file tab would become active and could be moved, but that desired tab-activation didn’t happen when I tried the closure. If it had, I’d have “moved” the tab, then used the Restore Recent Closed File keycombo to bring back the tab manually closed, thus having both files as the two right-most tabs.

              So I think the conclusion is that things depend upon the workflow of the OP and how much he wants to adapt a potentially-already-ingrained workflow to workarounds, e.g. having to open files one at a time in this case, as well as running a macro as an extra step.

              1 Reply Last reply Reply Quote 2
              • Jeff SchindlerJ
                Jeff Schindler
                last edited by

                Thanks for all the replies! What I meant by “open 2 or more files” is that I want to actively work with 2 or more files - ie open them and have them all at the far right of the tab list, so that I can easily bounce between them. Not a huge deal (and I could surely close my tabs more often!), but I often think about this when I’m using notepad++. A preference for this behavior would be awesome (“Always move opened files to last tab”). I might try the macro idea. Thanks again.

                Alan KilbornA 1 Reply Last reply Reply Quote 1
                • Alan KilbornA
                  Alan Kilborn @Jeff Schindler
                  last edited by

                  @Jeff-Schindler said in Always open file in last tab:

                  A preference for this behavior would be awesome (“Always move opened files to last tab”).

                  You’d have to make a feature request; see HERE for how to do that.

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