Hello_World是Python中的一个单词,在其他模式中是不同的。我怎么改? [英] Hello_World is a word in Python, it is different in an other mode. How I change it?

查看:115
本文介绍了Hello_World是Python中的一个单词,在其他模式中是不同的。我怎么改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在python模式下,当我 forward-word 。光标从 H 跳转到 d (Hello_World)。但是在另一个模式( shell-mode c-mode )中,光标从 H _

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 _.

我想要在Python模式下获得的结果,即使在其他模式下。我该怎么办?

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

PS:我以前看过类似的问题,我搜索过,但我找不到。

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

推荐答案

我想你在找:

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

下划线将被视为单词的一部分。此命令将更改您当前使用的模式的语法表。AFAIK没有办法全局更改语法但是,您可以尝试修改标准语法表。大多数主要模式都继承了标准语法表。

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.

这篇关于Hello_World是Python中的一个单词,在其他模式中是不同的。我怎么改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆