From 12276832ab67b16f795d78c72386ab28c6ee26c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20B=C3=ACnh=20An?= <111893501+brianhuster@users.noreply.github.com> Date: Mon, 14 Jul 2025 19:28:30 +0700 Subject: [PATCH] fix(runtime): set 'foldmethod' for Lua ftplugin #34929 Problem: Neovim's Lua ftplugin doesn't set `'foldmethod'`, though Vim one sets it https://github.com/vim/vim/blob/1341176e7b800238b30a137c1ea1a31ca2c3d488/runtime/ftplugin/lua.vim#L66-L68 Solution: Set it --- runtime/ftplugin/lua.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/ftplugin/lua.lua b/runtime/ftplugin/lua.lua index 7c54b2cb1e..fde121d769 100644 --- a/runtime/ftplugin/lua.lua +++ b/runtime/ftplugin/lua.lua @@ -4,7 +4,8 @@ vim.treesitter.start() vim.bo.includeexpr = [[v:lua.require'vim._ftplugin.lua'.includeexpr(v:fname)]] vim.bo.omnifunc = 'v:lua.vim.lua_omnifunc' vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()' +vim.wo[0][0].foldmethod = 'expr' vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n call v:lua.vim.treesitter.stop()' - .. '\n setl omnifunc< foldexpr< includeexpr<' + .. '\n setl omnifunc< foldexpr< foldmethod< includeexpr<'