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

前端 未结 2 352
臣服心动
臣服心动 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:24

    Things got a little simpler since Emacs 24.4. There's now a M-x superword-mode that has the desired effect.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题