如何给Notepad++安装Emmet和Python Script插件
答案:2 悬赏:20
解决时间 2021-03-06 16:56
- 提问者网友:久伴不朽
- 2021-03-06 13:43
如何给Notepad++安装Emmet和Python Script插件
最佳答案
- 二级知识专家网友:你把微笑给了谁
- 2021-03-06 15:07
启动Python脚本
Notepad++ Python脚本需要放置到特殊的目录中,以便于通过Python插件识别,然后可以在Notepad++中启动.通常这个目录是%APPDATA%\Notepad++\plugins\config\PythonScript。这个脚本也可以通过菜单Plugins->Python Script->Scripts启动.我们也可以创建工具栏按钮为这些脚本以便于快速启动它们。
编程对统计字数
为了展示这个插件,写一个python 脚本 ,用来计算 字符,字,行在当前的Notepad++编辑窗口。
from Npp import *
import re
numChars = 0
numWords = 0
numLines = 0
editorContent = editor.getText()
for line in editorContent.splitlines():
numLines += 1
for word in re.findall("[a-zA-Z0-9]+", line):
numWords += 1
numChars += len(word)
notepad.messageBox("Number of characters: %d \nNumber of words: %d \nNumber of lines: %d" % (numChars, numWords, numLines))
在第7行 我们获取实际编辑窗口中的文本内容和所有其他的一起,典型Python程序除外,
在第13行 我们打印 字符,字和行通过 Notepad++ 消息盒。
编程控制Notepad++的书签
Notepad++ Python脚本需要放置到特殊的目录中,以便于通过Python插件识别,然后可以在Notepad++中启动.通常这个目录是%APPDATA%\Notepad++\plugins\config\PythonScript。这个脚本也可以通过菜单Plugins->Python Script->Scripts启动.我们也可以创建工具栏按钮为这些脚本以便于快速启动它们。
编程对统计字数
为了展示这个插件,写一个python 脚本 ,用来计算 字符,字,行在当前的Notepad++编辑窗口。
from Npp import *
import re
numChars = 0
numWords = 0
numLines = 0
editorContent = editor.getText()
for line in editorContent.splitlines():
numLines += 1
for word in re.findall("[a-zA-Z0-9]+", line):
numWords += 1
numChars += len(word)
notepad.messageBox("Number of characters: %d \nNumber of words: %d \nNumber of lines: %d" % (numChars, numWords, numLines))
在第7行 我们获取实际编辑窗口中的文本内容和所有其他的一起,典型Python程序除外,
在第13行 我们打印 字符,字和行通过 Notepad++ 消息盒。
编程控制Notepad++的书签
全部回答
- 1楼网友:野性且迷人
- 2021-03-06 16:46
1、下载emmet和python script emmet需要 python script 的支持,因此这两款插件必须同时安装才能使用。 下载地址: pythonscript_full_0.9.2.0 emmet的notepad++插件 2、安装 emmet的安装比较简单,下载完解压后复制到notepad++安装目录的plugins下即可。 python script的安装则稍稍复杂,我走了一些弯路后才搞定。一开始以为将解压后的文件扔到plugins下就行了,但启动notepad++时总是报错。 于是我打开 python script 的帮助文件,看了一遍安装手册才搞明白。 下载完pythonscript_full_0.9.2.0.zip后解压,将python27.dll文件复制到notepad++安装目录的根目录下,同时在plugins文件夹中的全部内容复制到notepad++安装目录的plugins下。 为表达清楚,摘录python script 的目录结构如下: notepad++ (notepad++ 安装主目录,一般位于"c:\program files"下) + |-- python27.dll(放在notepad++ 安装主目录下,和notepad++.exe属于同一目录) +-- plugins \ |-- pythonscript.dll | |-- pythonscript | \ | |-- lib | | \ | | |-- (*.py) 很多 *.py 文件和子目录 | | | |-- scripts | \ | |-- (脚本和一些示例) | | |-- doc | \ | |-- pythonscript | \ | |-- pythonscript.chm(pythonscript帮助文档,英文版) notepad++ (notepad++ 安装主目录,一般位于"c:\program files"下) + |-- python27.dll(放在notepad++ 安装主目录下,和notepad++.exe属于同一目录) +-- plugins \ |-- pythonscript.dll | |-- pythonscript | \ | |-- lib | | \ | | |-- (*.py) 很多 *.py 文件和子目录 | | | |-- scripts | \ | |-- (脚本和一些示例) | | |-- doc | \ | |-- pythonscript | \ | |-- pythonscript.chm(pythonscript帮助文档,英文版) 3、emmet的工作流程 安装完emmet后,强烈建议更改 expand abbreviation 的键盘快捷键为tab键。 打开notepad++settings > shortcut mapper…对话框,切换到 plugin commands,选中 expand abbreviation 项,修改其快捷键为tab键即可。 然后,就可以按照 emmet 的工作流程来干活了: 打开 html 或 css 文件->按语法编写指令->按下 tab 键->生成!
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯