python输出helloworld除第一个o外其他字母,Hello_World是Python中的一个单词,在其他模式中是不同的。我怎么改?...

In python mode, when I forward-word. The cursor jumps from H to d (Hello_World). But in another mode(shell-mode or c-mode), the cursor jumps from H to _.

I want the result which i get in Python mode, even in the other mode. What should I do?

PS: I saw a similar question before, I have searched, but I could't find it.

解决方案

I think you're looking for this:

(modify-syntax-entry ?_ "w")

Underscores will be treated as part of a word. This command will change the syntax table of the mode you're currently in. AFAIK there's no way to change syntax globally. However, you could try modifying the standard syntax table. Most major modes inherit the standard-syntax-table.

(modify-syntax-entry ?_ "w" standard-syntax-table)

If that doesn't work, I guess you have to add mode-hooks for all modes you're using and modify their syntax tables individually.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值