How to register a new lexer with TextAdept? #312
Answered
by
orbitalquark
nsgnkhibdk2cls0f
asked this question in
Q&A
Replies: 2 comments 6 replies
-
It depends which version of Textadept you are using. If you're using 11.4 or lower you would add to the `textadept.file_types.extensions` table. If you're using 11.5 alpha or the nightly version, you would add to `lexer.detect_extensions`: https://orbitalquark.github.io/textadept/api.html#lexer.detect_extensions
…-- Textadept 11.4 or lower.
textadept.file_types.extensions.my_ext = 'my_lexer'
-- Textadept 11.5 alpha or higher.
lexer.detect_extensions.my_ext = 'my_lexer'
Technically there is a compatibility layer in 11.5 alpha and the nightlies that allow you to use 11.4's API. This will not be there forever though.
|
Beta Was this translation helpful? Give feedback.
5 replies
-
I agree that reading the API documentation as a newcomer to Lua would be quite intimidating. I recommend reading the Textadept manual first: https://orbitalquark.github.io/textadept/manual.html. You'll find help regarding lexer detection here: https://orbitalquark.github.io/textadept/manual.html#language.
Your use of `lexer.detect_extensions.foo = 'bar'` should work, provided you put a working *bar.lua* lexer in either *~/.textadept/lexers/* or Textadept's *lexers/* directory.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nsgnkhibdk2cls0f
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The lexer is not automatically selected when I opened the file. I have to tell TextAdept to use it each time I opened the file with this extension.
Beta Was this translation helpful? Give feedback.
All reactions