carbon-lang
carbon-lang copied to clipboard
Add syntax highlighting for vim and neovim
PR to add a vim syntax file to support syntax highlighting for .carbon files. Since the Carbon language specification is still in progress, a single syntax file is easier to maintain and adapt to design changes in Carbon. After the language syntax has matured and stabilized, advanced tooling such as Treesitter and Language Servers can take over the syntax highlighting in neovim.
Highlighting Support
- comments and preprocessors (RUN, CHECK, etc)
- string and numeric literals
- primitive type names, classes, aliases
- control flow constructs
- identifier names
- package and library declarations
- most keywords mentioned in
docs/design/README.md
With a Dark Colorscheme:
This image is longer than I thought, so I'm not posting what it looks like in a light colorscheme, but it should look fine as long as vim highlight-groups are properly defined.
I'm not good enough with things like regex to do any useful review, but stuff like this is great for helping future adoption. Good job.
Added copyright check support for .vim files in pre-commit workflow. Formatted README as requested, thank you for your patience @jonmeow .
Thanks for the Vim plugin But could you please separate files from carbon-language?
Hi, can you elaborate on what you mean by "separating files from carbon-language"? I'm not quite sure what you mean.
I just hope that this vim syntax files will be moved to
https://github.com/carbon-language/vim-carbon-lang
Oh, I only placed the syntax files in utils/vim
because other syntax highlighting utilities are also there. You could open an issue to migrate the syntax files to that new repository if you like.
Now I confirmed vim-carbon-lang is ready to use. Thank you.