neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 4f0adb6a783e2d92301d5391c4b35a62268d2a00
parent 94fee354465d7d8636f454a9bcca9080ef9e50bd
Author: Christian Clason <c.clason@uni-graz.at>
Date:   Mon, 23 Oct 2023 19:30:44 +0200

vim-patch:9.0.2062: Janet files are not recognised

Problem:  Janet files are not recognised
Solution: Add filename and shebang detection (without
          adding an extra filetype plugin)

Those are used by the Janet language:
http://www.janet-lang.org

closes: vim/vim#13400

https://github.com/vim/vim/commit/c038427d2a27445e612761f19c92b2b8b05afdea

Co-authored-by: Doug Kearns <dougkearns@gmail.com>

Diffstat:
Mruntime/lua/vim/filetype.lua | 1+
Mruntime/lua/vim/filetype/detect.lua | 3++-
Mtest/old/testdir/test_filetype.vim | 2++
3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua @@ -536,6 +536,7 @@ local extension = { jal = 'jal', jpr = 'jam', jpl = 'jam', + janet = 'janet', jav = 'java', java = 'java', jj = 'javacc', diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua @@ -1652,8 +1652,9 @@ local patterns_hashbang = { ['icon\\>'] = { 'icon', { vim_regex = true } }, guile = 'scheme', ['nix%-shell'] = 'nix', - ['crystal\\>'] = { 'crystal', { vim_regex = true } }, + ['^crystal\\>'] = { 'crystal', { vim_regex = true } }, ['^\\%(rexx\\|regina\\)\\>'] = { 'rexx', { vim_regex = true } }, + ['^janet\\>'] = { 'janet', { vim_regex = true } }, } ---@private diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim @@ -325,6 +325,7 @@ func s:GetFilenameChecks() abort \ 'j': ['file.ijs'], \ 'jal': ['file.jal', 'file.JAL'], \ 'jam': ['file.jpl', 'file.jpr', 'JAM-file.file', 'JAM.file', 'Prl-file.file', 'Prl.file'], + \ 'janet': ['file.janet'], \ 'java': ['file.java', 'file.jav'], \ 'javacc': ['file.jj', 'file.jjt'], \ 'javascript': ['file.js', 'file.jsm', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs'], @@ -864,6 +865,7 @@ let s:script_checks = { \ 'crystal': [['#!/path/crystal']], \ 'rexx': [['#!/path/rexx'], \ ['#!/path/regina']], + \ 'janet': [['#!/path/janet']], \ } " Various forms of "env" optional arguments.