Sin*_*int 12 python plugins editor selection sublimetext2
我想知道是否已经存在一种方法将选择范围扩展到Sublime Text 2框所建议的所有区域,因此无需按Ctrl- D有时Ctrl- K- D如使用Ctrl + D时如何跳过匹配所示Sublime Text 2中的多个选择?
90%的时间屏幕上的方框正是我想多次选择的,如果有一个关键选项,这将非常方便.
例如,如果你有
foo(2,42,23,2,2)
Run Code Online (Sandbox Code Playgroud)
然后你点击前两个,这些方框只会显示三个单独的2.这些我想用一个命令/宏选择.
如果你选择Ctrl- D你必须跳过42和23的2s Ctrl- K- D.
如果不存在这样的情况,那么编写用于此类功能的插件的任何指针都将非常受欢迎.
更新:我有一个很好的建议使用Alt+ F3,这对于在整个文件中进行更改非常棒.但是,将多个select的范围限制为当前可见页面或标记或括号或其他内容也是有益的.
对于这种情况,我做了以下事情:
输入一个条目Key bindings - User:
{ "keys": ["alt+s"], "command": "toggle_in_selection", "context":
[
{ "key": "setting.is_widget", "operator": "equal", "operand": true }
]
},
Run Code Online (Sandbox Code Playgroud)
注意:您可以选择其他组合键.
然后,选择要搜索的文本.您可以使用ctrl+L选择一行,ctrl+shift+m选择您所在的括号内容,或Selection菜单中列出的任何其他方式,或任何其他方式.
提示:创建新文件,选择文件名User.sublime-commands并将其存储在存储Packages/User新插件或用户密钥绑定的文件夹中.并将此片段放入该文件中:
[
// Selection Menu
{ "caption": "Selection: Expand to Paragraph", "command": "expand_selection_to_paragraph" },
{ "caption": "Selection: Expand to Scope", "command": "expand_selection", "args": {"to": "scope"} },
{ "caption": "Selection: Expand to Brackets", "command": "expand_selection", "args": {"to": "brackets"} },
{ "caption": "Selection: Expand to Indentation", "command": "expand_selection", "args": {"to": "indentation"} },
{ "caption": "Selection: Expand to Tag", "command": "expand_selection", "args": {"to": "tag"} }
]
Run Code Online (Sandbox Code Playgroud)
它会将Selection菜单中的扩展选择选项添加到命令调色板中,这样您就不必记住快捷方式.您可以将"标题"更改为最适合您的标题.
选择要搜索的文本后,按ctrl+f或ctrl+i(搜索或增量搜索),使用上面的快捷方式,使"选择中"按钮切换(搜索栏左侧的第六个按钮,如箭头所示)指向右下方垂直条).(可选:按ALT + W切换"全字"按钮(看起来像引号),如果你想匹配免费2的foo(2,42,23,2,2),而不是匹配2的42).一旦你的选择被调整,alt+enter选择所有匹配 - >完成.
您不必编写想要搜索的内容,您可以先选择它并按ctrl+e("slurp_find_string"命令)将其放入搜索栏,然后打开搜索栏,它就会在那里.
所以整个过程如下:
ctrl+e在您要搜索的所选文本上,因此您不必在以后编写它ctrl+f或者ctrl+i打开一个搜索栏,如果你没有1.,写下你搜索的内容alt+enter你就完成了听起来有点复杂,但是一旦你做了10次,整个过程(第2步除外)不会花费你一秒多的时间.另外,如果您调整一些升华设置,您可以让它为您自动切换一些内容,例如在任何选择时自动切换+ e,或者每当您打开带有打开选择的搜索栏时自动切换选择.
注意:如果您使用mac或Windows,您的快捷方式可能会有所不同.
希望它有所帮助,如果有什么不清楚,请多询问......
编辑:我正在玩关键设置一段时间,最后得到这个:
// without whole-words
{ "keys": ["ctrl+space", "f"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":false, "in_selection": false, "whole_word": false}, "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
]
},
{ "keys": ["ctrl+space", "f"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":false, "in_selection": true, "whole_word": false}, "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
]
},
//with whole-words
{ "keys": ["ctrl+space", "w"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":false, "in_selection": false, "whole_word": true}, "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
]
},
{ "keys": ["ctrl+space", "w"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":false, "in_selection": true, "whole_word": true}, "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
]
},
Run Code Online (Sandbox Code Playgroud)
如果你把它放在某个地方Key bindings - User,它会给你两个快捷方式,"ctrl+space", "f"(ctrl+space首先,后跟f,类似的"ctrl+k", "ctrl+d"),和"ctrl+space", "w".第一个为您提供增量搜索面板,禁用全字,第二个启用全字.根据您在按下快捷方式时是否选择了某些内容,它们都会根据您选择的内容进行预选.如果你看一下,你应该知道如何根据自己的愿望调整它.
| 归档时间: |
|
| 查看次数: |
1257 次 |
| 最近记录: |