Skip to content

Tab mapping override #2385

Closed
Closed
@oscarmlage

Description

@oscarmlage

Description

I've recently updated the nvim-tree plugin and now the <Tab> key can't be unmapped / remapped inside the nvim-tree window. My config (lazy.nvim):

return {
    'nvim-tree/nvim-tree.lua',
    dependencies = {
        'nvim-tree/nvim-web-devicons',
    },
    lazy = false,
    keys = {
        { "<Tab>", ":NvimTreeToggle<CR>", desc = "Tree toogle" },
        { "<S-r>", ":NvimTreeFindFile<CR>", desc = "Tree toogle" },
    },
    opts = {
        sort_by = "case_sensitive",
        on_attach = on_attach,
        open_on_tab = false,
        view = {
            width = 30,
            adaptive_size = false,
            mappings = {
                list = {
                  { key = "<Tab>", action = "" },
                },
            },
        },
    [...]
    },
    config = function(_, opts)
        require("nvim-tree").setup(opts)
    end,
}

In previous versions (commit a708bd2) it works like a charm but if I update (commit 18c7a31) it's not working anymore, Tab is always doing the Preview instead of :NvimTreeToggle<CR>. Is there any change I must take in account in the configuration? (thanks in advance).

Neovim version

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

macOS 13.4

nvim-tree version

18c7a31

Clean room replication

return {
    'nvim-tree/nvim-tree.lua',
    dependencies = {
        'nvim-tree/nvim-web-devicons',
    },
    lazy = false,
    keys = {
        { "<Tab>", ":NvimTreeToggle<CR>", desc = "Tree toogle" },
        { "<S-r>", ":NvimTreeFindFile<CR>", desc = "Tree toogle" },
    },
    opts = {
        sort_by = "case_sensitive",
        on_attach = on_attach,
        open_on_tab = false,
        view = {
            width = 30,
            adaptive_size = false,
            mappings = {
                list = {
                  { key = "<Tab>", action = "" },
                },
            },
        },
    [...]
    },
    config = function(_, opts)
        require("nvim-tree").setup(opts)
    end,
}

Steps to reproduce

  1. Nvim
  2. <Tab>, nvim-tree window opens
  3. <Tab> again from inside nvim-tree window

Expected behavior

nvim-tree window should be closed as <Tab> is configured to toggle it

Actual behavior

It Preview the selected file/directory (because <Tab> default action is preview, I guess)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions