Hi Andreas,
From: Andreas Wahlin andreaswahlin@bredband.net It would be nice to get other symbols rather than just =, I smell a good JSON cleanup :) I suppose you change these two lines? relevant_line_pattern = /^[^=]+=/ column_search_pattern = / *=/
into something .. :/ How'd you change hat to include at least : (semicolon) into the pattern matching?
I don't think just changing the patterns will solve the problem. The reason I haven't gotten to the align-statements version is I'm going to need to break the statements on language elements and then compare those structures across lines to decide where to add spaces. It's non-trivial. To be honest, I haven't had time to figure out the data structures, yet. As I said, it's on my shortlist, but it's been a busy couple of months.
Anyway, the code is AFL, so feel free to make whatever modifications you'd like.
Regards, Chris.
On 7/7/2006, at 20:11, Chris Poirier wrote:
[...] Anyway, the code is AFL, so feel free to make whatever modifications you'd like.
Just FYI I added your command to the Source bundle (key equivalent ⌥⌘] analogous with ⌥⌘[ for Indent Line / Selection.)
I also made the following (minor) change:
@@ -31,7 +31,7 @@ selected_text = ENV.member?("TM_SELECTED_TEXT") relevant_line_pattern = /^[^=]+=/ -column_search_pattern = / *=/ +column_search_pattern = /[\t ]*=/ # @@ -115,7 +115,7 @@ block_top.upto(block_bottom) do |number| if lines[number-1] =~ relevant_line_pattern then - before, after = lines[number-1].split(/ *= */, 2) + before, after = lines[number-1].split(/[\t ]*=[\t ]*/, 2) lines[number-1] = before.ljust(best_column) + " = " + after end end