Sublimetext3 升华文本多光标快捷方式
我是emacs的超级用户,我绝对喜欢不用鼠标就能做任何事情。我认为这个特性使emacs非常有效Sublimetext3 升华文本多光标快捷方式,sublimetext3,shortcut,Sublimetext3,Shortcut,我是emacs的超级用户,我绝对喜欢不用鼠标就能做任何事情。我认为这个特性使emacs非常有效 我也是Linux上Sublime文本的忠实粉丝。我喜欢使用Ctrl+left\u mouse\u clik启用的多光标功能。我还发现,您可以单击Shift+alt+arrow\u up\u或\u down,在上面或下面的行上创建一个新光标。因此,我想知道在sublime text中是否有一种方法可以在任何地方创建多个光标,而无需使用鼠标。一种可能的解决方案是使用书签(如果您还没有)。我不知道Linux
我也是Linux上Sublime文本的忠实粉丝。我喜欢使用
Ctrl+left\u mouse\u clik
启用的多光标功能。我还发现,您可以单击Shift+alt+arrow\u up\u或\u down
,在上面或下面的行上创建一个新光标。因此,我想知道在sublime text中是否有一种方法可以在任何地方创建多个光标,而无需使用鼠标。一种可能的解决方案是使用书签(如果您还没有)。我不知道Linux密钥绑定是怎么回事,但是你可以添加书签,然后选择all。要查看平台的绑定,请转到Goto->Bookmarks
,命令应列出这些绑定。您还可以查看默认密钥绑定文件
第二种解决方案是使用插件。我不久前写了以下内容。真的说不出它是否/有多好,因为我不记得了。一个快速的测试让我相信它可以正常工作
import sublime
import sublime_plugin
class MultiCursorCommand(sublime_plugin.TextCommand):
def run(self, edit, action="add"):
self.key = "multi_cursor"
cursors = self.view.sel()
saved_cursors = self.view.get_regions(self.key)
if action == "add":
self.view.add_regions(self.key, list(cursors) + saved_cursors, "keyword", "", sublime.DRAW_EMPTY)
elif action == "show":
cursors.add_all(saved_cursors)
self.view.add_regions(self.key, [])
elif action == "show_begin":
saved_cursors += list(cursors)
cursors.clear()
cursors.add_all([c.begin() for c in saved_cursors])
self.view.add_regions(self.key, [])
elif action == "show_end":
saved_cursors += list(cursors)
cursors.clear()
cursors.add_all([c.end() for c in saved_cursors])
self.view.add_regions(self.key, [])
elif action == "show_visible":
pass
elif action == "clear":
self.view.add_regions(self.key, [])
elif action == "remove":
for cursor in cursors:
if cursor in saved_cursors:
saved_cursors.remove(cursor)
self.view.add_regions(self.key, saved_cursors, "keyword", "", sublime.DRAW_EMPTY)
class RemoveCursorCommand(sublime_plugin.TextCommand):
def is_enabled(self):
return len(self.view.sel()) > 1
def run(self, edit, forward=True):
self.view.sel().subtract(self.view.sel()[0 if forward else -1])
键绑定看起来像
{ "keys": ["alt+a"], "command": "multi_cursor", "args": {"action": "add"} },
{ "keys": ["alt+s"], "command": "multi_cursor", "args": {"action": "show"} }
可能有一些插件是人们在包控制上编写的,它们做同样的事情,我只是不知道它们 我认为PowerCursors是您需要的