0

Based on the question here: Notepad++ Setting for Disabling Auto-open Previous Files

I want to remember current session during next launch, so that it highlights the last LINE I've worked on for one particular file.

However, I do NOT want to see all my other text files open as tabs when I open notepad++ the next time.

How do I separate these 2 functions?

Ashraf.Shk786
  • 618
  • 1
  • 11
  • 23

1 Answers1

0
  1. Save this "particular file" if it need.
  2. Do RMB on it's tab and choose 'Close ALL BUT This'.
  3. Close Notepad++.

More convenient will be to create macro. But your goal's final step is to exit Npp... It's unpossible to save macro on closed Npp :)

So, do the following

  1. Locate where your Npp shortcuts.xml is placed. Possible pathes are:

    • %APPDATA%\Notepad++\shortcuts.xml
    • Npp_install_folder\shortcuts.xml
    • On path specified in Npp_install_folder\cloud\choice (file w/o extension)
  2. Go to this place and create new folder in it with name you want, say - BUP.

  3. Copy original shortcuts.xml to BUP folder.
  4. Create backup copy of BUP\shortcuts.xml. Say - shortcuts_bup.xml.
  5. Open in Npp BUP\shortcuts.xml and insert in it's section <Macros> the following block:

        <Macro name="_SaveMe_CloseAllButMe_And_Exit" Ctrl="no" Alt="no" Shift="no" Key="0">
            <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="41005" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="41011" lParam="0" sParam="" />
        </Macro>
    

Finally, BUP\shortcuts.xml should look as:

<NotepadPlus>
    <InternalCommands />
    <Macros>
        ' here is something by default ..
        <Macro name="_SaveMe_CloseAllButMe_And_Exit" Ctrl="no" Alt="no" Shift="no" Key="0">
            <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="41005" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="41011" lParam="0" sParam="" />
        </Macro>
    </Macros>
    <UserDefinedCommands>
        ' .. and here too. All the rest, reagrdles present it or not, does not concern you.
    </UserDefinedCommands>
    <PluginCommands />
    <ScintillaKeys />
</NotepadPlus>
  1. Save it.
  2. Close all instances of Npp.
  3. Copy BUP\shortcuts.xml over existing shortcuts.xml on path you already found.
  4. Start Npp and reproduce setup you wrote above.
  5. Select the line you want on "particular file"
  6. Choose on meny bar 'Macro -> _SaveMe_CloseAllButMe_And_Exit'
  7. Run Npp again.
  8. Enjoy (if 13 does not bother you and you are not superstitious :) .
user6698332
  • 407
  • 3
  • 14
  • I have done everything correctly up to step 11, but it doesn't bring me back to the same line when I re-open the doc another time. Also, is there any way I can make it the default, instead of having to navigate the menu bar to run the macro? Thanks! – Automator_Junkie May 21 '18 at 13:07
  • @curiousnotepad I tested many times before post it :) My Npp is 7.3.2. Download this [bin-package version](https://notepad-plus-plus.org/repository/7.x/7.3.2/npp.7.3.2.bin.zip) , unzip to any new folder, apply all settings from post. Do not touch anything more. IWFM... – user6698332 May 21 '18 at 13:34