Home Download Buy Blog Forum Support

Stop automatic indent for certain lines in snippets?

Stop automatic indent for certain lines in snippets?

Postby nivekmai on Sat Jun 15, 2013 1:25 am

Is there a way in sublime text to make it so that snippets, or parts of snippets are not automatically indented with the rest of the text?

My example is this:

Code: Select all
echo <<<${2:UPDATE}
<script type="${4:text/javascript}">
${5:var ${3:terminal} = document.getElementById('${3:terminal}');
${3:terminal}.innerHTML += "${1:Output}<br />";}
${6:${3:terminal}.scrollTop = ${3:terminal}.scrollHeight;}

As you can see, the snippet is mainly a heredoc in php. However, as heredocs in PHP require that the closing identifier is in the first column of the file, I run into problems with this when I call the snippet while not inside the first column.

The only current workaround I can figure out is to add an edit just before the heredoc closing identifier line so that I can delete all the indentation manually (and somewhat easily).

Does anyone know a way to specify that the closing identifier line not be indented (note that I do actually want the automatic indentation everywhere else in the editor, just not on the closing line of the heredoc.
Posts: 1
Joined: Sat Jun 15, 2013 1:17 am

Return to General Discussion

Who is online

Users browsing this forum: demetris, Google [Bot], mlf and 26 guests