Add modeline_aliases for git filetypes#62
Merged
Conversation
Zed resolves a modeline's mode/ft token against each language's modeline_aliases, then grammar name, then display name. The Git Config and Git Rebase grammars are named git_config/git_rebase, so the canonical filetypes 'gitconfig' and 'gitrebase' did not resolve and such files fell back to plain text. Declare modeline_aliases with the canonical Vim/Neovim filetype name (per the filetype.lua references already in these configs) for all four languages, so '# vim: ft=gitconfig' and '# -*- mode: gitconfig -*-' modelines select the right language.
|
We require contributors to sign our Contributor License Agreement, and we don't have @lyallcooper on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
Contributor
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
modeline_aliases for git filetypes
MrSubidubi
approved these changes
Jun 23, 2026
MrSubidubi
left a comment
Contributor
There was a problem hiding this comment.
Looks good, thanks! And congratulations to your first contribution! 🎉
Contributor
Author
|
Thanks @MrSubidubi! And here’s hoping there are more contributions to come 🙂 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Git Firefly's file type display names/grammar names/modeline aliases don't line up with the canonical ones for emacs and vim. Therefore if you have the following modeline at the top of your file, as would be expected for emacs, Zed does not respect it:
This is because the name
gitconfigisn't registered anywhere. This PR aims to fix that usingmodeline_aliasesfor the gitconfig, gitignore, gitattributes and gitrebase file types.