在VSC中打开特定文件的快捷方式? [英] Shortcut to open a specific file in VSC?

查看:70
本文介绍了在VSC中打开特定文件的快捷方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想定义一个键盘快捷方式来打开一个特定的文件(在本例中是我的待办事项文件).

I'd like to define a keyboard shortcut to open a specific file (in this case my todo file).

我不知道是否可以在键盘设置中使用命令.

I don't know if there is a command I can use in the keyboard settings.

感谢您的帮助.

推荐答案

您可以完成任务,方法如下:

You can do it with tasks, here is how:

打开您的 tasks.json 文件:

F1 -> type: "Tasks: Configure Tasks" -> select: "Open tasks.json file"

粘贴以下内容:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "openMyFile",
            "type": "shell",
            "command": "path_to_your_VSCode path_to_your_file.txt"
        },
    ]
}

在您的 keybindings.json 中添加:

{
    "key": "ctrl+scrolllock", # Or some other binding
    "command": "workbench.action.tasks.runTask",
    "args": "openMyFile" # <- Your task's name in this case openMyFile
},

应该这样做.

这篇关于在VSC中打开特定文件的快捷方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆