Một giải pháp khả thi là sử dụng dấu trang (nếu bạn chưa có). Tôi không biết các ràng buộc khóa Linux trên đỉnh đầu của tôi, nhưng bạn có thể thêm dấu trang, sau đó chọn tất cả. Để xem các ràng buộc cho nền tảng của bạn, hãy truy cập Goto -> Bookmarks
, chúng sẽ được liệt kê theo lệnh. Bạn cũng có thể xem tập tin ràng buộc khóa mặc định.
Giải pháp thứ hai là sử dụng plugin. Tôi đã viết sau đây một lúc trước. Có thể không thực sự nói nếu nó hoạt động tốt như thế nào, vì tôi không thể nhớ được. Một thử nghiệm nhanh với nó khiến tôi tin rằng nó hoạt động tốt.
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])
Nối kết phím sẽ giống như thế
{ "keys": ["alt+a"], "command": "multi_cursor", "args": {"action": "add"} },
{ "keys": ["alt+s"], "command": "multi_cursor", "args": {"action": "show"} }
Có lẽ plugin mà mọi người đã viết rằng đang kiểm soát gói làm điều tương tự, tôi chỉ là không biết đến chúng.