Sublime Text 2 向上/向下箭头移动键绑定
当我在 Sublime Text 2 上有一行文本时,假设我有“test”行。 如果插入符号位于“e”和“s”之间,并且我按向上按钮,则不会执行任何操作。 我想改变这一点,所以如果当前行上方没有行,当我按下时,插入符号应该转到行的开头。
与向下按钮相同。 如果当前行之间没有行,则插入符号应移动到行尾。
这是默认的文本伙伴行为,我经常使用它。
我可以用键绑定在 Sublime Text 2 上更改它吗? 我知道它应该是这样的:
{ "keys": ["up"], "command": "move", "args": {"by": "characters", "forward": false } ,“上下文”:
[
{ "key": "something", "operator": "not_regex_contains", "operand": "\n" }
] }
我找不到合适的上下文。我尝试了 previous_text not_regex_contains "\n",但 previous_text 只返回当前行开头和插入符号之间的文本。
有什么想法吗?
谢谢。
when i have one line of text on sublime text 2, say I have the line "test".
if the caret is between 'e' and 's' and I press the up button, it doesn't do anything.
I would like to change that, so if there is no line above the current one, when I press up, the caret should go to the start of the line.
same with down button.
if there is no line between the current line, the caret should move to the end of the line.
that is the default textmate behavior, and I use it a lot.
can I change that on sublime text 2 with keybindings?
I know it should be something like this:
{ "keys": ["up"], "command": "move", "args": {"by": "characters", "forward": false }, "context":
[
{ "key": "something", "operator": "not_regex_contains", "operand": "\n" }
] }
I cannot find the right context for it. I tried preceding_text not_regex_contains "\n", but preceding_text only returns the text between the start of the current line and the caret.
any ideas?
thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不需要按键绑定来完成此操作。在
Preferences.sublime-settings
文件中添加以下行应该可以解决问题:"move_to_limit_on_up_down": true,
终止逗号的原因是因为这些文件采用 json 格式,如果在此之后有条目,则需要用逗号分隔它们。作为参考,这里以我的 Preferences.sublime-settings 文件为例:
您可以通过转到
Preferences > 来编辑此文件。设置 - Sublime 中的用户
。You don't need a keybind to accomplish this. Adding the following line in your
Preferences.sublime-settings
file should do the trick:"move_to_limit_on_up_down": true,
The reason for the terminating comma is because these files are in json, and if you have entries after this one, you'll need to separate them by comma. For reference, here's my Preferences.sublime-settings file as an example:
You can edit this file by going to
Preferences > Settings - User
in Sublime.这应该可以像您在最新的开发版本中所期望的那样工作 - http://www.sublimetext.com/dev。
This should work as you'd expect in latest dev builds - http://www.sublimetext.com/dev.