I am currently working with fortran in Sublime Text and I'm adding some snippets to make the workflow faster.
Since fortran does not support the ++ or -- operators, I would like to make snippets that will change these operators to the explicit increment and decrement statements.
For example
a++
becomes
a = a + 1
and
a--
becomes
a = a - 1
I have successfully implemented the ++ snippet as follows.
<snippet>
<content><![CDATA[ = $TM_CURRENT_WORD + 1]]></content>
<tabTrigger>++</tabTrigger>
<description>i = i + 1</description>
<scope>source.fortran</scope>
</snippet>
However, my implementation of the -- snippet fails to trigger.
<snippet>
<content><![CDATA[ = $TM_CURRENT_WORD - 1]]></content>
<tabTrigger>--</tabTrigger>
<description>i = i - 1</description>
<scope>source.fortran</scope>
</snippet>
Does anyone have any suggestions on how to get the -- snippet to trigger? Thanks.
Adding a key binding for the 3-key sequence of minus,minus,tab will do the trick:
{ "keys": ["-", "-", "tab"],
"command": "insert_snippet",
"args": {"name":"Packages/Fortran/MinusMinus.sublime-snippet"}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With