gleam-lang/gleam-mode
{ "createdAt": "2019-04-07T05:10:27Z", "defaultBranch": "main", "description": "🐙 Gleam support for Emacs", "fullName": "gleam-lang/gleam-mode", "homepage": "", "language": "Emacs Lisp", "name": "gleam-mode", "pushedAt": "2025-11-06T02:26:32Z", "stargazersCount": 106, "topics": [ "editor-plugin", "emacs", "gleam" ], "updatedAt": "2025-11-13T15:30:46Z", "url": "https://github.com/gleam-lang/gleam-mode"}gleam-ts-mode: An Emacs Major Mode for [Gleam]
Section titled “gleam-ts-mode: An Emacs Major Mode for [Gleam]”This mode uses [tree-sitter] (and Emacs 29’s treesit package) under-the-hood for syntax highlighting and code navigation. If you’re using an Emacs that’s older than 29 (run M-x version to find out), or a version compiled without treesit (run M-: (treesit-available-p) to find out), you probably want [gleam-mode] instead.
https://user-images.githubusercontent.com/2058614/151681785-5d212e1b-191b-4e7d-a868-f6e42d7efe61.mp4
This project is hosted on [MELPA], and this is the recommended way to install the package. To add MELPA as a package repository, add the following to your Emacs init file:
(require 'package);; Add MELPA to archives(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"));; Load and activate packages(package-initialize)use-package (recommended)
Section titled “use-package (recommended)”Add the following to your Emacs init file:
(use-package gleam-ts-mode :mode (rx ".gleam" eos))vanilla
Section titled “vanilla”Install with
M-x package-install RET gleam-ts-mode RET(M-x stands for “meta + x” which indicates holding the meta key (usually labeled “Alt”) and tapping “x”. Where you see RET you should press your “Enter” or “Return” key).
To load the package, run the following (or place it in your Emacs init file):
(require 'gleam-ts-mode)(add-to-list 'auto-mode-alist '("\\.gleam\\'" . gleam-ts-mode))Install the Tree-Sitter Grammar
Section titled “Install the Tree-Sitter Grammar”Unless you have the Gleam tree-sitter grammar installed and treesit knows where to find it, you’ll want to run M-x gleam-ts-install-grammar. It should only take a moment, but does require that your OS has a C compiler available.
For Doom-Emacs Users
Section titled “For Doom-Emacs Users”add this in your ‘packages.el’ file:
(package! gleam-ts-mode :recipe (:host github :repo "gleam-lang/gleam-mode" :branch "main"
:files ("gleam-ts-*.el")))add this to your ‘config.el’ file:
(use-package! gleam-ts-mode :mode (rx ".gleam" eos))
(after! treesit (add-to-list 'auto-mode-alist '("\\.gleam$" . gleam-ts-mode)))
(after! gleam-ts-mode (unless (treesit-language-available-p 'gleam) (gleam-ts-install-grammar)))- Syntax highlighting
- Indentation
- Imenu integration
- Formatting
- Completion?
- REPL?
Looking for the old gleam-mode?
Section titled “Looking for the old gleam-mode?”gleam-mode is deprecated and removed in favor of gleam-ts-mode. However, if you still need gleam-mode for some reason, you can find it in the git history
[gleam-mode] !: https://github.com/gleam-lang/gleam-mode/blob/8656c4080dd2bb7dd6d6167953d6463d090509b0/gleam-mode.el