Notepad++ File Association

2009-06-08
2012-11-13
  • Andran Indaei

    Andran Indaei - 2009-06-08

    Hello,

    When I tell windows to open a particular file type in Notepad++, the file type gets renamed "notepad++ file".  Is it possible to keep the original file type names, but still open them in notepad++?

    E.g., perl scripts are originally grouped as "*.pl" files, but when I tell windows to open them in notepad++, they are then grouped together with "*.txt" files as generic "Notepad++" files?  I prefer the original setup for sorting/grouping data/scripts.  This is in XP.

    Thanks,
    Eric

     
    • asherber

      asherber - 2009-07-08

      I've made a little utility to manage this on Windows:

         http://aaron.sherber.com/files/npp-assoc.zip

      There's a Help button to explain how to use it, in case it's not clear.

      The point of this is to associate files with NPP while keeping their old icons and file descriptions. So I suggest that you first go into the NPP Preferences dialog and undo any associations you've set up there. That way, .txt files (for example) will again be Text Documents with the good old Notepad icon. Then use this utility to re-associate.

      Comments and bug reports welcome.

      Aaron.

       
    • asherber

      asherber - 2009-06-19

      This is a big deal for me, and the one thing keeping me from using NPP as my main editor. I need to preserve the original file types (and icons), so that things don't all get grouped together as NPP files.

      IMO, Textpad handles this exactly right. Take for example the extension .pas, which is initially registered as DelphiUnit. So the registry has (roughly):

      HKCR\.pas = DelphiUnit
      HKCR\DelphiUnit = "Delphi Source File", icon from Delphi, open with Delphi

      When I tell Textpad to associate with .pas files, it makes a copy of the DelphiUnit key and calls it HKCR\TextPad.pas, and it changes the command parts of the key to refer to Textpad -- but it leaves the description and icon as they were. Then it changes HKCR\.pas to point to Textpad.pas. Finally, it adds an entry under HKCU\Textpad\Associations, .pas=DelphiUnit, so that if I tell Textpad to stop handling .pas files, all it has to do is write the value DelphiUnit back to HKCR\.pas.

      Contrast this with NPP, which simply takes HKCR\.pas and points it (along with all other associated files) to HKCR\Notepad++_file. This is what makes all associated files get lumped together with the same icon and description.

      I really wish this could be changed. I otherwise love this app.

      Thanks,
      Aaron.

       
    • cchris

      cchris - 2009-06-19

      Try searching this and the Help forum for file associations. I remember someone had posted a complete solution with the text of a .reg or .inf file to import into the reistry. That was a couple month ago iirc.

      CChris

       
    • asherber

      asherber - 2009-06-19

      Ah, interesting. Yes, that is the way to do it by hand.

      In the meantime, I've written a small app that automates all of this. You just enter each extension you want to associate with NPP, and the app does all the registry stuff, keeping the filetype's existing description and icon. If you change your mind, the app will also roll you back to your previous associations.

      When I get a chance to pretty the app up a little, I'll post a download link here, in case anyone's interested.

      Aaron.

       
    • cchris

      cchris - 2009-06-20

      Please do, and contact donho if you wish to contribute your app too this project.

      CChris