From 50a89054a84294894fbd4cc44b5f43781739a242 Mon Sep 17 00:00:00 2001 From: surdeus Date: Mon, 20 May 2024 22:35:49 +0500 Subject: [PATCH] added the tengo syntax highlight. --- nvim/ftdetect/tengo.vim | 2 + nvim/ginit.vim | 11 ++++++ nvim/lua/filetypes.lua | 6 +++ nvim/syntax/tengo.vim | 86 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 nvim/ftdetect/tengo.vim create mode 100644 nvim/ginit.vim create mode 100644 nvim/lua/filetypes.lua create mode 100644 nvim/syntax/tengo.vim diff --git a/nvim/ftdetect/tengo.vim b/nvim/ftdetect/tengo.vim new file mode 100644 index 0000000..af54db7 --- /dev/null +++ b/nvim/ftdetect/tengo.vim @@ -0,0 +1,2 @@ +autocmd BufRead,BufNewFile *.tengo set filetype=tengo + diff --git a/nvim/ginit.vim b/nvim/ginit.vim new file mode 100644 index 0000000..9ad9d32 --- /dev/null +++ b/nvim/ginit.vim @@ -0,0 +1,11 @@ +let s:fontsize = 12 +function! AdjustFontSize(amount) + let s:fontsize = s:fontsize+a:amount + :execute "GuiFont! Monospace:h" . s:fontsize +endfunction + +noremap :call AdjustFontSize(1) +noremap :call AdjustFontSize(-1) +inoremap :call AdjustFontSize(1)a +inoremap :call AdjustFontSize(-1)a + diff --git a/nvim/lua/filetypes.lua b/nvim/lua/filetypes.lua new file mode 100644 index 0000000..ffb1ed0 --- /dev/null +++ b/nvim/lua/filetypes.lua @@ -0,0 +1,6 @@ + +vim.filetype.add({ + extension = { + pmd = "markdown", + }, +}) diff --git a/nvim/syntax/tengo.vim b/nvim/syntax/tengo.vim new file mode 100644 index 0000000..e70eb28 --- /dev/null +++ b/nvim/syntax/tengo.vim @@ -0,0 +1,86 @@ +" Vim syntax file +" Language: Tengo +" Maintainer: E Sequeira +" URL: https://github.com/geseq/vim-tengo + +if exists('b:current_syntax') + finish +endif + +syn case match + +" Folding +syn region FoldingBrace start="{" end="}" transparent fold +syn region FoldingParen start='(' end=')' transparent fold + +" Interpreter directive +syn match HashBang "\%1l^#!.*" +hi def link HashBang PreProc + +" Comments +syn region CommentBlock start="/\*" end="\*/" +syn region CommentBlock start="//" end="$" + +hi def link CommentBlock Comment + +" Interpreted strings +syn region InterpString start=+"+ skip=+\\\\\|\\"+ end=+"+ +syn region InterpString start=+`+ skip=+\\\\\|\\"+ end=+`+ +hi def link InterpString string + +" Raw strings +syn region RawString start=+'+ skip=+\\\\\|\\'+ end=+'+ +hi def link RawString character + +" Built-in functions +syn keyword BuiltinFuncs format len copy append delete splice type_name +syn keyword BuiltinFuncs string int bool float char bytes time error range +syn keyword BuiltinFuncs is_string is_int is_bool is_float is_char is_bytes is_error +syn keyword BuiltinFuncs is_undefined is_function is_callable is_array is_immutable_array +syn keyword BuiltinFuncs is_map is_immutable_map is_iterable is_time + +hi def link BuiltinFuncs Keyword + + +" Functions +syn match FuncDecl /\/ +hi def link FuncDecl Type + +" Floating point +syn match FloatLit "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" +syn match FloatLit "\<\.\d\+\([Ee][-+]\d\+\)\?\>" +syn match FloatLit "\<\d\+[Ee]-\d\+\>" + +hi def link FloatLit Float + +" Integers +syn match Integers "\<0x\x\+\>" +syn match Integers "\<0\o\+\>" +syn match Integers "\<\d\+\([Ee]\d\+\)\?\>" +syn match Integers "\<\d\+\([Ee]+\d\+\)\?\>" + +hi def link Integers Number + +" Constants +syn keyword Constants true false undefined +hi def link Constants Keyword + +" Keywords +syn keyword CtrlWords return break continue +syn keyword CondWords if else +syn keyword Directive import export +syn keyword RepeatWords for in +syn keyword Declaration var error immutable + +hi def link CtrlWords Statement +hi def link CondWords Conditional +hi def link Directive Statement +hi def link RepeatWords Repeat +hi def link Declaration Keyword + +" Function call +syntax match FuncCall /\<\K\k*\ze(/ +hi def link FuncCall Keyword + +let b:current_syntax = 'tengo' +