Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

highlights JavaScript's Template Strings in other FileType syntax rule

License

NotificationsYou must be signed in to change notification settings

Quramy/vim-js-pretty-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Vim plugin to highlight JavaScript'sTemplate Strings contents in otherFileType syntax rule which you want.

varhtmlTempl=`<div>  <div>    <span>{{ctrl.message}}</span>  </div></div>`;

capture

Template Strings is available withBabel,google/traceur-compile andTypeScript.

How to install

Vim 8 native plugins

Replace "FOOBAR" with any directory name that you like:

$ mkdir -p ~/.vim/pack/FOOBAR/start/$ git clone https://github.com/Quramy/vim-js-pretty-template.git ~/.vim/pack/FOOBAR/start/vim-js-pretty-template

Vundle

Place this in your.vimrc:

Plugin'Quramy/vim-js-pretty-template'

then run the following in Vim:

:source%:PluginInstall

NeoBundle

NeoBundle'Quramy/vim-js-pretty-template'

then run the following in Vim:

:source%:NeoBundleInstall

Pathogen

Run the following in a terminal:

git clone https://github.com/Quramy/vim-js-pretty-template.git~/.vim/bundle/vim-js-pretty-template

Usage

Tagged Template Literal

Set the highlighting of template strings with thejspretmpl#register_tag() function. For example,

" Register tag name associated the filetypecalljspretmpl#register_tag('gql','graphql')autocmdFileTypejavascript JsPreTmplautocmdFileTypejavascript.jsx JsPreTmpl

Then your JavaScript codes are Highlighted as the following:

// GraphQL way if gql taggedconstquery=gql`  fragment on User {    name  }`;

For alternative JavaScript users

vim-js-pretty-template is also compatible for TypeScript, Dart and CoffeeScript.

  • TypeScript
  • Dart
  • CoffeeScript

For example:

autocmdFileTypetypescript JsPreTmplautocmdFileTypetypescriptsynclear foldBraces" For leafgarland/typescript-vim users only. Please see #1 for details.

then the following template string is highlighted:

vartmpl:string=`## Title*Highlighted in Markdown way.*`;

or for example:

autocmdFileTypedart JsPreTmpl

then:

var tmpl="""<!-- highlighted in XML way --><svg:svg xmlns:svg="http://www.w3.org/2000/svg">  <svg:circle cx="100" cy="100" r="50"></svg:circle></svg:svg>""";

License

This plugin is released under the MIT license, seeLICENSE.txt.

About

highlights JavaScript's Template Strings in other FileType syntax rule

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors7


[8]ページ先頭

©2009-2025 Movatter.jp