diff --git a/lua/neo-tree/sources/common/commands.lua b/lua/neo-tree/sources/common/commands.lua index 85c8a6ed..a158282b 100644 --- a/lua/neo-tree/sources/common/commands.lua +++ b/lua/neo-tree/sources/common/commands.lua @@ -669,8 +669,8 @@ M.toggle_preview = function(state) Preview.toggle(state) end -M.scroll_preview = function(state, fallback) - Preview.scroll(state, fallback) +M.scroll_preview = function(state) + Preview.scroll(state) end M.focus_preview = function() diff --git a/lua/neo-tree/sources/common/preview.lua b/lua/neo-tree/sources/common/preview.lua index 7aec65c4..3f818889 100644 --- a/lua/neo-tree/sources/common/preview.lua +++ b/lua/neo-tree/sources/common/preview.lua @@ -491,7 +491,7 @@ end local CTRL_E = utils.keycode("") local CTRL_Y = utils.keycode("") -Preview.scroll = function(state, fallback) +Preview.scroll = function(state) local direction = state.config.direction local input = direction < 0 and CTRL_E or CTRL_Y local count = math.abs(direction) @@ -502,7 +502,7 @@ Preview.scroll = function(state, fallback) end) else vim.api.nvim_buf_call(state.bufnr, function() - vim.cmd(("normal! %s"):format(utils.keycode(fallback))) + vim.cmd(("normal! %s"):format(utils.keycode(state.fallback))) end) end end diff --git a/lua/neo-tree/ui/renderer.lua b/lua/neo-tree/ui/renderer.lua index 6d8f7503..09e3e64f 100644 --- a/lua/neo-tree/ui/renderer.lua +++ b/lua/neo-tree/ui/renderer.lua @@ -852,7 +852,8 @@ local set_buffer_mappings = function(state) if type(func) == "function" then resolved_mappings[cmd].handler = function() state.config = config - return func(state, cmd) + state.fallback = cmd + return func(state) end keymap.set(state.bufnr, "n", cmd, resolved_mappings[cmd].handler, map_options) if type(vfunc) == "function" then