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

add easier way to change default/fallback language behaviour #11705

Open
k4lizen opened this issue Sep 15, 2024 · 6 comments
Open

add easier way to change default/fallback language behaviour #11705

k4lizen opened this issue Sep 15, 2024 · 6 comments
Labels
C-enhancement Category: Improvements

Comments

@k4lizen
Copy link

k4lizen commented Sep 15, 2024

Motivation

I often edit files which dont have a file type nor shebang (like ~/.gdbinit) and for me they most often use # for comments. Programming languages which use // in general have a file extension so are detected. Maybe # should be the default?

My solution

I want to make it so that # is used for comments by default when a specific language isn't detected.

The problem

This isn't intuitive at all, and reading the docs doesn't help much. It seems the current solution is doing this: #9165 (comment) which seems way to hacky and verbose to overwrite a simple configuration option.
I would expect:

[[language]]
name = "text"
comment-tokens = ["#"]

or something similar to Just Work.

@k4lizen k4lizen added the C-enhancement Category: Improvements label Sep 15, 2024
@Flip1
Copy link

Flip1 commented Sep 17, 2024

Helix is ​​really great, but I'm failing here too and can only get ahead with workarounds.

Overwriting the default configuration for "text" also seems to be the best solution to me.

Another possibility could be to use "" for file-types, to apply to all files that don't have a suffix.

[[language]]
name = "text"
comment-tokens = "#"
file-types = ["","txt"]

As a workaround for dot-files the following is possible:

[[language]]
name = "bash"
file-types = [{glob=".*"},"sh"]

EDIT: Missing quote added

@k4lizen
Copy link
Author

k4lizen commented Sep 17, 2024

As a workaround for dot-files the following is possible:
[[language]]
name = "bash"
file-types = [{glob=".*},"sh"]

Cool! Thanks, I'll be using that. (sidenote you're missing a doublequote in file-types = [{glob=".*},"sh"])

@kirawi
Copy link
Member

kirawi commented Sep 17, 2024

At best I'm paraphrasing here and at worst I'm completely wrong, but from my understanding the plan is to let this use-case be handled by the plugin system instead of putting more work into supporting changing the defaults.

@k4lizen
Copy link
Author

k4lizen commented Sep 18, 2024

Oh boy I can't wait to install the always-use-4-space-indentation plugin, I love installing random software instead of having a single knob to turn!

@kirawi
Copy link
Member

kirawi commented Sep 18, 2024

You won't have to install anything. The configuration will simply be more flexible and still declarative. See #10441 and relatedly #8853

@k4lizen
Copy link
Author

k4lizen commented Sep 18, 2024

Oh okay, I misunderstood, my bad. The discussions you linked seem quite promising!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

3 participants