更新2019-8-25 12:52:29
一、插件管理器安装
notepad++找不到PluginManager插件管理器,到下面链接下载32位版本PluginManager_v1.4.12_UNI.zip解压后放到plugins目录下重启既可。64位版本下载PluginManager_v1.4.12_x64.zip对应的版本。7.6x以上版本。不能直接复制到notepad目录下。需要在plugins目录下。新建立PluginManager目录。然后把PluginManager.dll拷贝到此目录下,才能够显示出来效果。其他不可用插件也按此方法基本能解决。
下载:https://github.com/bruderstein/nppPluginManager/releases
二、单独安装
单独安装python script:我使用的notepad++是7.8.6版本。到github网站下载python script好像现在32/64都支持了,32位下载PythonScript_Full_3.0.1.0.zip,64位下载PythonScript_Full_3.0.1.0_x64.zip。下载后拷贝到Notepad++下的plugins目录下解压。
解压后修改目录名称为PythonScript。具体如下图。重新打开notepad++即可使用。
下载:https://github.com/bruderstein/PythonScript
原出处:http://stackoverflow.com/questions/7256049/notepad-converting-ansi-encoded-file-to-utf-8
Here some simple steps to convert multiple files via Notepad++ without messing up with special characters (for ex. diacritical marks).
convertToUTF8.py
import os;
import sys;
filePathSrc="C:\\Users\\" # Path to the folder with files to convert
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if fn[-4:] == '.xml': # Specify type of the files
notepad.open(root + "\\" + fn)
notepad.runMenuCommand("Encoding", "Convert to UTF-8")
notepad.save()
notepad.close()
After all, run the script
注意事项:操作前必须把notepad++语言设置成英文。否则执行没效果。
参考:http://blog.csdn.net/a_flying_bird/article/details/51263375
即点击下面的菜单,不知道执行了没有,可以到代码里面加个打印print "Convert to ANSI" ,打开菜单里面的 Show Console 可以看到Python打印结果。
操作步骤:
1、打开Python Script----NewScript
2、输入需要创建的脚本名称convertToUTF8,使用默认路径保存。如果是直接从以前的复制粘贴过来的,则需要重启一下notepad++。
3、在脚本文件中编辑python代码。重启notepad++。
4、重启后则可以看到相关的脚本名称了,保存上述代码后,进入插件中点击运行当前脚本。
Python没有花括号{},使用缩进来作为程序层次区分的标志,此外Python没有分号;以换行来实现程序语句的结束。如果要转化为ANSI 就把下面UTF-8改为ANSI既可,说明一下下面的fn[-2:],指寻找后面2个字符匹配的路径后缀为.h ,如果你要匹配.cpp ,则应该是fn[-4:],下面包含了.h .cpp一起修改。转换成不同的编码格式,只需修改 Convert to UTF-8 为下面菜单的红色框里面对应项即可。我的是notepad++7.5.6的,不同版本可能稍有不同。设置为跟自己版本一致即可。
import os;
import sys;
sys.stdout = console
filePathSrc="E:\\0_WorkSvn\\1_HxRadar\\3dparty" # Path to the folder with files to convert
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if fn[-2:] == '.h' or fn[-4:] == '.cpp': # Specify type of the files
notepad.open(root + "\\" + fn)
notepad.runMenuCommand("Encoding", "Convert to UTF-8")
notepad.save()
notepad.close()