From 750ad1884586628c5aa7fca7a23411035ce26a42 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 26 Jun 2021 10:50:17 -0400 Subject: [PATCH 1/3] vim-patch:8.2.3050: cannot recognize elixir files Problem: Cannot recognize elixir files. Solution: Recognize Elixir-specific files. Check if an .ex file is Euphoria or Elixir. (Austin Gatlin, closes vim/vim#8401, closes vim/vim#8446) https://github.com/vim/vim/commit/f3caeb63d62c08b579e9b5f40b35e8bf64dde87a --- runtime/autoload/dist/ft.vim | 11 +++++++++ runtime/filetype.vim | 11 +++++++-- src/nvim/testdir/test_filetype.vim | 38 ++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 1ac74b5785..ac80659113 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -172,6 +172,17 @@ func dist#ft#FTent() setf dtd endfunc +func dist#ft#ExCheck() + let lines = getline(1, min([line("$"), 100])) + if exists('g:filetype_euphoria') + exe 'setf ' . g:filetype_euphoria + elseif match(lines, '^--\|^ifdef\>\|^include\>') > -1 + setf euphoria3 + else + setf elixir + endif +endfunc + func dist#ft#EuphoriaCheck() if exists('g:filetype_euphoria') exe 'setf ' . g:filetype_euphoria diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 09a1d1d0e6..d449edfd02 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -389,7 +389,7 @@ au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf " Configure scripts au BufNewFile,BufRead configure.in,configure.ac setf config -" CUDA Cumpute Unified Device Architecture +" CUDA Compute Unified Device Architecture au BufNewFile,BufRead *.cu,*.cuh setf cuda " Dockerfilb; Podman uses the same syntax with name Containerfile @@ -404,8 +404,15 @@ au BufNewFile,BufRead *enlightenment/*.cfg setf c " Eterm au BufNewFile,BufRead *Eterm/*.cfg setf eterm +" Elixir or Euphoria +au BufNewFile,BufRead *.ex call dist#ft#ExCheck() + +" Elixir +au BufRead,BufNewFile mix.lock,*.exs setf elixir +au BufRead,BufNewFile *.eex,*.leex setf eelixir + " Euphoria 3 or 4 -au BufNewFile,BufRead *.eu,*.ew,*.ex,*.exu,*.exw call dist#ft#EuphoriaCheck() +au BufNewFile,BufRead *.eu,*.ew,*.exu,*.exw call dist#ft#EuphoriaCheck() if has("fname_case") au BufNewFile,BufRead *.EU,*.EW,*.EX,*.EXU,*.EXW call dist#ft#EuphoriaCheck() endif diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 71a7a2cce5..202177053a 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -161,6 +161,8 @@ let s:filename_checks = { \ 'ecd': ['file.ecd'], \ 'edif': ['file.edf', 'file.edif', 'file.edo'], \ 'elinks': ['elinks.conf'], + \ 'elixir': ['file.ex', 'file.exs', 'mix.lock'], + \ 'eelixir': ['file.eex', 'file.leex'], \ 'elm': ['file.elm'], \ 'elmfilt': ['filter-rules'], \ 'epuppet': ['file.epp'], @@ -765,5 +767,41 @@ func Test_pp_file() filetype off endfunc +func Test_ex_file() + filetype on + + call writefile(['arbitrary content'], 'Xfile.ex') + split Xfile.ex + call assert_equal('elixir', &filetype) + bwipe! + let g:filetype_euphoria = 'euphoria4' + split Xfile.ex + call assert_equal('euphoria4', &filetype) + bwipe! + unlet g:filetype_euphoria + + call writefile(['-- filetype euphoria comment'], 'Xfile.ex') + split Xfile.ex + call assert_equal('euphoria3', &filetype) + bwipe! + + call writefile(['--filetype euphoria comment'], 'Xfile.ex') + split Xfile.ex + call assert_equal('euphoria3', &filetype) + bwipe! + + call writefile(['ifdef '], 'Xfile.ex') + split Xfile.ex + call assert_equal('euphoria3', &filetype) + bwipe! + + call writefile(['include '], 'Xfile.ex') + split Xfile.ex + call assert_equal('euphoria3', &filetype) + bwipe! + + call delete('Xfile.ex') + filetype off +endfunc " vim: shiftwidth=2 sts=2 expandtab From eb7e7ad882aedc2204a46289f4b66996e835697b Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 26 Jun 2021 11:37:43 -0400 Subject: [PATCH 2/3] vim-patch:8.2.3049: JSON patch file not recognized Problem: JSON patch file not recognized. Solution: Recognize json-patch as json. (Kevin Locke, closes vim/vim#8450) https://github.com/vim/vim/commit/6582e230a0f6592287b1123c5fc3807d6fed997e --- runtime/filetype.vim | 3 +++ src/nvim/testdir/test_filetype.vim | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index d449edfd02..b3bc282c89 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -858,6 +858,9 @@ au BufNewFile,BufRead *.jov,*.j73,*.jovial setf jovial " JSON au BufNewFile,BufRead *.json,*.jsonp,*.webmanifest setf json +" JSON Patch (RFC 6902) +au BufNewFile,BufRead *.json-patch setf json + " Jupyter Notebook is also json au BufNewFile,BufRead *.ipynb setf json diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 202177053a..f10d2b6159 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -259,7 +259,7 @@ let s:filename_checks = { \ 'jgraph': ['file.jgr'], \ 'jovial': ['file.jov', 'file.j73', 'file.jovial'], \ 'jproperties': ['file.properties', 'file.properties_xx', 'file.properties_xx_xx', 'some.properties_xx_xx_file'], - \ 'json': ['file.json', 'file.jsonp', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb'], + \ 'json': ['file.json', 'file.jsonp', 'file.json-patch', 'file.webmanifest', 'Pipfile.lock', 'file.ipynb'], \ 'jsp': ['file.jsp'], \ 'kconfig': ['Kconfig', 'Kconfig.debug', 'Kconfig.file'], \ 'kivy': ['file.kv'], From 7a239a8a9affc2bac215dec1d08e55e1b065a4c4 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 26 Jun 2021 11:43:19 -0400 Subject: [PATCH 3/3] vim-patch:8.2.2954: short file name extension for Scala not recognized Problem: Short file name extension for Scala not recognized. Solution: Recognize *.sc. (closes vim/vim#8337) https://github.com/vim/vim/commit/6db7b6375a3ea3afef5295b1366896902012e640 --- runtime/filetype.vim | 2 +- src/nvim/testdir/test_filetype.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index b3bc282c89..2617d8ffc0 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1505,7 +1505,7 @@ au BufNewFile,BufRead *.sass setf sass au BufNewFile,BufRead *.sa setf sather " Scala -au BufNewFile,BufRead *.scala setf scala +au BufNewFile,BufRead *.scala,*.sc setf scala " SBT - Scala Build Tool au BufNewFile,BufRead *.sbt setf sbt diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index f10d2b6159..eb6151fbe1 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -424,7 +424,7 @@ let s:filename_checks = { \ 'sass': ['file.sass'], \ 'sather': ['file.sa'], \ 'sbt': ['file.sbt'], - \ 'scala': ['file.scala'], + \ 'scala': ['file.scala', 'file.sc'], \ 'scheme': ['file.scm', 'file.ss', 'file.rkt'], \ 'scilab': ['file.sci', 'file.sce'], \ 'screen': ['.screenrc', 'screenrc'],