Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2: soft wrap lines -> reverse indentation?

Tags:

sublimetext2

I've started using Sublime Text 2, and its community of plugins, as my Dreamweaver replacement (thank the Gods). I love Sublime and clearly won't realize many of its features for months or years to come, but there's a simple setting I've had trouble figuring out.

I've used BBedit lots in the past. One feature I'm very attached to is the ability to "reverse" indent lines when soft-wrapped, such that line wrapping looks like this:

Text text blah blah blah blah long enough to wrap
  to a new line blah whenever soft wrap happens it
  reverse-indents like this.
Here's a new line with no indent.

Maybe I shouldn't be so married to a seemingly minor feature, but I find it much easier to read code when it's not possible to confuse the beginning of a line with "tailings" of a long line. Does anyone know how to do this in Sublime?

like image 693
Topher Hunt Avatar asked Oct 21 '22 08:10

Topher Hunt


1 Answers

After further use, I think I've figured this out. Apparently Sublime's default (and only) behavior is to reverse-indent code lines, but leave html lines flush. So when I'm editing a PHP/HTML document, my wrapped lines will reverse-indent about half the time, depending on whether I'm in an tag or in a fragment at that line break.

The effect on my code is something like this:

<!-- Wrapped HTML doesn't reverse indent -->
<a href='long_link_that_causes_lines_to_wrap' other_attribute='
jquery_thing_that_makes_lines_wrap'>something</a>
...
<!-- Wrapped PHP snippets do reverse indent -->
<? echo date('M jS', strtotime('some_interpolated_formatting_string', 
  $some_variable_expression)); ?>
like image 144
Topher Hunt Avatar answered Oct 25 '22 20:10

Topher Hunt