使用Notepad++开发python配置笔记

这是我在python学习过程中,收集整理的一些notepadd++环境配置方法。

1、配置制表符

Notepad++ ->"设置"菜单->"首选项"按钮->制表符设置->python->取消默认,勾选转换为空格。

2、配置调试工具

1. Notepad++ ->"运行"菜单->"运行"按钮

2. 在弹出的窗口内输入以下命令:

cmd /k cd /d "$(CURRENT_DIRECTORY)" & python "$(FILE_NAME)" & ECHO. & PAUSE & EXIT

然后点击“保存”,随意取一个名字,比如“RunPython”,为方便,配置一下快捷键(比如 Ctrl + F5),点OK即可。之后运行Python文件只要按配置的快捷键或者在运行菜单上点“RunPython”即可。

注意不要跟已有的快捷键冲突。查看已有的快捷键,可以点击"运行"菜单->"管理快捷键"按钮 查看

3. 命令解释

cmd /k cd /d "$(CURRENT_DIRECTORY)" & python "$(FILE_NAME)" & ECHO. & PAUSE & EXIT

cmd /k python: 表示打开Cmd窗口,运行/k后边的命令,并且执行完毕后保留窗口。此处即python(因为在环境变量里已经添加了Python目录,所以这里不用指定Python程序的目录,就可直接找到)

cmd /d:跳转到后面指定的目录,即$(CURRENT_DIRECTORY),意思是先cd到文件目录,再用python命令运行程序。

$(CURRENT_DIRECTORY):Notepad++的宏定义,表示当前文件所在目录。

$(FILE_NAME) :Notepad++的宏定义,表示当前文件名。

&:用来连接多条命令

ECHO.:目的是为了换行,重点是echo后面的"." ,可以去掉点试试会发生什么?

PAUSE: 表示运行结束后暂停(cmd中显示“请按任意键继续. . .”),等待一个按键继续

EXIT: 表示“按任意键继续. . .”后,关闭命令行窗口。

4.notepad++宏定义:

FULL_CURRENT_PATH
  the fully qualified path to the current document.
CURRENT_DIRECTORY
  The directory the current document resides in.
FILE_NAME
  The filename of the document, without the directory.
NAME_PART
  The filename without the extension.
EXT_PART
  The extension of the current document.
NPP_DIRECTORY
  The directory that contains the notepad++.exe executable that is currently running.
CURRENT_WORD
  The currently selected text in the document.
CURRENT_LINE
  The current line number that is selected in the document (0 based index, the first line is 0).
CURRENT_COLUMN
  The current column the cursor resides in (0 based index, the first position on the line is 0).

以上内容是我参考别人文章修改后的,解决了原文最后一个问题(cmd 后面加/d)

推荐再看看原文:http://www.cnblogs.com/zhcncn/p/3969419.html

3、自动换行插件

Python Indent 在线安装即可。

posted @ 2015-12-19 16:19  cn_Net  阅读(5908)  评论(0编辑  收藏  举报