Sublime Text Syntax highlighting for single-file Vue.js components based on its HTML, CSS, JavaScript, TypeScript, JSX, TSX and HAML syntaxes.
The main
branch targets Sublime Text 4.
For Sublime Text 2 compatible package using .tmlanguage
files, see st2
branch.
For Sublime Text 3 (3153+) compatible package using .sublime-syntax
files, see st3153
branch.
This repository is a fork of vuejs/vue-syntax-highlight with focus on providing syntax highlighting only for Sublime Text.
The easiest way to install is using Package Control. It's listed as Vue
.
- Open
Command Palette
using ctrl+shift+P or menu itemTools → Command Palette...
- Choose
Package Control: Install Package
- Find
Vue
and hit Enter
- Download appropriate Vue-5.0.0-st4xxx.sublime-package for your Sublime Text build.
The
st4xxx
suffix denotes the least required ST build for the sublime-package to work. - Rename it to Vue.sublime-package
- Copy it into Installed Packages directory
Note
To find Installed Packages...
- call Menu > Preferences > Browse Packages..
- Navigate to parent folder
-
Vue 4.0.0+ requires Sublime Text 4107+
-
Syntax highlighting in
<style>
tags is powered by: -
Syntax highlighting in
<script>
tags is powered by:- Babel
- CoffeeScript
- LiveScript
- JavaScript (from Sublime Text)
- TypeScript (from Sublime Text)
- JSX/TSX (from Sublime Text)
-
Syntax highlighting in
<template>
tags is powered by:
Vue extends Sublime Text's HTML syntax definition.
If Vue syntax highlighting doesn't work and console displays syntax errors in Vue Component.sublime-syntax, please make sure to remove any out-dated syntax override.
Steps:
- call Menu > Preferences > Browse Packages..
- Look for HTML folder
- Remove it or at least delete any syntax definition in it.
Vue relies on JavaScript (source.js
), JSX (source.jsx
),
TypeScript (source.ts
) and TSX (source.tsx
)
to scope script blocks and inline scripts.
Make sure to remove related out-dated syntax packages, which don't meet least compatibility requirements.
They can be identified by calling
e.g. sublime.find_syntax_by_scope("source.ts")
in ST's console.
Known candidates are: