【问题标题】:Sublime text: how to add a key binding to hex_viewer package commandSublime text:如何将键绑定添加到 hex_viewer 包命令
【发布时间】:2014-09-17 08:12:45
【问题描述】:

我已经在 sublime text 3 上安装了 Hex Viewer 包,要切换它,我使用 ctrl+shift+p 打开命令面板,然后搜索“hex”并选择包的命令来切换十六进制查看。

我想知道如何将键绑定到特定的包命令,我知道键绑定配置文件,但我不知道应该添加什么 JSON 行来调用包命令。

这是我关于stackoverflow的第一个问题,如果我做错了什么,抱歉,祝你有美好的一天!

编辑:这是包的 github:https://github.com/facelessuser/HexViewer 它说:

通过命令面板或键绑定提供 10 个命令。

这是我要绑定的那个

十六进制查看器:切换十六进制视图

这是我尝试粘贴到键绑定 JSON 文件上的字符串:

{"keys":["ctrl+shift+h"] , "command":"Hex Viewer: Toggle Hex View"}

【问题讨论】:

标签: sublimetext3 key-bindings


【解决方案1】:

您需要为 Hex Viewer 键映射添加键绑定。

为此,在通过 Package Control 安装 Hex Viewer 后,导航到 Package Settings -> Hex Viewer -> Key Bindings - Default 并添加以下内容:

[
    {
        "keys": ["ctrl+shift+h"],
        "command": "hex_viewer"
    }
]

要保存文件,你需要确保%APPDATA%\Sublime Text 3\Packages\HexViewer 目录存在,假设这是你的包目录。

您提到的其他可用命令的 GitHub 链接上还有一个示例键映射。

Example.sublime-keymap

[
    {
        "keys": ["ctrl+shift+b","ctrl+shift+h"],
        "command": "hex_viewer"
    },
    {
        "keys": ["ctrl+shift+b","ctrl+shift+i"],
        "command": "hex_show_inspector"
    },
    {
        "keys": ["ctrl+shift+b","ctrl+shift+f"],
        "command": "hex_finder"
    },
    {
        "keys": ["ctrl+shift+b","ctrl+shift+e"],
        "command": "hex_editor"
    },
    {
        "keys": ["ctrl+shift+b","ctrl+shift+x"],
        "command": "hex_writer"
    },
    {
        "keys": ["ctrl+shift+b","ctrl+shift+u"],
        "command": "hex_discard_edits"
    },
    {
        "keys": ["ctrl+shift+b","ctrl+shift+="],
        "command": "hex_checksum",
        "args": {"panel": true}
    },
    {
        "keys": ["ctrl+shift+b","ctrl+shift+-"],
        "command": "hash_selection"
    },
    {
        "keys": ["ctrl+shift+b","ctrl+shift+g"],
        "command": "hash_eval"
    }
]

【讨论】:

    【解决方案2】:

    你的绑定应该是

    { "keys": ["ctrl+shift+h"] , "command":"hex_viewer"}
    

    【讨论】:

      【解决方案3】:

      你可以使用这样的东西来为插件分配一个关键的投标

      ->首选项->键-弯曲-用户

      然后添加这个

      [
          { "keys": ["ctrl+shift+x"], "command": "the name of plugin." }
      
      ]
      

      【讨论】:

      • 它不起作用。我已经尝试过这样的事情,但我认为 sublime 并不能真正识别命令名称。
      • 您确定插件名称吗?
      • 是的,但不确定我要写什么。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-23
      • 1970-01-01
      • 2017-02-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多