Skip to content

oxidecomputer/p4-ts-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

p4-ts-mode: An Emacs Major Mode for P4 Using Tree-sitter

MELPA

P4 (P4_16) mode for emacs using tree-sitter.

This mode uses tree-sitter, requiring Emacs 29+'s treesit package for syntax highlighting and code navigation.

If you're running an Emacs that's older than 29 or a version compiled without treesit, we'll eventually provide a fallback mode.

gif of files

Installation

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)

Once you've added MELPA, you can install p4-ts-mode based on your package manager. Some examples are provided below.

Doom Emacs

(package! p4-ts-mode)

straight.el

(straight-use-package 'p4-ts-mode)

quelpa

(quelpa '(p4-ts-mode :repo "oxidecomputer/p4-ts-mode" :fetcher github))

Manually from MELPA

M-x package-install RET p4-ts-mode RET

Setup

Once installed, you can we recommend use-package to load the package and setup any configuration.

(use-package p4-ts-mode
  :mode (rx ".p4" eos)

;; If you're using Doom Emacs, you can add the following to your `config.el` file:
;; (use-package! p4-ts-mode)

Tree-sitter Grammar

Unless you have the P4 tree-sitter grammar installed and treesit knows what path to find it, you'll want to run:

M-x p4-ts-install-grammar

This will download the grammar and compile it for you.

Note: This requires a C compiler to be installed on your system.

Contributing

p4-ts-mode is still a work in progress.

To contribute, just open a pull request!

Useful links

About

P4_16 mode for emacs using treesitter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published