neovim

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

commit 50577534318bbf8c1e22e80a74baa3b20c131ea8
parent 423176db565cc182dac8b9562ccb23605f96fa2d
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Mon, 23 Sep 2024 16:49:34 +0800

fix(runtime): treat b:undo_ftplugin consistently in Lua ftplugins (#30473)

- Don't assume b:undo_ftplugin is set when first modifying it.
- Don't assume b:undo_ftplugin already contains some resetting.
Diffstat:
Mruntime/ftplugin/arduino.lua | 2++
Mruntime/ftplugin/c.lua | 2+-
Mruntime/ftplugin/ch.lua | 2++
Mruntime/ftplugin/cs.lua | 2+-
Mruntime/ftplugin/d.lua | 2+-
Mruntime/ftplugin/glsl.lua | 2+-
Mruntime/ftplugin/help.lua | 2+-
Mruntime/ftplugin/indent.lua | 2++
Mruntime/ftplugin/lua.lua | 2+-
Mruntime/ftplugin/objc.lua | 2++
Mruntime/ftplugin/query.lua | 2+-
Mruntime/ftplugin/swift.lua | 2+-
Mruntime/ftplugin/xs.lua | 2++
13 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/runtime/ftplugin/arduino.lua b/runtime/ftplugin/arduino.lua @@ -1 +1,3 @@ vim.bo.commentstring = '// %s' + +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<' diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua @@ -11,4 +11,4 @@ if vim.fn.isdirectory('/usr/include') == 1 then ]]) end -vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | setl path<' +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring< define< include< path<' diff --git a/runtime/ftplugin/ch.lua b/runtime/ftplugin/ch.lua @@ -1 +1,3 @@ vim.bo.commentstring = '// %s' + +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<' diff --git a/runtime/ftplugin/cs.lua b/runtime/ftplugin/cs.lua @@ -1,3 +1,3 @@ vim.bo.commentstring = '// %s' -vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | setl commentstring<' +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<' diff --git a/runtime/ftplugin/d.lua b/runtime/ftplugin/d.lua @@ -1,3 +1,3 @@ vim.bo.commentstring = '// %s' -vim.b.undo_ftplugin = 'setl commentstring<' +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<' diff --git a/runtime/ftplugin/glsl.lua b/runtime/ftplugin/glsl.lua @@ -1,3 +1,3 @@ vim.bo.commentstring = '// %s' -vim.b.undo_ftplugin = 'setl commentstring<' +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<' diff --git a/runtime/ftplugin/help.lua b/runtime/ftplugin/help.lua @@ -31,5 +31,5 @@ vim.keymap.set('n', 'gO', function() require('vim.vimhelp').show_toc() end, { buffer = 0, silent = true }) +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n exe "nunmap <buffer> gO"' vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()' -vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | nunmap <buffer> gO' diff --git a/runtime/ftplugin/indent.lua b/runtime/ftplugin/indent.lua @@ -1 +1,3 @@ vim.bo.commentstring = '// %s' + +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<' diff --git a/runtime/ftplugin/lua.lua b/runtime/ftplugin/lua.lua @@ -1,4 +1,4 @@ -- use treesitter over syntax vim.treesitter.start() -vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()' +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n call v:lua.vim.treesitter.stop()' diff --git a/runtime/ftplugin/objc.lua b/runtime/ftplugin/objc.lua @@ -1 +1,3 @@ vim.bo.commentstring = '// %s' + +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<' diff --git a/runtime/ftplugin/query.lua b/runtime/ftplugin/query.lua @@ -34,5 +34,5 @@ end -- it's a lisp! vim.cmd([[runtime! ftplugin/lisp.vim]]) -vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | setl omnifunc< iskeyword<' +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl omnifunc< iskeyword<' vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | call v:lua.vim.treesitter.stop()' diff --git a/runtime/ftplugin/swift.lua b/runtime/ftplugin/swift.lua @@ -1,3 +1,3 @@ vim.bo.commentstring = '// %s' -vim.b.undo_ftplugin = vim.b.undo_ftplugin .. ' | setl commentstring<' +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<' diff --git a/runtime/ftplugin/xs.lua b/runtime/ftplugin/xs.lua @@ -1 +1,3 @@ vim.bo.commentstring = '// %s' + +vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '') .. '\n setl commentstring<'