Hello_World is a word in Python, it is different in an other mode. How I change it?

前端 未结 2 388
臣服心动
臣服心动 2021-01-18 08:45

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

2条回答
  •  生来不讨喜
    2021-01-18 09:34

    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.

提交回复
热议问题