Vim has Odin filetype detection but misses actual Odin filetype, syntax and indent.
Repo: https://github.com/habamax/vim-odin
https://github.com/vim/vim/pull/13867
(3 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@habamax pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@habamax pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@dkearns requested changes on this pull request.
Thanks, I was just watching an interview with the ginger one.
You're probably aware but Vim9-script runtime files won't be picked up by Neovim.
> @@ -0,0 +1,18 @@ +vim9script + +# Vim filetype plugin file +# Language: odin
s/odin/Odin/
> +# Vim filetype plugin file +# Language: odin +# Maintainer: Maxim Kim <hab...@gmail.com> +# Website: https://github.com/habamax/vim-odin +# Last Change: 2024-01-15 + +if exists("b:did_ftplugin") + finish +endif +b:did_ftplugin = 1 + +b:undo_ftplugin = 'setlocal commentstring<' + \ .. '| setlocal suffixesadd<' + +setlocal suffixesadd=.odin +setlocal commentstring=//%s
Could we also set comments for formatting commands?
> +syntax match odinInteger "\-\?\<\d\+\>" display +syntax match odinFloat "\-\?\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=" display +syntax match odinHex "\<0[xX][0-9A-Fa-f]\+\>" display +syntax match odinDoz "\<0[zZ][0-9a-bA-B]\+\>" display +syntax match odinOct "\<0[oO][0-7]\+\>" display +syntax match odinBin "\<0[bB][01]\+\>" display + +syntax match odinAddressOf "&" display +syntax match odinDeref "\^" display + +syntax match odinMacro "#\<\w\+\>" display + +syntax match odinTemplate "$\<\w\+\>" + +syntax region odinLineComment start=/\/\// end=/$/ contains=@Spell,odinTodo +syntax region odinBlockComment start=/\v\/\*/ end=/\v\*\// contains=@Spell,odinTodo,odinBlockComment
The \v modifier isn't doing any work here.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@habamax pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Thanks, I was just watching an interview with the ginger one.
Indeed language looks promising.
You're probably aware but Vim9-script runtime files won't be picked up by Neovim. They're not rewriting them in legacy script.
I think they can update it to legacy vimscript if needed? It shouldn't be too difficult, it is GetOdinIndent() function and a bit of script variable assignments here and there.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
found an issue with the last commit (wrt indentation), investigating.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
while cindent does almost what I think Odin needs, on edge cases it fails miserably. Let me convert this to draft for now, I will need to re-implement indentation algorithm from scratch.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@habamax pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Indentation looks ok so far -- tested it on demo.odin bundled with the language.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@habamax pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I think they can update it to legacy vimscript if needed? It shouldn't be too difficult, it is GetOdinIndent() function and a bit of script variable assignments here and there.
I won't, for the record; I'll just include the syntax file (and possibly the ftplugin; that indeed looks fairly trivial to translate back). Non-trivial vim9script files will be skipped until we get automated transpiling working (which is looking unlikely soon). If someone were to contribute a manual translation that is close enough to the original so changes can be backported (again, manually) easily, that could also be accepted. (Nobody has, so far, so there's no official policy around that yet.)
(Not complaining, to be clear; just wanted to let you know what is what from our side since you do take it into consideration -- which I appreciate. No hard feelings whatever you do!)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@habamax pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@habamax pushed 1 commit.
—
View it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Thanks!
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Merged #13867 into master.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()