Re: [code] More on snippets... Am I doing something wrong or just hit the limits?

From: Mitchell <>
Date: Wed, 20 Sep 2017 15:47:44 -0400 (EDT)

Hi Pedro,

On Tue, 19 Sep 2017, Pedro Andres Aranda Gutierrez wrote:

> Hi Mitchell
> I'm trying to move longer language-specific snippets to files and place
> them unter ~/.textadept/snippets/<lexer>/
> To load them I'm using the following code
> events.connect(events.LEXER_LOADED, function(lexer)
> local _lexer_snippets = _USERHOME..'/snippets/'..lexer
> if lfs.attributes(_lexer_snippets) then
> local load_snippets = true
> for _, _val in pairs(textadept.snippets._paths) do
> if _val == _lexer_snippets then load_snippets = false end
> end
> if load_snippets then
> table.insert(textadept.snippets._paths,_lexer_snippets)
> end
> end
> ... (more code)
> That's how I have understood the documentation. This results however in all
> language snippets files being available to all lexers and not each fileset
> to its lexer.
> Is that an anti-feature or am I not understanding the docs ?

`snippets._paths` is not lexer-specific. Lexer-specific snippet files should be prefixed with the lexer's name. The documentation gives the format "lexer.trigger.ext", where ".ext" is an optional, arbitrary file extension. For example, a file named "lua.func.lua" will insert the contents of that file as a snippet when the lexer is "lua" and the trigger word is "func". (The ".lua" extension is solely for convenience when editing the snippet from Textadept.)


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Wed 20 Sep 2017 - 15:47:44 EDT

This archive was generated by hypermail 2.2.0 : Thu 21 Sep 2017 - 06:54:59 EDT