Skip to content

Add modeline_aliases for git filetypes#62

Merged
MrSubidubi merged 1 commit into
zed-extensions:mainfrom
lyallcooper:modeline-aliases
Jun 23, 2026
Merged

Add modeline_aliases for git filetypes#62
MrSubidubi merged 1 commit into
zed-extensions:mainfrom
lyallcooper:modeline-aliases

Conversation

@lyallcooper

@lyallcooper lyallcooper commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

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:

# -*- mode: gitconfig -*-

This is because the name gitconfig isn't registered anywhere. This PR aims to fix that using modeline_aliases for the gitconfig, gitignore, gitattributes and gitrebase file types.

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.
@cla-bot

cla-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

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'.

@lyallcooper

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Jun 18, 2026
@cla-bot

cla-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@MrSubidubi MrSubidubi changed the title Add modeline_aliases for git filetypes Add modeline_aliases for git filetypes Jun 23, 2026

@MrSubidubi MrSubidubi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks! And congratulations to your first contribution! 🎉

@MrSubidubi MrSubidubi merged commit 8703131 into zed-extensions:main Jun 23, 2026
7 checks passed
@lyallcooper

Copy link
Copy Markdown
Contributor Author

Thanks @MrSubidubi! And here’s hoping there are more contributions to come 🙂

@lyallcooper lyallcooper deleted the modeline-aliases branch June 23, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants