30

崇高的文字word_separator是:

"word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?",

我还希望将 CamelCase 中的大小写更改视为更改。有没有设置/方法可以做到这一点?

(例如在 FooBar 中 ctrl+bck_space 应该只删除 Bar)。

4

5 回答 5

50

如果有人还在看这个......

在您的默认键绑定中,您会发现:

{ "keys": ["ctrl+left"], "command": "move", "args": {"by": "words", "forward": false} },
{ "keys": ["ctrl+right"], "command": "move", "args": {"by": "word_ends", "forward": true} },
{ "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} },
{ "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true} },

{ "keys": ["alt+left"], "command": "move", "args": {"by": "subwords", "forward": false} },
{ "keys": ["alt+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} },
{ "keys": ["alt+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} },
{ "keys": ["alt+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} },

使用 alt+direction 将按“子词”而不是“词”移动,这会考虑驼峰式。我更喜欢默认设置,所以我将 alt+direction 设置复制到我的用户键绑定中,并用 ctrl 替换了 alt 的实例。瞧,ctrl+direction 以驼峰命名方式以及定义的单词分隔符移动。

另外,我不确定使用 subwords 设置是否会考虑下划线,我总是在单词分隔符中添加 _ 以确保。

于 2013-10-30T03:47:00.857 回答
5

使用 alt 仅适用于移动,不适用于删除,但我发现一些效果很好:

向前删除(alt+delete):

delete_subword.sublime-macro:
[
   {
      "command": "move",
      "args": {
         "by": "subwords",
         "extend": true,
         "forward": false
      }

   },
   {
      "args": null,
      "command": "left_delete"
   }
]

向后删除(alt+退格)

delete_subword_forward.sublime-macro:
[
   {
      "command": "move",
      "args": {
         "by": "subwords",
         "extend": true,
         "forward": true
      }
   },
   {
      "args": null,
      "command": "right_delete"
   }
]

将其保存到您的用户目录中。现在,您可以像这样绑定键:

{ "keys": ["alt+backspace"], "command": "run_macro_file", "args": {"file": "Packages/User/delete_subword.sublime-macro"} },
{ "keys": ["alt+delete"], "command": "run_macro_file", "args": {"file": "Packages/User/delete_subword_forward.sublime-macro"} },

资源

于 2013-11-28T10:17:11.803 回答
4

我认为这只能通过插件来完成,而不仅仅是通过更改 Sublime Text 的设置。

这个插件看起来很有前途:
https ://github.com/jdc0589/CaseConversion

于 2013-08-02T09:08:52.350 回答
0

Alt + W在 vim 模式下适用于我在 sublime text 3 中遍历 camelCase 单词

于 2015-01-26T23:19:38.760 回答
0

您可以尝试调整此动作并查看此包中提供自定义动作代码的示例代码:
https ://github.com/robertcollier4/KeyboardNavigation
https://packagecontrol.io/packages/KeyboardNavigation

KeyboardNavigation - 键盘移动和选择以及删除到自定义分隔符。在相邻边界之间快速导航。对于 SublimeText。

于 2019-04-29T06:52:58.380 回答