emacs-kotlin-ts-mode
source link: https://gitlab.com/bricka/emacs-kotlin-ts-mode
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.
A major mode for Kotlin, based on the built-in support for tree-sitter that was added in Emacs 29.
Install
Grammar
In order to use tree-sitter
, you must have a grammar for the language. In this case, that is tree-sitter-kotlin.
git clone [email protected]:fwcd/tree-sitter-kotlin.git cd tree-sitter-kotlin cc -shared -fPIC -g -O2 -I src src/scanner.c src/parser.c -o libtree-sitter-kotlin.so
You must then either copy libtree-sitter-kotlin.so
into your library location (probably /usr/local/lib
) or you must add the directory to your treesit-extra-load-path
variable:
(add-to-list 'treesit-extra-load-path "/path/to/tree-sitter-kotlin")
Major Mode
First, make sure that your Emacs is compiled with tree-sitter
support:
(treesit-available-p) ; should return t
Then just install this package!
Raw Emacs
Clone this repository somewhere on your machine.
(add-to-list 'load-path "/path/to/emacs-kotlin-ts-mode") (require 'kotlin-ts-mode) (add-to-list 'auto-mode-alist '("\\.kt\\'" . kotlin-ts-mode)) ; if you want this mode to be auto-enabled
straight.el
(use-package kotlin-ts-mode :straight (:host gitlab :repo "bricka/emacs-kotlin-ts-mode") :mode "\\.kt\\'" ; if you want this mode to be auto-enabled )
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK