Re: Change Tab Width

From: Howie <zhehao.....at.gmail.com>
Date: Sun, 27 Feb 2011 14:22:31 -0800 (PST)

Nice, it works! Thanks a lot.

On Feb 27, 1:48 pm, Robert <ro....at.web.de> wrote:
> 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)
>
Received on Sun 27 Feb 2011 - 17:22:31 EST

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