Re: [code] Tabs and Indentation by file type

From: Robert Gieseke <rob.g.att.web.de>
Date: Sun, 18 Aug 2013 11:17:38 +0200

Hi Michael,

Am 8/18/13 11:01 AM, schrieb Michael Richter:
> OK, I've tinkered with this for a while and can't figure it out.
>
> How do I get Textadept to use tabs/8 for indentation for Makefiles *only*.
>
> More generally, how do I set tabs/spaces/indentation amount by file type.
>
> I've tried putting it into the lexer. I've tried making a subdirectory
> under ~/.textadept/modules and putting the stuff in a post_init.lua file
> and I never see the indentation/tabs settings change in the actual editor.
>

try this in your init.lua:

events.connect(events.LANGUAGE_MODULE_LOADED, function(lang)
   if lang == 'makefile' then
     buffer.use_tabs = true
     buffer.tab_width = 8
   end
end)

The Python module [1] shows how this could be included in a language
module file, it should be fine in your init.lua, though. Just in case
you want more Makefile snippets …

(Thanks for asking this -- it reminded me that I wanted this quite a few
times but was too lazy to actually put it in my init.lua)

Robert

[1] http://foicica.com/hg/python/file/ec31ba527326/init.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 Sun 18 Aug 2013 - 05:17:38 EDT

This archive was generated by hypermail 2.2.0 : Sun 18 Aug 2013 - 06:37:32 EDT