From 4dffe1ff2f284fbd4d2bdb6a0f3997e21f9c0c6c Mon Sep 17 00:00:00 2001 From: shadmansaleh Date: Wed, 2 Jun 2021 16:33:40 +0600 Subject: feat(runtime): Allow lua to be used in indent --- runtime/indent.vim | 3 ++- test/functional/lua/runtime_spec.lua | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/runtime/indent.vim b/runtime/indent.vim index 12f03648ca..2b64dd44b9 100644 --- a/runtime/indent.vim +++ b/runtime/indent.vim @@ -24,7 +24,8 @@ augroup filetypeindent " When there is a dot it is used to separate filetype names. Thus for " "aaa.bbb" load "indent/aaa.vim" and then "indent/bbb.vim". for name in split(s, '\.') - exe 'runtime! indent/' . name . '.vim' + exe 'runtime! indent/' . name . '.vim' + exe 'runtime! indent/' . name . '.lua' endfor endif endfunc diff --git a/test/functional/lua/runtime_spec.lua b/test/functional/lua/runtime_spec.lua index b55141f427..cd554d6bea 100644 --- a/test/functional/lua/runtime_spec.lua +++ b/test/functional/lua/runtime_spec.lua @@ -136,5 +136,24 @@ describe('runtime:', function() rmdir(ftplugin_folder) end) end) + + describe('indent', function() + local indent_folder = table.concat({xconfig, 'nvim', 'indent'}, pathsep) + + before_each(clear) + + it('loads lua indents', function() + local indent_file = table.concat({indent_folder , 'new-ft.lua'}, pathsep) + mkdir_p(indent_folder) + write_file(indent_file , [[ vim.g.lua_indent = 1 ]]) + + clear{ args_rm={'-u' }, env={ XDG_CONFIG_HOME=xconfig, VIMRUNTIME='runtime/' }} + + exec [[set filetype=new-ft]] + eq(1, eval('g:lua_indent')) + rmdir(indent_folder) + end) + end) + end) -- cgit