helix.sh 920 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  3. # Exceptions. See /LICENSE for license information.
  4. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  5. set -euo pipefail
  6. ROOT="$(git rev-parse --show-toplevel)"
  7. cd "$ROOT/utils/tree_sitter"
  8. tree-sitter generate --no-bindings
  9. mkdir -p "$ROOT/.helix"
  10. cat > "$ROOT/.helix/languages.toml" << EOF
  11. use-grammars = { only = ["carbon"] }
  12. [[language]]
  13. name = "carbon"
  14. scope = "source.carbon"
  15. file-types = ["carbon"]
  16. comment-token = "//"
  17. indent = { tab-width = 2, unit = " " }
  18. roots = [".git"]
  19. [[grammar]]
  20. name = "carbon"
  21. source = { path = "$PWD" }
  22. EOF
  23. mkdir -p ~/.config/helix/runtime/grammars ~/.config/helix/runtime/queries
  24. ln -sTf $PWD/queries ~/.config/helix/runtime/queries/carbon
  25. hx --grammar build
  26. echo
  27. hx --health carbon
  28. echo
  29. echo 'use `hx path/to/foo.carbon` to open files'
  30. echo 'Try different themes with :theme'