How to setup a predefined lexer (Text IMproved)?

Post Reply
skarsgal
Posts: 13
Joined: 18.12.2022 17:27

How to setup a predefined lexer (Text IMproved)?

Post by skarsgal »

Hi,
I tried to add inside 'user.json' file the lexer 'Text IMproved' for save text files with default .txt extension.
(I have take the name from '\CudaText\data\lexlib\Text IMproved.lcf'
I have see Your example in Wiki at 'File types config', then I have validate user.json edited on JSONLint https://jsonlint.com/.
But it do not works.
Do You can help me?

Here is my user.json modified:

Code: Select all

{
"detect": [ 
      {"*.txt":  "Text IMproved"},
	  {"*.ini":  "Ini files"},
      {"*.bat":  "Batch files"},
 
{
  "ui_lexer_themes" : false
}
]
}
Thanks in advance
Last edited by skarsgal on 04.02.2023 16:36, edited 1 time in total.
main Alexey
Posts: 2236
Joined: 25.08.2021 18:15

Post by main Alexey »

You followed the wiki wrong. see the wiki--

Code: Select all

  "detect": {
    "*.mht": "HTML",
    "myconfig.conf": "Nginx",
    ".profile": "Bash script",
  },
here I missed the entire {} brackets at the file edges.
see your file- different brackets, wrong square brackets, wrong {} brackets.
skarsgal
Posts: 13
Joined: 18.12.2022 17:27

Post by skarsgal »

main Alexey wrote:You followed the wiki wrong. see the wiki--
here I missed the entire {} brackets at the file edges.
see your file- different brackets, wrong square brackets, wrong {} brackets.
I had already tried your example on JSONLint, but the site answer me:
Error: Parse error on line 1:
"detect": { "*.mht": "HTM
----------^
Expecting 'EOF', '}', ',', ']', got ':'
.. and I do not know where and how put EOF in this script.

Do You can correct my user.json file?
main Alexey
Posts: 2236
Joined: 25.08.2021 18:15

Post by main Alexey »

Should be like this

Code: Select all

{
  "detect": {
    "*.txt":  "Text IMproved",
    "*.ini":  "Ini files"
    },
  "ui_lexer_themes" : false
}
skarsgal
Posts: 13
Joined: 18.12.2022 17:27

Post by skarsgal »

It works well.
Thanks a lot.
Post Reply