Re: [textadept] Re: Change Tab Width

From: Robert <ro....at.web.de>
Date: Sun, 27 Feb 2011 19:48:23 +0100

Howie,

On Sun, Feb 27, 2011 at 6:17 PM, Howie <zhehao.....at.gmail.com> wrote:
> Thanks for your help. Also, is there a way to specify different tab
> settings for different languages. Some languages I prefer to use the
> default 2-space tab width (html, C), sometimes I prefer to use the 4-
> space tabs (Python, Java). I know that you can set this for
> individuals languages in the set_buffer_properties function of that
> modules init.lua, but it is rather tedious to add each of these one by
> one. Is there a way to specify certain settings for a set of
> languages?
>

you could connect a function to an buffer_after_switch event:

Something like this in your init.lua (untested):
events.connect('buffer_after_switch', function()
  local indent_default = 2
  local lexer = buffer:get_lexer()
  local indent = { python = 4, java = 4 }
  buffer.indent = indent[lexer] or indent_default
end)

Robert
Received on Sun 27 Feb 2011 - 13:48:23 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 12:00:20 EST