I am currently trying to experiment with using VSCode at the moment, and i cannot figure out how to properly define macros and bind them to specific keybinds.
I am used to using Sublime text, and i have defined a few macros that help me type much quicker and make less mistakes
The macros that i would like to get are the following:
- alt+shift+q : which types
\(\)
and set the cursor in the middle (between the first(
and the second\
). - alt+shift+s : which types
\[\]
and set the cursor in the middle (between the first[
and the second\
). Additionally, if it is possible, i would like it to also toggle a math preview function usinglatex-workshop.toggleMathPreviewPanel
. - alt+shift+a : which types the following
\begin{align*}
\item
\end{align*}
The \item
is preceded by a tab
, and it sets the cursor after the \item
I have managed to get the first macro by doing as follows
- Installing the macros package by geddski.
- Creating the following macro, and inserting it in the
settings.json
:
"macros": {
"latex_inline_math": [
{
"command": "type",
"args": {
"text": "\\(\\)"
}
},
"cursorLeft",
"cursorLeft"
],
}
- Binding it to the keybind by inserting in the
keybindings.json
like this:
{ // to get \(\)
"key": "alt+shift+q",
"command": "macros.latex_inline_math"
},
But i cannot figure out how to get the macros 2. and 3.
Also, if there is a better way to write the macro that i wrote, please let me know