-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hey, I followed the doc but in my case I still have the preview when using tab.
part of my config:
nvim-tree config:
require('nvim-tree').setup {
on_attach = function(bufnr)
local api = require 'nvim-tree.api'
local FloatPreview = require 'float-preview'
local close_wrap = FloatPreview.close_wrap
-- FloatPreview.attach_nvimtree(bufnr)
local function opts(desc)
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- api.node.open.preview = customTreeFunc.open_or_expand_or_dir_up_with_node_no_edit()
-- api.config.mappings.default_on_attach(bufnr)
FloatPreview.attach_nvimtree(bufnr)
customTreeFunc.keymaps(api, close_wrap, opts)
end,in customTreeFunc.keymaps I have all keymapping and the TAB:
vim.keymap.set('n', '<Tab>', close_wrap(api.node.open.preview), opts 'Open preview')The only way to fix this was to rewrite the nvim-tree.api.node.open.preview function and comment the edit:
--- Rewrite of nvim-tree open_or_expand_or_dir_up
--- so it does not open the preview in the background
---@param mode string
---@return fun(node: table)
local function open_or_expand_or_dir_up(mode, toggle_group)
local lib = require 'nvim-tree.lib'
local actions = require 'nvim-tree.actions'
return function(node)
if node.name == '..' then
actions.root.change_dir.fn '..'
elseif node.nodes then
lib.expand_or_collapse(node, toggle_group)
end
-- elseif not toggle_group then
-- edit(mode, node)
-- end
end
end
I hope their is e better way
can check config: personal kickstart
Metadata
Metadata
Assignees
Labels
No labels