Skip to content

How could I assign options for toggle command? #3079

Closed
@CoinCheung

Description

@CoinCheung

I tried this but it failed.

vim.keymap.set("n", "<leader>n", ":NvimTreeToggle<cr>", {current_window=true})

When I try this, it works:

vim.keymap.set("n", "<leader>n",
    function() nvim_tree_api.tree.toggle({ path = "<args>", current_window = false, focus = true, find_file = false, update_root = false }) end,
    { noremap = true })

But when I run this in split window, it will destroy my split pattern, and open the file in non-focus buffer. Maybe this is a bug, or is there other points to config?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions