Re: [code] [textadept] Line wrapping on a per-buffer/file-type basis

From: Robert Gieseke <rob.g.att.web.de>
Date: Sat, 23 Nov 2013 08:31:51 +0100

Hi Ethan,

Am 11/23/13, 8:14 AM, schrieb Ethan M.:
> New to Textadept. After some reading and experimenting, I was
wondering if
> it is possible to set line wrapping on a per-buffer or per-filetype
basis.
> It doesn't seem to be the case. I'm curious because I would want text
files
> to wrap by default, but not code files. Thanks.

should be possible.

Something like this in your init.lua:

events.connect(events.BUFFER_AFTER_SWITCH, function()
   if buffer:get_lexer() == 'text' then
     buffer.wrap_mode = buffer.WRAP_WORD
   else
     buffer.wrap_mode = buffer.WRAP_NONE
   end
end)

You might have to attach this to the FILE_OPENED event as well. Of
course you could also make this dependent on file types etc.

I have a similar use case for highlighting the margin of the active
buffer[1].

Hope this helps,
Robert

[1] https://github.com/rgieseke/ta-common/blob/master/highlight.lua

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 23 Nov 2013 - 02:31:51 EST

This archive was generated by hypermail 2.2.0 : Sat 23 Nov 2013 - 06:29:08 EST