Skip to content
\n

I would like this behaviour to continue working in all windows, including the nvim-tree one.

\n

I have checked the on_attach section in the manual, however adding vim.keymap.del() after the api.config.mappings.default_on_attach(bufnr) does not seem to work.

\n

Any clues?

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"
\n
require(\"nvim-tree\").setup({\n    on_attach = my_on_attach()\n})
\n
\n

I think that's going to set on_attach to nil - the result of the function.

\n

Try setting to the function itself, so that it may be called when creating the tree, see :help nvim-tree-mappings

\n
  require(\"nvim-tree\").setup({\n    ---\n    on_attach = my_on_attach,\n    ---
","upvoteCount":0,"url":"https://github.com/nvim-tree/nvim-tree.lua/discussions/3116#discussioncomment-12965567"}}}
Discussion options

You must be logged in to vote
require("nvim-tree").setup({
    on_attach = my_on_attach()
})

I think that's going to set on_attach to nil - the result of the function.

Try setting to the function itself, so that it may be called when creating the tree, see :help nvim-tree-mappings

  require("nvim-tree").setup({
    ---
    on_attach = my_on_attach,
    ---

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@savchenko
Comment options

@alex-courtis
Comment options

Answer selected by savchenko
@savchenko
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants