dongtan8532 2012-01-25 10:23 采纳率: 0%
浏览 75
已采纳

如何将PHP / Python解释器集成到Notepad ++中

I want If I am editing a php file I should be able to press a key combination or click a menu item that'll launch the php-cli and run my current file? How do I do it in Notepad++.

Also I need this for Python.

  • 写回答

2条回答 默认 最新

  • dongren2128 2012-02-15 18:48
    关注

    I honestly don't recommend installing an IDE for Python unless you use it for large-scale projects or work on large, complex scripts on a daily basis. Notepad++ works great with the NppExec plugin. I use the following steps:

    1. Download (if it does not already exist) the NppExec plugin and place the .dll file in [Notepad++ installation path]\plugins

    2. Open a Python file in Notepad++, press <kbd>F6</kbd> to execute

    3. Type the following lines in the window that pops up:

      NPP_SAVE
      python "$(FULL_CURRENT_PATH)"
      
    4. The above lines basically tell NppExec to "save the current Python file and run it using the version of python that first appears in the path environment variables"

    5. Click on "Save" and type in a recognizable name such as 'run_python'

    6. Go to the menubar, Plugins -> NppExec -> Advanced Options..

    7. Under 'Menu item', choose the script we just created above, and 'Add/Modify' it to the Menu items with a suitable name. This allows us to assign shortcut keys through Settings -> Shortcut Mapper -> Plugin commands

    8. Navigate to the script name and choose any shortcut keys like <kbd>Ctrl</kbd>+<kbd>R</kbd>

    9. Use the shortcut <kbd>Ctrl</kbd>+<kbd>R</kbd> to save and run the Python file

    A few points to note when using NppExec:

    • Make sure that you check the option Plugins -> NppExec -> Follow $(CURRENT_DIRECTORY). This makes sure that Python looks for the script in the current path, not the Notepad++ path.

    • The console window that docks to the main editor window does not have word wrap turned on by default. Use <kbd>Ctrl</kbd>+<kbd>W</kbd> within the console to activate word wrap and not miss any useful output data

    • Kill a running Python script by pressing <kbd>Ctrl</kbd>+<kbd>C</kbd> within the console window

    Once all this is done, Notepad++ basically functions like an IDE. It may lack features like pdb debugging, but it works really well with Python. I'm pretty sure the execution steps for Perl/PHP scripts are also more or less similar.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码