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

Change default comment token to # for unrecognized files #12080

Merged
merged 4 commits into from
Dec 5, 2024

Conversation

kfatyuip
Copy link
Contributor

Helix currently uses // as the default comment token for unrecognized file types, but this doesn’t align well with Linux conventions. Since Linux configuration files—such as locale.conf, pacman.conf, and /etc/sudoers—almost always use # for comments, defaulting to // feels out of place.

Files like locale.conf and pacman.conf are sometimes misclassified as HOCON simply because they have a .conf extension, and files without extensions (e.g., sudoers) end up with // as their comment token, which doesn’t match their typical usage.

Most programming languages that use // (e.g., Rust, JavaScript) are easily recognized by their file extensions, whereas files without extensions are more likely to follow Linux conventions and use #. Switching the default to # makes Helix more predictable and practical for Linux users.

helix-core/src/comment.rs Outdated Show resolved Hide resolved
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Nov 26, 2024
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reasoning makes sense to me. Previously I was thinking we might want to drop the "default comment token" behavior and refuse to toggle anything for text languages on C-c but toggling # is probably a more reasonable default behavior.

@pascalkuthe pascalkuthe merged commit e670970 into helix-editor:master Dec 5, 2024
6 checks passed
GladkihEgor pushed a commit to GladkihEgor/helix that referenced this pull request Jan 4, 2025
…r#12080)

* Change the default comment token

* update test

* keep the original
diucicd pushed a commit to diucicd/helix that referenced this pull request Jan 8, 2025
…r#12080)

* Change the default comment token

* update test

* keep the original
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants