{"id":13836938,"url":"https://github.com/leanprover-community/lean4-mode","last_synced_at":"2026-01-07T18:54:29.780Z","repository":{"id":36954635,"uuid":"450408150","full_name":"leanprover-community/lean4-mode","owner":"leanprover-community","description":"Emacs major mode for Lean 4","archived":false,"fork":false,"pushed_at":"2024-10-17T07:10:42.000Z","size":190,"stargazers_count":68,"open_issues_count":26,"forks_count":28,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T14:18:38.550Z","etag":null,"topics":["emacs","lean4"],"latest_commit_sha":null,"homepage":"https://leanprover.github.io/","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leanprover-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-21T08:16:29.000Z","updated_at":"2024-10-27T21:42:44.000Z","dependencies_parsed_at":"2024-04-10T03:41:45.998Z","dependency_job_id":"e7ef3eb3-d3f2-44ce-a5df-c36b1caa66c3","html_url":"https://github.com/leanprover-community/lean4-mode","commit_stats":null,"previous_names":["leanprover-community/lean4-mode"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Flean4-mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Flean4-mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Flean4-mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Flean4-mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanprover-community","download_url":"https://codeload.github.com/leanprover-community/lean4-mode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225648008,"owners_count":17502167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","lean4"],"created_at":"2024-08-04T15:00:57.698Z","updated_at":"2024-11-20T23:32:02.213Z","avatar_url":"https://github.com/leanprover-community.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"Installation\n============\n\nBefore using this major mode, you need to [install Lean 4](https://leanprover.github.io/lean4/doc/setup.html#basic-setup).\n\nTo use `lean4-mode` in Emacs, add the following to your `init.el`:\n```\n;; You need to modify the following line\n(setq load-path (cons \"/path/to/lean4-mode\" load-path))\n\n(setq lean4-mode-required-packages '(dash flycheck lsp-mode magit-section))\n\n(require 'package)\n(add-to-list 'package-archives '(\"melpa\" . \"http://melpa.org/packages/\"))\n(package-initialize)\n(let ((need-to-refresh t))\n  (dolist (p lean4-mode-required-packages)\n    (when (not (package-installed-p p))\n      (when need-to-refresh\n        (package-refresh-contents)\n        (setq need-to-refresh nil))\n      (package-install p))))\n\n(require 'lean4-mode)\n```\nAlternatively if you are a fan of `use-package` and `straight.el` you\ncan use:\n```\n(use-package lean4-mode\n  :straight (lean4-mode\n\t     :type git\n\t     :host github\n\t     :repo \"leanprover/lean4-mode\"\n\t     :files (\"*.el\" \"data\"))\n  ;; to defer loading the package until required\n  :commands (lean4-mode))\n```\nIf you are a doom-emacs user, adding the following to `packages.el` should work:\n```\n(package! lean4-mode :recipe\n  (:host github\n   :repo \"leanprover/lean4-mode\"\n   :files (\"*.el\" \"data\")))\n```\n\nTrying It Out\n=============\n\nIf things are working correctly, you should see the word ``Lean 4`` in the\nEmacs mode line when you open a file with extension `.lean`. Emacs will ask you\nto identify the \"project\" this file belongs to. If you then type\n```lean\n#check id\n```\nthe word ``#check`` will be underlined, and hovering over it will show\nyou the type of ``id``. The mode line will show ``FlyC:0/1``, indicating\nthat there are no errors and one piece of information displayed.\n\nTo view the proof state, run `lean4-toggle-info` (`C-c` `C-i`). This will show the `*Lean Goals*` buffer (like the `Lean infoview` pane in VSCode) in a separate window.\n\nSettings\n========\n\nSet these with e.g. `M-x customize-variable`.\n\n* `lsp-headerline-breadcrumb-enable`: show a \"breadcrumb bar\" of namespaces and sections surrounding the current location (default: off)\n\nKey Bindings and Commands\n=========================\n\n| Key                | Function                                                                        |\n|--------------------|---------------------------------------------------------------------------------|\n| \u003ckbd\u003eC-c C-k\u003c/kbd\u003e | show the keystroke needed to input the symbol under the cursor                  |\n| \u003ckbd\u003eC-c C-d\u003c/kbd\u003e | recompile \u0026 reload imports (`lean4-refresh-file-dependencies`)                  |\n| \u003ckbd\u003eC-c C-x\u003c/kbd\u003e | execute Lean in stand-alone mode (`lean4-std-exe`)                              |\n| \u003ckbd\u003eC-c C-p C-l\u003c/kbd\u003e | builds package with lake (`lean4-lake-build`)                                   |\n| \u003ckbd\u003eC-c C-i\u003c/kbd\u003e | toggle info view showing goals and errors at point (`lean4-toggle-info-buffer`) |\n| \u003ckbd\u003eC-c ! n\u003c/kbd\u003e | flycheck: go to next error                                                      |\n| \u003ckbd\u003eC-c ! p\u003c/kbd\u003e | flycheck: go to previous error                                                  |\n\nFor `lsp-mode` bindings, see https://emacs-lsp.github.io/lsp-mode/page/keybindings/ (not all capabilities are supported currently).\n\nIn the default configuration, the Flycheck annotation `FlyC:n/n` indicates the\nnumber of errors / responses from Lean; clicking on `FlyC` opens the Flycheck menu.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover-community%2Flean4-mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanprover-community%2Flean4-mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover-community%2Flean4-mode/lists"}