LaTeXTools
LaTeXTools copied to clipboard
Keybinding for ^ and _ to automate ^{} and _{} not working.
Hi, I'm using the keybinding code from the Wiki, and the improvements to ^ and _ don't function for me. Out of those options, only the first three of these work as intended. The latter two do not work.
// Auto-pair escaped curly brackets (WORKS)
// Auto-pair escaped braces (WORKS)
// Auto-pair escaped parentheses (WORKS)
// Improve the usage of ^ and _ to create ^{} and _{} (DOES NOT WORK)
// Use /, / to insert \frac and *, * to insert \cdot (DOES NOT WORK)
Could someone suggest keybinding code for ^ and _? I'm currently using the provided code.
// Improve the usage of ^ and _ to create ^{} and _{}
{
"keys": ["^", "^"], "command": "insert_snippet", "args": {"contents": "^{${1:$SELECTION}}$0"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex meta.environment.math, text.tex.latex string.other.math" }
]
},
{
"keys": ["^"], "command": "insert_snippet", "args": {"contents": "^{${1:$SELECTION}}$0"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex meta.environment.math, text.tex.latex string.other.math" },
{ "key": "selection_empty", "operator": "equal", "operand": false }
]
},
{
"keys": ["_", "_"], "command": "insert_snippet", "args": {"contents": "_{${1:$SELECTION}}$0"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex meta.environment.math, text.tex.latex string.other.math" }
]
},
{
"keys": ["_"], "command": "insert_snippet", "args": {"contents": "_{${1:$SELECTION}}$0"},
"context": [
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex meta.environment.math, text.tex.latex string.other.math" },
{ "key": "selection_empty", "operator": "equal", "operand": false }
]
},
Please let me know if you need more details. Thanks.
They are working for me. Have you tried the last two key bindings in a math environment, such as align
?