I use AutoHotkey text replacements for a number of snippets for web development. My text editor (Sublime Text, highly recommended) automatically does some formatting of the text. For example, when you use a curly brace, it automatically indents your next line another tab and when you do a closing brace it automatically moves it back a tab. Anyway, I had to spend a while writing a function that would anticipate this and edit the text being sent accordingly. So in my script I can paste text in a new hotstring like below:
Code:
:*?:__hotstring::
Var =
(
if(this)
{
that
}
)
snippet(Var)
Return
And when I enter the hotstring, it will automatically format that string so it isn't messed up by sublime text. (Otherwise the line with the tab and each successive line would be indented too far since Sublime text automatically indents after a Curly Brace)
Anyway, all of that is basically to explain how it works. The problem I'm encountering is that I have some snippets I want to use where I have some relatively complex nested ifs. I have always done complex nested ifs like so, because it is the quickest for me to make sense of:
Code:
if(
x > y &&
(
z == a ||
b >= c
)
){
that
}
The problem is that the continuation section is started by a ( by itself on a line and closed with a ) by itself on a line. Is there anyway to change what character is delimiting the continuation section? If I tried to use the if above in my usual snippet function, Var would only contain:
Code:
if(
x > y &&
(
z == a ||
b >= c
So what I'm wanting is to be able to use code similar to this:
Code:
Var =
(
if(
x > y &&
(
z == a ||
b >= c
)
){
that
}
)
That will allow me to store that full block of code into the Variable. This could be achieved by using different delimiters for the continuation section, but I couldn't figure out if that's possible. Anyone know if it is? Or know of a workaround that might be functionally similar? I know I could just change my formatting, but it's hard to break habits and I like the way I do the ifs.