Page 1 of 1

Option to Auto-Append Extension Type to a File for "Save As"

Posted: 24.09.2025 22:54
by Cr8zy_Ivan
Hello, I'm looking for a way for newly created files to be auto-saved with a predefined extension. In my case, it is ".cfg".

When I open a new blank tab and then "Save As", I want my file to be saved with a specific extension type, if I write it out in the textbox. As an example, I could write out "Test-File-001.json" and the file would be named like this. If I DON'T specify an extension type I want the file extension to automatically be ".cfg". In this second use-case, I would simply write out "Test-File-001" (without an extension type) and CudaText would save my file as "Test-File-001.cfg".

There was a way to do it with Notepad++ but I can't remember if it was an option in Notepad++ itself or if it was a Plugin that allowed users to do it.

I've looked in the config and I've looked for Plugins but I haven't found anything.

Does anyone know if this is something that can be done in CudaText?

Thanks!

Re: Option to Auto-Append Extension Type to a File for "Save As"

Posted: 25.09.2025 06:47
by main Alexey
I experimented with an empty lexer with only file-extension 'cfg' set in it.
create file Cfg.lcf in the folder data/lexlib:

Code: Select all

object SyntAnal21: TLibSyntAnalyzer
  Extentions = 'cfg'
  LexerName = 'Cfg'
end
then set the option in user.json:

Code: Select all

  "newdoc_lexer": "Cfg",
now if I save new doc as 'new' it saves file 'new.cfg'.

Re: Option to Auto-Append Extension Type to a File for "Save As"

Posted: 25.09.2025 18:37
by Cr8zy_Ivan
Well hot dang! That worked on the first try! CudaText = Very Cool ➔ ✔Check

Re: Option to Auto-Append Extension Type to a File for "Save As"

Posted: 25.09.2025 18:53
by main Alexey
Thank you, now let's advertise the editor on blogs/forums. :)

Re: Option to Auto-Append Extension Type to a File for "Save As"

Posted: 25.09.2025 23:08
by Cr8zy_Ivan
Oh! I forgot to say: Thank you!

And: 👍 for advertising.

Re: Option to Auto-Append Extension Type to a File for "Save As"

Posted: 26.09.2025 06:14
by main Alexey
I mean, if you can help to spread the word, ie advertise the program, it will be good.