zoukankan      html  css  js  c++  java
  • Using Notepad++ as IPython default code editor

    IPython supplies you the convenience of editing code from command prompt, the magic command %edit. However in Windows it will use notepad as default editor which is not suitable for editing python source code. Here is the method to config the editor option.

    As IPython official doc said:

    Editor configuration

    IPython can integrate with text editors in a number of different ways:

    • Editors (such as (X)Emacsvim and TextMate) can send code to IPython for execution.
    • IPython’s %edit magic command can open an editor of choice to edit a code block.

    The %edit command (and its alias %ed) will invoke the editor set in your environment as EDITOR. If this variable is not set, it will default to vi under Linux/Unix and to notepad under Windows. You may want to set this variable properly and to a lightweight editor which doesn’t take too long to start (that is, something other than a new instance of Emacs). This way you can edit multi-line code quickly and with the power of a real editor right inside IPython.

    You can also control the editor by setting TerminalInteractiveShell.editor in ipython_config.py.

    What we should do is just set the TerminalInteractiveShell.editor variable in ipython_config.py. So where is the ipython_config.py?

     The official doc gives a method to locating the file, using the command "ipython locate" in command line.

    In my computer, the result is as follows. B.T.W, my os is Win7. 

    >> ipython locate

    C:\Users\xxx\.ipython

    So, just find the ipython_config.py file there, if not exist just create one.

    Then write the following code in the file:

    c = get_config()
    # use DOS style path
    c.TerminalInteractiveShell.editor = "C:/PROGRA~1/Notepad++/notepad++.exe"
    # set editor for Qt Console, if you wish to use that
    c.IPythonWidget.editor = "C:/PROGRA~1/Notepad++/notepad++.exe"

    Enjoy IPython with Notepad++.

  • 相关阅读:
    基于RockMq 实现分布式事务
    开机启动脚本编写
    JS 校验笔记
    git 小计
    EasyExcel简单导入示例
    vue的rule中使用validator(异步请求)验证
    字符串、数值、布尔值、函数参数的解构赋值以及圆括号问题
    对象解构赋值
    数组的解构赋值与yield
    window10的cmd重置子系统ubuntu用户密码以及ubuntu设置密码切换用户
  • 原文地址:https://www.cnblogs.com/nn0p/p/2995266.html
Copyright © 2011-2022 走看看