Joe*_*ley 361
.*\n.*\nzes*_*ssx 96
你可以轻松地做到:
编辑:
(.*(\n|$)){2}表达小智 11
我正在寻找一种在崇高中选择备用线的方法.
感谢Joe Daley给出了一个非常好的答案.虽然我意识到,如果使用正则表达式,如果文件末尾没有换行符,则不会选择文件中的最后一行.
我想改进这个答案,但我现在似乎没有足够的声誉来评论上面的答案.
您可以在打开正则表达式的情况下使用以下搜索字符串,然后按alt + enter.接着是左箭头.这会将光标分别放在备用线上(与Joe Daley解释的步骤相同)
^.*\n.*$
Run Code Online (Sandbox Code Playgroud)
您可以尝试使用插件: Tools/New Plugin...
import sublime_plugin
class ExpandSelectionToOtherLinesCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().run_command("expand_selection", {"to": "line"})
start_region = self.view.sel()[0]
self.view.window().run_command("select_all")
self.view.sel().subtract(start_region)
Run Code Online (Sandbox Code Playgroud)
将此文件保存在您的Packages/User.
然后,为该插件添加键绑定:
{ "keys": ["super+alt+l"], "command": "expand_selection_to_other_lines" }
Run Code Online (Sandbox Code Playgroud)
此命令将选择所有其他行.选择其他行后,可以使用Split selection into lines命令(Mac上的Ctrl+ Shift+ L,Cmd+ Shift+ L).
如果你想在一个快捷方式中拥有everythnig,你可以像这样修改插件:
import sublime_plugin
class ExpandSelectionToOtherLinesCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().run_command("expand_selection", {"to": "line"})
start_region = self.view.sel()[0]
self.view.window().run_command("select_all")
self.view.sel().subtract(start_region)
self.view.window().run_command("split_selection_into_lines")
self.view.window().run_command("move", {"by": "characters", "forward": False})
Run Code Online (Sandbox Code Playgroud)
最后一行仅用于删除选择,在选定行的开头留下多个游标.
| 归档时间: |
|
| 查看次数: |
63108 次 |
| 最近记录: |