Sublime Forum

[SOLVED] Key bindings from LaTeXing package always active

#1

The LaTeXing package has two key bindings to build .tex files to .pdf files. These are defined in Default (Windows).sublime-keymap (code below). However, they are active all the time, regardless of what type of file is open.

{
    "keys": ["ctrl+super+b"],
    "command": "ltx_quick_build_compiler"
},
{
    "keys": ["shift+ctrl+b"],
    "command": "ltx_quick_build_compiler", "args": {"primary_qb": true}
}

I have tried to make them syntax specific. After reading Syntax Specific Key Binding, my best guess was the code below. But that doesn’t change a thing. Do you have any suggestions?

{
    "keys": ["ctrl+super+b"],
    "command": "ltx_quick_build_compiler",
     "context": { "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
},
{
    "keys": ["shift+ctrl+b"],
    "command": "ltx_quick_build_compiler", "args": {"primary_qb": true},
     "context": { "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
}
0 Likes

#2

You should wrap the context in brackets:

{
    "keys": ["ctrl+super+b"],
    "command": "ltx_quick_build_compiler",
     "context": [{ "key": "selector", "operator": "equal", "operand": "text.tex.latex" }]
},
{
    "keys": ["shift+ctrl+b"],
    "command": "ltx_quick_build_compiler", "args": {"primary_qb": true},
     "context": [{ "key": "selector", "operator": "equal", "operand": "text.tex.latex" }]
}

In addition ensure, that you overwrite the LaTeXing keymap by opening it with PackageResourceViewer.

2 Likes

#3

So, I can’t simply add it my user key bindings? I thought those would have precedence?

0 Likes

#4

You can add these keybidings to your user keymap to take precedence again:

    {
        "keys": ["ctrl+b"], "command": "build", "context":
        [
            { "key": "selector", "operator": "not_equal", "operand": "text.tex.latex" }
        ]
    },
    {
        "keys": ["ctrl+shift+b"], "command": "build", "args": {"select": true}, "context":
        [
            { "key": "selector", "operator": "not_equal", "operand": "text.tex.latex" }
        ]
    },
2 Likes

#5

Fwiw, I reported this like ages ago and it’s still not fixed. I have since switched to LaTeXTools, which works perfectly, is open source and actively maintained.

4 Likes

#6

Thanks for the tip! I tried LaTeXTools some years ago before going with LaTeXing and wasn’t very satisfied. But I’m trying again now and the package seems to have improved immensely. I will probably stick with it from now on.

0 Likes