命中输入时,python-mode缩进不起作用
I just installed python-mode
from ELPA and when I hit Enter the cursor goes straight to the beginning of the next line. For instance for the following code:
我刚刚从ELPA安装了python-mode,当我按Enter键时,光标直接进入下一行的开头。例如,对于以下代码:
def hello_world():
print "hello world!"
for i in range(3):
print "hello again"
return 0
I have to hit TAB after Enter every time after I hit Enter to go to a new-line (although interestingly TAB sends the cursor to the right place).
每次按Enter键进入换行符后,我必须在Enter后点击TAB(尽管有趣的是TAB将光标发送到正确的位置)。
When I installed python-mode
I got some warning messages relating to indentation which I don't really understand, here is a link to those warning messages.
当我安装了python-mode时,我得到了一些与缩进相关的警告消息,我并不理解,这里是这些警告消息的链接。
3 个解决方案
#1
4
C-j is the key I was looking for ('newline-and-indent' command). I managed to rebind Enter to this by putting the following hook in my init.el:
C-j是我正在寻找的关键('newline-and-indent'命令)。我设法通过在我的init.el中放入以下钩子来重新绑定Enter:
(add-hook 'python-mode-hook
(lambda ()
(define-key python-mode-map "\r" 'newline-and-indent)))
更多相关文章
- pylogin系列之V2EX自动领币消息提醒
- Linux下多任务间通信和同步-消息队列
- MYSQL存储过程,函数,光标
- 安卓消息处理机制
- JAVA实现 springMVC方式的微信接入、实现消息自动回复
- 为什么我们应该将XMPP而不是JSON用于简单(仅文本)消息传递应用程序
- SQLite的Android光标在方法调用时崩溃
- Android[中级教程] 深入剖析Android消息机制
- 更改Edittext光标的颜色与粗细