Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjusting syntax highlighting for plain text files #146

Open
lester96 opened this issue Jan 1, 2020 · 6 comments
Open

adjusting syntax highlighting for plain text files #146

lester96 opened this issue Jan 1, 2020 · 6 comments

Comments

@lester96
Copy link

lester96 commented Jan 1, 2020

When nedit doesn't know what kind of file it is opening, it opens it as a plain text file. But I can't find a way to set the syntax highlighting for this kind of file. It doesn't show up in recognition patterns as a language mode, so there is not a way to change what the default is. What I would really like to do is turn off backlighting by default for plain text files. I can create a "Plain" text mode, but it does not get selected by default. This behavior is the same as default nedit, so I guess this is an enhancement.

@eteran
Copy link
Owner

eteran commented Jan 2, 2020

Yup, definitely an enhancement, but a seemingly reasonable one. I'll check it out :-)

@marilmanen
Copy link
Contributor

I have similar issue as I want to create a macro that would be available for Perl and Plain files, but that is not possible. I even added a new language Text to languages.yaml file

---
name: Text
regex: .*

but it looks like the regex has preference over extension setting and thus all files that are recognized by regex (why not empty files?) will become of type Text no matter what the file extension is. This is how it works also in old nedit, but at least I think that the file extension should rule the language and regex should be used if extension does not match with any language definitions.

@eteran
Copy link
Owner

eteran commented Jan 17, 2020

@marilmanen when you add that to the languages.yaml file, did you put it at the very end? I believe that they are processed in order and the first match wins. So you'd almost certainly want to place that last.

@eteran
Copy link
Owner

eteran commented Jan 17, 2020

Ahh, I see, yes regex testing definitely is done before extensions. Really, what we need to do is have first-class support for specifying these things for plain text files. I'll look into what the best way to add that would be.

@anjohnson
Copy link
Contributor

While you're looking at this area… I have a common use case where I would like to use a regex on the filename for language recognition because these files have a name prefix, not a suffix (e.g. Makefile.in). There's no way to configure that with the currently available controls, so every time I edit these kinds of files I have to manually set their language.

@eteran
Copy link
Owner

eteran commented Jan 17, 2020

Will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants