Re: different snippets when changing lexer?

From: morchel <>
Date: Fri, 5 Jun 2009 07:32:27 -0700 (PDT)

> > Would it be possible to load modules based on file extensions per
> > default and switch to an other one when changing the lexer?
> By creating a 'lexer_changed' event this could be done I think; you
> might have to disable the 'buffer_switch' event for loading the
> appropriate module as I'm not sure which would be run last.

I'm not really into lua and I didn't understand how to create an event
(who triggers it when?)..needs some time.

I kind of solved my issue by adding some code to set_lexer_language()
in menu.lua:
  if lexer ~= 'container' then
    local ret, err = pcall(require, lexer)
    if ret then
    elseif not ret and not err:find("^module '"..lexer.."' not
found:") then

Not perfect, as you mentioned I would need to modify switch_buffer,
good enough to hack ant-scripts using snippets.

Regards, Martin
Received on Fri 05 Jun 2009 - 10:32:27 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:38:02 EST