修改系统默认的文本类型编辑方式

除了有时编辑网页需要浏览效果会用 DW 外,其他的文本编辑都是用 EditPlus 来完成的。多窗口、正则替换、块状选取、自动缩进、删除行尾空格……等等,试问那个操作 Notepad 能够信任!?没有。

Windows 里的文本格式文件默认关联程序是“记事本”,右键快捷菜单一般固定是两项:“打开 – Notepad.exe”、“编辑 – Notepad.exe”。记事本打开,这个没什么好说的,毕竟它简单,快;但编辑还是用它,我就有点受不了。最惨“编辑(E)”快捷键是 E,还和“Editplus”冲突了,让人完全无法视而不见,不得不去之而后快……

问题来了!在那里修改!?注册表里的“.txt”和“txtfile”都没有直接修改的选项;最后得到了关键字:PerceivedTypes 和 SystemFileAssociations。搜索而到了微软的 MSDN:

PerceivedTypes, SystemFileAssociations, and Application Registration

PerceivedTypes are similar to file types except they refer to broad categories of file format types, rather than specific file types. For example, Image, Text, Audio, and Compressed are PerceivedTypes. File types (generally public file types) can also have a PerceivedType, and should always be defined as such when appropriate. For example, the image file types .bmp, .png, .jpg and .gif are also of PerceivedType Image.

The system defines several PerceivedTypes in Microsoft Windows XP. These include the following:

  • Image
  • Text
  • Audio
  • Video
  • Compressed
  • System

WinXP 下原来有六种已识别的文件类:图像、文本、音频、视频、压缩文件、系统文件。

The SystemFileAssociations key under HKEY_CLASSES_ROOT stores PerceivedTypes. For example, the PerceivedType text appears as follows:

HKEY_CLASSES_ROOT

SystemFileAssociations

text

shell

edit

command
(Default) = “%SystemRoot%\system32\NOTEPAD.EXE” “%1”
open

command
(Default) = “%SystemRoot%\system32\NOTEPAD.EXE” “%1”

修改方法如上:定位到上面的键位,修改“edit – command – (Default)”为 Editplus 的程序路径即可。

A file type’s perceived type is indicated by including a PerceivedType registry string in the file type’s key and specifying the perceived type. For example, to include .cpp files as PerceivedType text, you enter the following:

HKEY_CLASSES_ROOT

.cpp
PerceivedType= text

应用如上:例如要把 .cpp、.asp、.css、.js、.html 等格式全部识别为文本,只要把其下的 PerceivedType 设为“text”就可以了。

——将本页面分享到——

2 thoughts on “修改系统默认的文本类型编辑方式

  1. ccaiai

    这个好 我正愁编辑和打开…
    用notepad打开,用vim编辑