Skip to content

Commit b84ffe9

Browse files
committed
Initial commit
0 parents  commit b84ffe9

File tree

5 files changed

+130
-0
lines changed

5 files changed

+130
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 João Abecasis
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# vim-jslt
2+
3+
[JSLT](https://github.com/schibsted/jslt) filetype plugin for Vim.
4+
5+
## Install
6+
7+
To install via Vim plugin managers:
8+
9+
### Vundle
10+
11+
```viml
12+
Plugin 'biochimia/vim-jslt'
13+
```
14+
15+
### vim-plug
16+
17+
```viml
18+
Plug 'biochimia/vim-jslt'
19+
```
20+
21+
### Pathogen
22+
23+
```sh
24+
git clone https://github.com/biochimia/vim-jslt ~/.vim/bundle/vim-jslt
25+
```
26+
27+
## More Info
28+
29+
For more info on JSLT:
30+
* Repository: https://github.com/schibsted/jslt
31+
* Playground: http://www.garshol.priv.no/jslt-demo

ftdetect/jslt.vim

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
autocmd BufRead,BufNewFile *.jslt set filetype=jslt

ftplugin/jslt.vim

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
" Vim filetype plugin
2+
" Language: JSLT
3+
" Maintainer: João Abecasis <joao@abecasis.name>
4+
" URL: https://github.com/schibsted/jslt
5+
" Latest Revision: 13 October 2020
6+
7+
setlocal suffixesadd=.jslt
8+
setlocal iskeyword=@,$,-,_,48-57,192-255
9+
setlocal include="^\s*import\>"
10+
setlocal comments=://
11+
setlocal commentstring=//\ %s
12+
13+
" Script for filetype switching to undo the local stuff we may have changed
14+
let b:undo_ftplugin = 'setlocal suffixesadd<'
15+
\ . '|setlocal iskeyword<'
16+
\ . '|setlocal include<'
17+
\ . '|setlocal comments<'
18+
\ . '|setlocal commentstring<'

syntax/jslt.vim

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
" Vim syntax file
2+
" Language: JSLT
3+
" Maintainer: João Abecasis <joao@abecasis.name>
4+
" URL: https://github.com/schibsted/jslt
5+
" Latest Revision: 12 October 2020
6+
7+
" quit when a syntax file was already loaded
8+
if exists("b:current_syntax")
9+
finish
10+
endif
11+
12+
let s:cpo_save = &cpo
13+
set cpo&vim
14+
15+
syn match jsltStringEscape +\\"\|\\\\+ contained
16+
syn region jsltString start=+"+ skip=+\\\"\|\\\\+ end=+"+ contains=jsltStringEscape
17+
18+
syn match jsltNumber "\<-\?\%(0\|[1-9]\d*\)\%(\.\d\+\)\?\%([Ee][+-]\?\d\+\)\?\>"
19+
20+
syn keyword jsltConditional if else
21+
syn keyword jsltBoolean true false
22+
syn keyword jsltNull null
23+
syn keyword jsltRepeat for
24+
syn keyword jsltOperator and or
25+
syn match jsltOperator "\%(=\|==\|!=\|>=\|>\|<\|<=\|+\|-\|*\|\/\||\)"
26+
syn match jsltIdentifier "\h\%(\w\|-\)*" display contained
27+
syn keyword jsltStatement let nextgroup=jsltIdentifier skipwhite
28+
syn keyword jsltStatement def nextgroup=jsltIdentifier skipwhite
29+
30+
syn keyword jsltImport import nextgroup=jsltImportSource skipwhite
31+
syn region jsltImportSource start=+"+ skip=+\\\"\|\\\\+ end=+"+ contains=jsltStringEscape nextgroup=jsltImportName skipwhite
32+
syn keyword jsltImportName as contained nextgroup=jsltIdentifier skipwhite
33+
34+
syn keyword jsltCommentTodo FIXME NOTE TBD TODO XXX contained
35+
syn match jsltLineComment "\/\/.*" contains=@Spell,jsltCommentTodo
36+
37+
" The default highlight links. Can be overridden later.
38+
hi def link jsltStatement Statement
39+
hi def link jsltImportSource String
40+
hi def link jsltImportName Statement
41+
hi def link jsltConditional Conditional
42+
hi def link jsltRepeat Repeat
43+
hi def link jsltOperator Operator
44+
hi def link jsltImport Include
45+
hi def link jsltIdentifier Function
46+
hi def link jsltLineComment Comment
47+
hi def link jsltCommentTodo Todo
48+
hi def link jsltNull Constant
49+
hi def link jsltBoolean Boolean
50+
hi def link jsltString String
51+
hi def link jsltStringEscape Special
52+
hi def link jsltNumber Number
53+
54+
let b:current_syntax = "jslt"
55+
56+
let &cpo = s:cpo_save
57+
unlet s:cpo_save
58+
59+
" vim:set shiftwidth=2 softtabstop=2 tabstop=2 expandtab:

0 commit comments

Comments
 (0)