[TxMt] Re: merge mads379/align.tmbundle into source:Align Assignments command

Tim Bates timothy.c.bates at gmail.com
Wed Nov 14 17:43:08 UTC 2018


> On 14 Nov 2018, at 19:07, Tim Bates wrote:
>> It would be nice if the Align Assignments command absorbed the smart code from the align bundle, which appears moribund (?), but which is much smarter about alignments.

> On 14 Nov 2018, at 12:34 pm, Allan Odgaard <mailinglist at textmate.org> wrote:
> I’m not keen on switching to a preferneces based system because majority of users will not want to customize the Align Assignments command, and I am also not sure what cases (handled by the default command) where the user would actually want to change it.
> But it would be useful to know where the current command gets it wrong or how it can be improved.

For one, given this selection in an R script:

#' selDVs = c("ht1", "ht2")
#' mzData     <- twinData[twinData$zygosity %in% "MZFF", ]
#' dzData <- twinData[twinData$zygosity %in% "DZFF", ]


align does the right thing, and aligns the <- assignments. The built-in align does nothing. So having the built-in do the right thing here would be good.


The preferences system could be independent of user intervention, no? Just get bundle maintainers to include an align preference. Like this one for R
And the ready-made align command in TM could inherit/import these.


{	shellVariables = (
		{	name = 'TM_SOURCE_ALIGNMENT_PATTERN';
			value = '[
      { 
        "comment" : "align on assignments",
        "regexp" : "=|<-|->",
        "minimum_spacing_before" : " ", 
        "minimum_spacing_after" : " ",
        "padding" : "before"
      },
      { 
        "comment" : "align right-hand side formulae assignments",
        "regexp" : "~",
        "minimum_spacing_before" : " ", 
        "minimum_spacing_after" : " ",
        "padding" : "before"
      },
      { 
        "comment" : "align any stacked assignments on a line",
        "regexp" : ";",
        "minimum_spacing_before" : "", 
        "minimum_spacing_after" : " ",
        "padding" : "before"
      },
      {
        "comment" : "align any comments",
        "regexp" : "#", 
        "minimum_spacing_before" : " ", 
        "minimum_spacing_after" : " ",
        "padding" : "before"
      }]';
		},
	);
}


More information about the textmate mailing list