Feature Suggestion: math preview work with a shortcut
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.
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.
I see - so it would be a shortcut to turn it on/off
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.
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 .
@r-stein How do I create such a shortcut most easily?
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" }
]
},
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.)
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.