Skip to content

Commit 43b1032

Browse files
committed
ENH Basic syntax highlighting for ngl files
0 parents  commit 43b1032

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Vim plugin for editing ngless files
2+
3+
Currently adds syntax highlighting for
4+
[ngless](http://luispedro.github.io/ngless/).
5+
6+
This is compatible with [vundle](https://github.com/VundleVim/Vundle.vim), so
7+
you should be able to just add the following line to your '.vimrc' file:
8+
9+
Plugin 'luispedro/vim-ngless'

ftdetect/ngless.vim

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
au BufRead,BufNewFile *.ngl set filetype=ngl syntax=ngl

syntax/ngl.vim

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
" Vim syntax file
2+
" Language: ngl
3+
" Maintainer: Luis Pedro Coelho <[email protected]>
4+
5+
syn case ignore
6+
7+
syn keyword nglKeyword ngless fastq preprocess map write count annotate
8+
syn keyword nglOperator ? : == != > >= < <= + - % * /
9+
10+
syn match nglFunction "\<[a-zA-Z][a-zA-Z0-9_]*\s*(" contains=nglFunctionName
11+
12+
syn region nglString start=+"+ skip=+\\\\\|\\"+ end=+"+
13+
syn region nglString start=+'+ skip=+\\\\\|\\'+ end=+'+
14+
syn region nglString start=+`+ skip=+\\\\\|\\`+ end=+`+
15+
16+
syn match nglSymbol "{[a-zA-Z0-9_]\+}"
17+
18+
" Numbers:
19+
syn match nglNumber "[-+]\=\(\<\d[[:digit:]_]*L\=\>\|0[xX]\x[[:xdigit:]_]*\>\)"
20+
syn match nglFloat "[-+]\=\<\d[[:digit:]_]*[eE][\-+]\=\d\+"
21+
syn match nglFloat "[-+]\=\<\d[[:digit:]_]*\.[[:digit:]_]*\([eE][\-+]\=\d\+\)\="
22+
syn match nglFloat "[-+]\=\<\.[[:digit:]_]\+\([eE][\-+]\=\d\+\)\="
23+
24+
" Comments:
25+
syn region nglComment start="/\*" end="\*/" contains=nglTodo
26+
syn match nglComment "//.*$" contains=nglTodo
27+
syn match nglComment "#.*$" contains=nglTodo
28+
syn sync ccomment nglComment
29+
30+
" Todo.
31+
syn keyword nglTodo TODO FIXME XXX DEBUG NOTE contained
32+
33+
" Define the default highlighting.
34+
" For version 5.7 and earlier: only when not done already
35+
" For version 5.8 and later: only when an item doesn't have highlighting yet
36+
if version >= 508 || !exists("did_c_syn_inits")
37+
if version < 508
38+
let did_c_syn_inits = 1
39+
command -nargs=+ HiLink hi link <args>
40+
else
41+
command -nargs=+ HiLink hi def link <args>
42+
endif
43+
44+
HiLink nglComment Comment
45+
HiLink nglOpWord Label
46+
HiLink nglOperator Operator
47+
HiLink nglType Type
48+
HiLink nglSpecial Special
49+
HiLink nglKeyword Statement
50+
HiLink nglNumber Number
51+
HiLink nglFloat Float
52+
HiLink nglSymbol Constant
53+
HiLink nglAssignVar Identifier
54+
HiLink nglString String
55+
HiLink nglTodo Todo
56+
57+
HiLink nglFunctionName Function
58+
59+
60+
delcommand HiLink
61+
endif
62+
63+
let b:current_syntax = "ngl"
64+

0 commit comments

Comments
 (0)