[TxMt] Re: Command that pastes in the same indent level

Allan Odgaard mailinglist at textmate.org
Thu Jun 27 06:16:28 UTC 2019


On 4 Mar 2019, at 11:39, Philippe Huibonhoa wrote:

> I have a command I'm trying to create that pastes multiple lines of 
> code,
> the problem is sequential lines are not indented properly. […]
> Is there a recommended way to
> fix this?

In the bundle editor’s sidebar, set Format to Snippet (under Output).

Snippet output is automatically indented to the current indent level.

Be aware though that you should escape any special characters in the 
output that would otherwise trigger snippet functionality, in ruby that 
could be done with this function:

	def e_sn(str)
	  str.gsub(/(?=[$`\\])/, '\\')
	end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macromates.com/textmate/attachments/20190627/18beb45c/attachment.html>


More information about the textmate mailing list