aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/lua/vim/filetype/detect.lua4
-rw-r--r--test/old/testdir/test_filetype.vim6
2 files changed, 8 insertions, 2 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 94106a3547..70e590ed10 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -771,14 +771,14 @@ end
function M.mod(path, bufnr)
if vim.g.filetype_mod then
return vim.g.filetype_mod
+ elseif matchregex(path, [[\c\<go\.mod$]]) then
+ return 'gomod'
elseif is_lprolog(bufnr) then
return 'lprolog'
elseif matchregex(nextnonblank(bufnr, 1), [[\%(\<MODULE\s\+\w\+\s*;\|^\s*(\*\)]]) then
return 'modula2'
elseif is_rapid(bufnr) then
return 'rapid'
- elseif matchregex(path, [[\c\<go\.mod$]]) then
- return 'gomod'
else
-- Nothing recognized, assume modsim3
return 'modsim3'
diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim
index effb67a3df..9ca267f78c 100644
--- a/test/old/testdir/test_filetype.vim
+++ b/test/old/testdir/test_filetype.vim
@@ -1450,6 +1450,12 @@ func Test_mod_file()
bwipe!
call delete('go.mod')
+ call writefile(['module M'], 'go.mod')
+ split go.mod
+ call assert_equal('gomod', &filetype)
+ bwipe!
+ call delete('go.mod')
+
filetype off
endfunc