Sam*_*abu 2 visual-studio-code
要搜索特定字符串,我正在使用Ctrl+ F。在使用F3我找到带有字符串的行列表后,我将移动到下一个匹配项,并使用Shift+F3转到上一个匹配项。
移动到最后一次出现和第一次出现的键绑定是什么?
看起来没有内置的键绑定可以转到第一个/最后一个查找匹配。但是很容易制作一个可以做到这一点的宏。
在最近对multi-command(下面的链接)扩展进行了一些更改之后,现在很容易做到(在 中keybindings.json):
{
"key": "alt+m", // whatever keybindings you wish
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"cursorTop",
"editor.action.nextMatchFindAction"
]
},
// "when": "editorTextFocus"
},
{
"key": "shift+alt+m",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"cursorBottom",
"editor.action.previousMatchFindAction"
]
},
// "when": "editorTextFocus"
}
Run Code Online (Sandbox Code Playgroud)
您不再需要settings.json文件中的任何内容。上面的键绑定就足够了。
上一个答案:
使用像multi-command这样的宏扩展,把它放到你的 settings.json 中:
"multiCommand.commands": [
{
"command": "multiCommand.gotoFirstFindMatch",
"sequence": [
"cursorTop",
"editor.action.nextMatchFindAction",
]
},
{
"command": "multiCommand.gotoLastFindMatch",
"sequence": [
"cursorBottom",
"editor.action.previousMatchFindAction",
]
}
]
Run Code Online (Sandbox Code Playgroud)
这些只是基于这样一个事实,如果您首先转到文件顶部,然后转到next查找匹配项,它将是第一个。同样转到最后一个查找匹配项:首先转到文件末尾,然后查找previous查找匹配项。
您将需要自己的键绑定来触发这些命令。在 keybindings.json 中:
{
"key": "alt+m",
"command": "extension.multiCommand.execute",
"args": { "command": "multiCommand.gotoFirstFindMatch" }
},
{
"key": "shift+alt+m",
"command": "extension.multiCommand.execute",
"args": { "command": "multiCommand.gotoLastFindMatch" }
},
Run Code Online (Sandbox Code Playgroud)
在这里,我用m了match,而且因为这些绑定可能与你有任何其他的按键组合不冲突。但是选择您想要的任何组合键。
[针对多命令 1.40 更新了键绑定]
| 归档时间: |
|
| 查看次数: |
705 次 |
| 最近记录: |