LaTeXTools icon indicating copy to clipboard operation
LaTeXTools copied to clipboard

Feature Suggestion: math preview work with a shortcut

Open diego898 opened this issue 8 years ago • 8 comments

I think it would be great to have a fourth option to preview_math_mode, which is something like manual, meaning I specify some shortcut to toggle the preview on/off.

diego898 avatar Jan 29 '17 00:01 diego898

Related #914. You mean, that you press a shortcut inside a math environment and it opens?

Because you can create a shortcut to change the settings to disable or enable it for the view.

r-stein avatar Jan 29 '17 07:01 r-stein

I see - so it would be a shortcut to turn it on/off

diego898 avatar Jan 29 '17 18:01 diego898

Creating a shortcut to turn it on/off would be very trivial. Adding a shortcut to open a phantom would not so trivial, because the current behavior works with listeners not with command triggers.

r-stein avatar Jan 29 '17 19:01 r-stein

Got it!

On Sunday, January 29, 2017, Richard Stein [email protected] wrote:

Creating a shortcut to turn it on/off would be very trivial. Adding a shortcut to open a phantom would not so trivial, because the current behavior works with listeners not with command triggers.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SublimeText/LaTeXTools/issues/1017#issuecomment-275939873, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtUByhHnWnK6hFZ665CFpyaHGSVNTIwks5rXOowgaJpZM4LwqP4 .

diego898 avatar Jan 29 '17 21:01 diego898

@r-stein How do I create such a shortcut most easily?

ViktorQvarfordt avatar Feb 11 '17 15:02 ViktorQvarfordt

You can create a keybinding to change it for the view:

    // disable preview math mode
    {
        "keys": ["ctrl+l", "ctrl+t", "ctrl+m"],
        "command": "set_setting",
        "args": {
            "setting": "preview_math_mode",
            "value": "none"
        },
        "context":
        [
            { "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
        ]
    },
    // enable preview math mode for the selected math env
    {
        "keys": ["ctrl+l", "ctrl+t", "ctrl+shift+m"],
        "command": "set_setting",
        "args": {
            "setting": "preview_math_mode",
            "value": "selected"
        },
        "context":
        [
            { "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
        ]
    },

r-stein avatar Feb 11 '17 16:02 r-stein

Cool, thanks! Do you know if it's possible to have a key bind that toggles between non-boolean settings? (I.e. not two different key binds, but just one.)

ViktorQvarfordt avatar Feb 14 '17 07:02 ViktorQvarfordt

Yes it is possible, but it requires a small context listener, because the default setting context does not seem to work with more than booleans.

r-stein avatar Feb 14 '17 16:02 r-stein