visual-studio-code - Search selected text in all workspace files without having to hit the enter key to actually start the search?
问题描述
I know how to search the selected text just by Ctrl-Shift-F, then enter key. I want to these two steps to be one keybinding. How can i achieve this?
解决方案
使用我的扩展查找和转换
和这个键绑定:
{
"key": "alt+shift+f", // whatever keybinding you wish
"command": "runInSearchPanel",
"args": {
// open Search Panel with current workspace as the `files to include`
"filesToInclude": "${workspaceFolder}",
"triggerSearch": true
}
}
这很容易。演示:
您还可以保存查找/替换参数以重复使用等等。
这也有效:
在你的 settings.json 中创建这个宏命令:
"macros": { "findInAllFiles": [ "workbench.action.findInFiles", "search.action.refreshSearchResults" ] }
在您的 keybindings.json 中为该宏创建一个键绑定:
{ "key": "ctrl+. ctrl+.", "command": "macros.findInAllFiles" }
我使用Ctrl- . Ctrl-.只是为了确保它是独一无二的。但它也适用于Ctrl- Shift- F,该workbench.action.findInFiles
命令的默认键绑定。
- 重新加载或重新启动 vscode! 必须这样做。
- 选择要在所有文件中搜索的术语 - 您不必复制它,只需选择它即可。
- 在上面执行您选择的键绑定。
推荐阅读
- dart - 在 Dart 的构造函数中使用网络调用初始化变量
- ios - 为什么在这个表格视图中滚动如此不稳定?
- angular6 - Angular 8 中的可重用类型(接口)
- javascript - 进度条不起作用 文件正在上传 firebase
- elasticsearch - 在 Elasticsearch 中,如何区分 Apple Inc. vs apple (fruit)
- java - 如何在运行时通过反射获取归档类型?
- powershell - 如何使用 PowerShell 从 Azure CloudShell 访问 Azure DevOps REST API?
- awk - 将行输出到与第 n 列同名的文件
- java - For循环,永无止境
- python - 在非 GUI 代码中访问 fbs 资源文件