Lexer to highlight *.txt files

All questions regarding lexer highlighting schemes are discussed here...
Post Reply
jcfaria.uesc
Posts: 27
Joined: 07.05.2024 18:58

Lexer to highlight *.txt files

Post by jcfaria.uesc »

Good morning,

I'm looking but I'm not finding it.
Is there a ready-made lexer for the "*.txt" file extension?
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Lexer to *.txt

Post by main Alexey »

We have lexer "Text with indentation" but it is not assigned to .txt filetype, you need to use this feature:
https://wiki.freepascal.org/CudaText#File_types

Lexer is in the Addons Manager.
you can also create empty lexer (in SynWrite, as wiki tells) and make custom features there.
e.g. you can highlight 'numbers' or 'quoted strings'.
jcfaria.uesc
Posts: 27
Joined: 07.05.2024 18:58

Re: Lexer to *.txt

Post by jcfaria.uesc »

Alexey,
Text with indentation
OK, I'm grateful. I had already found the one you mentioned, but it's not what I need.

I will try to make one - from scratch - to meet my needs. Basically, the following highlights:
  • numbers (integers and float)
  • URI
  • Notes in 3 levels (as was done for my Lexer R derivation)
  • text between single and double quotes for multiline
  • and a few more little things
Best,
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Lexer to *.txt

Post by main Alexey »

But I don't think this lexer will be useful for many ppl. like lexer for some language.
jcfaria.uesc
Posts: 27
Joined: 07.05.2024 18:58

Re: Lexer to *.txt

Post by jcfaria.uesc »

It will be made for my use!
jcfaria.uesc
Posts: 27
Joined: 07.05.2024 18:58

Re: Lexer to *.txt

Post by jcfaria.uesc »

I use files.txt a lot for almost all my activities as a university professor: notes, teaching classes, presentations at events, etc.

I stopped wasting time creating very elaborate slide-style presentations, even the ones I used to do in LaTeX. Over time I started replacing all the slides with files.txt: it's much more practical and functional, as long as you have a good text editor with good - and customizable - syntax highlighting.

To make my files like *.txt interesting, I developed, over time, my own syntax (figures attached). I believe there are no references elsewhere, as I have never heard of comments for *.txt files, much less notes (three levels) derived from comments. Let's say it's my conception of what *.txt files might look like.

I leave the style - still simple, but functional - that I created - for files with the *.txt extension available to the community for anyone who wants to use it.

If Alexey finds it interesting, he can put it in the CudaText repositories for all users.
Attachments
TXT.zip
(1.49 KiB) Downloaded 356 times
Lexer_txt.png
Lexer_default_txt.png
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Lexer to *.txt

Post by main Alexey »

Thanks, good work.
dimon40001
Posts: 21
Joined: 05.05.2022 18:52

Re: Lexer to *.txt

Post by dimon40001 »

jcfaria.uesc wrote: 16.05.2024 03:54 Is there a ready-made lexer for the "*.txt" file extension?
Consider some ideas from Text IMprovied lexer https://synwrite.sourceforge.net/forums ... php?t=2839
Post Reply