Installation :: Emacs Tree-sitter
source link: https://ubolonton.github.io/emacs-tree-sitter/installation/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Installation
tree-sitter
requires Emacs 25.1 or above, built with dynamic module support. Some Emacs distributions have this disabled by default. To check whether your Emacs has dynamic module support enabled, try evaluating one of these:
(functionp 'module-load) ; should be t
module-file-suffix ; should be non-nil
The methods below download pre-compiled binaries, so they only work for macOS, Linux and Windows, on x86_64 machines. For other systems, you will have to build from source.
Installing from an ELPA
-
Add
tree-sitter
's ELPA topackage-archives
:(add-to-list 'package-archives '("ublt" . "https://elpa.ubolonton.org/packages/"))
-
Run
M-x package-refresh-contents
. -
Install
tree-sitter
andtree-sitter-langs
packages. -
Load the language bundle:
(require 'tree-sitter-langs)
Installing with straight.el
-
Install
tree-sitter
andtree-sitter-langs
with custom recipes:(straight-use-package '(tree-sitter :host github :repo "ubolonton/emacs-tree-sitter" :files ("lisp/*.el"))) (straight-use-package '(tree-sitter-langs :host github :repo "ubolonton/emacs-tree-sitter" :files ("langs/*.el" "langs/queries")))
-
Load the language bundle:
(require 'tree-sitter-langs)
Installing from Source
-
Clone the source repository:
git clone https://github.com/ubolonton/emacs-tree-sitter
-
Add its
lisp
andlangs
directories toload-path
:(add-to-list 'load-path "/path-to/emacs-tree-sitter/lisp") (add-to-list 'load-path "/path-to/emacs-tree-sitter/langs")
-
Load the libraries in your config:
(require 'tree-sitter) (require 'tree-sitter-hl) (require 'tree-sitter-langs) (require 'tree-sitter-debug) (require 'tree-sitter-query)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK