Git Product home page Git Product logo

vue-ts-mode's Introduction

Vue-ts-mode

A major mode for editing Vue components. Requires Emacs 29.1.

./screenshot.png

Installation

Clone this repo anywhere you want, probably somewhere in ~/.emacs.d . Then, add the directory to your load-path.

For example:

cd ~/.emacs.d
git clone https://github.com/8uff3r/vue-ts-mode.git

Then, in init.el:

(add-to-list 'load-path (concat user-emacs-directory "vue-ts-mode"))
(require 'vue-ts-mode)

Setup

The first time you open a .vue file, or (require 'vue-ts-mode), you’ll likely get a warning such as the following:

Cannot activate tree-sitter, because language grammar for vue is unavailable

Because this major mode is powered by Tree-sitter, it depends on an external grammar to provide a syntax tree for Vue components. To set it up, you’ll need to set treesit-language-source-alist to point to the correct repositories for each language. At a minimum, you’ll need to specify vue, typescript and css, like so:

(setq treesit-language-source-alist
      '((vue "https://github.com/ikatyang/tree-sitter-vue")
        (css "https://github.com/tree-sitter/tree-sitter-css")
        (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")))

Once that’s been setup, you’ll need to run treesit-install-language-grammar once for each language in the list. You can do this interactively (M-x), or by evaluating this snippet:

(mapc #'treesit-install-language-grammar '(vue css typescript))

Make sure you have a working C compiler as cc in your PATH, since this needs to compile the grammars.

Credits

vue-ts-mode's People

Contributors

8uff3r avatar tylerhsu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.