runtime(gleam): update filetype plugin, include new compiler and syntax script
Commit: https://github.com/vim/vim/commit/32f49738d1807b1553d1fbd2f5d1b0b4849dbcb5 Author: Kirill Morozov <mail2kir...@gmail.com> Date: Thu Apr 24 21:28:56 2025 +0200 runtime(gleam): update filetype plugin, include new compiler and syntax script closes: https://github.com/vim/vim/issues/17172 Signed-off-by: Kirill Morozov <mail2kir...@gmail.com> Signed-off-by: Doug Kearns <dougkea...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/.github/MAINTAINERS b/.github/MAINTAINERS index 6c723186d..132585e83 100644 --- a/.github/MAINTAINERS +++ b/.github/MAINTAINERS @@ -63,6 +63,7 @@ runtime/compiler/eruby.vim @dkearns runtime/compiler/fbc.vim @dkearns runtime/compiler/gawk.vim @dkearns runtime/compiler/gjs.vim @dkearns +runtime/compiler/gleam.vim @kirillmorozov runtime/compiler/gm2.vim @dkearns runtime/compiler/go.vim @dbarnett runtime/compiler/groff.vim @Konfekt @@ -500,6 +501,7 @@ runtime/syntax/gitconfig.vim @tpope runtime/syntax/gitignore.vim @ObserverOfTime runtime/syntax/gitolite.vim @sitaramc runtime/syntax/gitrebase.vim @tpope +runtime/syntax/gleam.vim @kirillmorozov runtime/syntax/glsl.vim @gpanders runtime/syntax/go.vim @bhcleek runtime/syntax/goaccess.vim @meonkeys diff --git a/runtime/compiler/gleam_build.vim b/runtime/compiler/gleam_build.vim new file mode 100644 index 000000000..c2b1679b3 --- /dev/null +++ b/runtime/compiler/gleam_build.vim @@ -0,0 +1,25 @@ +" Vim compiler file +" Language: Gleam +" Maintainer: Kirill Morozov <kir...@robotix.pro> +" Based On: https://github.com/gleam-lang/gleam.vim +" Last Change: 2025 Apr 21 + +if exists('current_compiler') + finish +endif +let current_compiler = "gleam_build" + +CompilerSet makeprg=gleam\ build + +" Example error message: +" +" error: Unknown variable +" ┌─ /home/michael/root/projects/tutorials/gleam/try/code/src/main.gleam:19:18 +" │ +" 19 │ Ok(tuple(name, spot)) +" │ ^^^^ did you mean `sport`? +" +" The name `spot` is not in scope here. +CompilerSet errorformat=%Eerror:\ %m,%Wwarning:\ %m,%C\ %#┌─%#\ %f:%l:%c\ %#-%# + +" vim: sw=2 sts=2 et diff --git a/runtime/ftplugin/gleam.vim b/runtime/ftplugin/gleam.vim index 70958c70f..3ea68fa0a 100644 --- a/runtime/ftplugin/gleam.vim +++ b/runtime/ftplugin/gleam.vim @@ -2,24 +2,32 @@ " Language: Gleam " Maintainer: Kirill Morozov <kir...@robotix.pro> " Previous Maintainer: Trilowy (https://github.com/trilowy) -" Last Change: 2025 Apr 16 +" Based On: https://github.com/gleam-lang/gleam.vim +" Last Change: 2025 Apr 21 if exists('b:did_ftplugin') finish endif let b:did_ftplugin = 1 -setlocal comments=://,:///,://// +setlocal comments=:////,:///,:// setlocal commentstring=//\ %s setlocal formatprg=gleam\ format\ --stdin - -let b:undo_ftplugin = "setlocal com< cms< fp<" +setlocal suffixesadd=.gleam +let b:undo_ftplugin = "setlocal com< cms< fp< sua<" if get(g:, "gleam_recommended_style", 1) setlocal expandtab setlocal shiftwidth=2 + setlocal smartindent setlocal softtabstop=2 - let b:undo_ftplugin ..= " | setlocal et< sw< sts<" + setlocal tabstop=2 + let b:undo_ftplugin ..= " | setlocal et< sw< si< sts< ts<" +endif + +if !exists('current_compiler') + compiler gleam_build + let b:undo_ftplugin ..= "| compiler make" endif " vim: sw=2 sts=2 et diff --git a/runtime/syntax/gleam.vim b/runtime/syntax/gleam.vim new file mode 100644 index 000000000..6c2bab7ba --- /dev/null +++ b/runtime/syntax/gleam.vim @@ -0,0 +1,97 @@ +" Vim syntax file +" Language: Gleam +" Maintainer: Kirill Morozov <kir...@robotix.pro> +" Based On: https://github.com/gleam-lang/gleam.vim +" Last Change: 2025 Apr 20 + +if exists("b:current_syntax") + finish +endif +let b:current_syntax = "gleam" + +syntax case match + +" Keywords +syntax keyword gleamConditional case if +syntax keyword gleamConstant const +syntax keyword gleamDebug echo +syntax keyword gleamException panic assert todo +syntax keyword gleamInclude import +syntax keyword gleamKeyword as let use +syntax keyword gleamStorageClass pub opaque +syntax keyword gleamType type + +" Number +"" Int +syntax match gleamNumber "\<-\=\%(0\|\%(\d\|\d_\d\)\+\)\>" + +"" Binary +syntax match gleamNumber "\<-\=0[bB]_\?\%([01]\|[01]_[01]\)\+\>" + +"" Octet +syntax match gleamNumber "\<-\=0[oO]\?_\?\%(\o\|\o_\o\)\+\>" + +"" Hexadecimal +syntax match gleamNumber "\<-\=0[xX]_\?\%(\x\|\x_\x\)\+\>" + +"" Float +syntax match gleamFloat "\(0*[1-9][0-9_]*\|0\)\.\(0*[1-9][0-9_]*\|0\)\(e-\=0*[1-9][0-9_]*\)\=" + +" String +syntax region gleamString start=/"/ end=/"/ contains=gleamSpecial +syntax match gleamSpecial '\.' contained + +" Operators +"" Basic +syntax match gleamOperator "[-+/*]\.\=\|[%=]" + +"" Arrows + Pipeline +syntax match gleamOperator "<-\|[-|]>" + +"" Bool +syntax match gleamOperator "&&\|||" + +"" Comparison +syntax match gleamOperator "[<>]=\=\.\=\|[=!]=" + +"" Misc +syntax match gleamOperator "\.\.\|<>\||" + +" Type +syntax match gleamIdentifier "\<[A-Z][a-zA-Z0-9]*\>" + +" Attribute +syntax match gleamPreProc "@[a-z][a-z_]*" + +" Function definition +syntax keyword gleamKeyword fn nextgroup=gleamFunction skipwhite skipempty +syntax match gleamFunction "[a-z][a-z0-9_]*\ze\s*(" skipwhite skipnl + +" Comments +syntax region gleamComment start="//" end="$" contains=gleamTodo +syntax region gleamSpecialComment start="///" end="$" +syntax region gleamSpecialComment start="////" end="$" +syntax keyword gleamTodo contained TODO FIXME XXX NB NOTE + +" Highlight groups +highlight link gleamComment Comment +highlight link gleamConditional Conditional +highlight link gleamConstant Constant +highlight link gleamDebug Debug +highlight link gleamException Exception +highlight link gleamFloat Float +highlight link gleamFunction Function +highlight link gleamIdentifier Identifier +highlight link gleamInclude Include +highlight link gleamKeyword Keyword +highlight link gleamNumber Number +highlight link gleamOperator Operator +highlight link gleamPreProc PreProc +highlight link gleamSpecial Special +highlight link gleamSpecialComment SpecialComment +highlight link gleamStorageClass StorageClass +highlight link gleamString String +highlight link gleamTodo Todo +highlight link gleamType Type + +" vim: sw=2 sts=2 et -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1u82VO-005cJc-VN%40256bit.org.