【问题标题】:Change the "send code to interpreter" (C-c |) command in python-mode在 python 模式下更改“发送代码到解释器”(C-c |)命令
【发布时间】:2014-08-09 20:39:12
【问题描述】:

我习惯用“C-c C-r”命令将代码发送到 R 中的解释器,用 Emacs 讲统计信息。如何将 python 模式设置为使用“C-c C-r”而不是“C-c |”评估代码?

谢谢!

【问题讨论】:

    标签: python emacs python-mode


    【解决方案1】:

    在内置的 python.el 中已经绑定到C-c C-r,但是这里有一个绑定键的命令。如果您使用的是 python-mode.el,则必须更改库名称、命令,可能还有地图。

    (eval-after-load "python"
      '(progn
         (define-key python-mode-map (kbd "C-c C-r") 'python-shell-send-region)))
    

    【讨论】:

    • 感谢您的回复,但我是初学者,所以我不知道您所说的具体在哪里做?我必须在 .emacs 中添加此命令吗?
    • 是的,把它放在你的 ~/.emacs 中。就个人而言,我喜欢制作 ~/.emacs.d 并使用 ~/.emacs.d/init.el 而不是 ~/.emacs。
    • 您也可以将其放入*scratch* 并使用C-M-xC-x C-e 对其进行评估。
    猜你喜欢
    • 2015-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-29
    • 2013-03-29
    • 1970-01-01
    • 2010-10-06
    相关资源
    最近更新 更多