mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
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. Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Carbon Syntax Highlighting for Vim & Neovim
For Carbon devs using Vim or Neovim, this plugin provides syntax highlighting
for .carbon files found throughout explorer/testdata
Manual Installation
Vim Users
From the current directory utils/vim, please run the following commands to
install the syntax file.
mkdir -p ~/.vim/syntax && cp syntax/carbon.vim ~/.vim/syntax/
mkdir -p ~/.vim/ftdetect && cp ftdetect/carbon.vim ~/.vim/ftdetect/
Neovim Users
Instead of copying to the ~/.vim directory, please use the ~/.config/nvim
directory, or your custom Neovim root directory.
mkdir -p ~/.config/nvim/syntax && cp syntax/carbon.vim ~/.config/nvim/syntax/
mkdir -p ~/.config/nvim/ftdetect && cp ftdetect/carbon.vim ~/.config/nvim/ftdetect/