I have just finished reviewing the NPP source code, and have some additional details if you would like to seek a solution for yourself. When you go File -> Open, the list of file extensions is loaded from the Scintilla (SciLexer.dll) file.
Now, when you go File -> Open, the void Notepad_plus::fileOpen()
function is called (in the NppIO.cpp
file). Initially, the All Types, *.*
filter is added to the filter list, and then, the int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType)
function is called (in the same file). This function goes through the Scintilla entries I mentioned above, and adds them to the passed FileDialog
's filter list. The code in FileOpen
looks like this:
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
setFileOpenSaveDlgFilters(fDlg);
You can change the default filter index. To do that, you can instead change those lines to this:
fDlg._ofn.nFilterIndex = 2L;
fDlg.setExtFilter(TEXT("All types"), TEXT(".*"), NULL);
setFileOpenSaveDlgFilters(fDlg);
That should set the filter index to the second one by default.
Another easy way to quick-fix this is to modify those lines (again, in NppIO.cpp
) to look like this:
fDlg.setExtFilter(TEXT("Text files"), TEXT(".txt"),
TEXT("All types"), TEXT(".*"), NULL);
setFileOpenSaveDlgFilters(fDlg);
That will ensure that Text files are the first filter on the list. Do note that this will cause the .txt extension to be double-defined in the entries, but if you can live with that caveat, this should work fine.
Run cmd
as Administrator
abstract sample:
assoc .Ext=EditorSuperExtName
ftype EditorSuperExtName=EditorSuper.exe %1 %*
real sample:
assoc .pdf=AcroExch.Document
ftype AcroExch.Document="C:\App32\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe" "%1"
real sample 2:
assoc .java=javafile
ftype javafile="C:\App64\NetBeans 7.2\bin\netbeans.exe" "%1" %*
Best Answer
Change the program associated to the "Edit" verb for batch files:
HKEY_CLASSES_ROOT\batfile\shell\edit\command
.%SystemRoot%\System32\NOTEPAD.EXE %1
to"C:\Program Files (x86)\Notepad++\notepad++.exe" "%1"
Note: You may have to adjust your path to Notepad++.exe if it resides in a different folder on your system.
Also note: This is a system-wide change.