Closed scottames closed 2 months ago
Hi, thanks for bringing this to my attention, and sorry for the delayed response.
Yes, this is due to how nvim-tree's on_attach works. Instead of redefining default keymappings yourself, you can call require "nvim-tree.api".config.mappings.default_on_attach(bufnr)
if you prefer:
require('nvim-tree').setup {
on_attach = function(bufnr)
local api = require('nvim-tree.api')
-- Important: When you supply an `on_attach` function, nvim-tree won't
-- automatically set up the default keymaps. To set up the default keymaps,
-- call the `default_on_attach` function. See `:help nvim-tree-quickstart-custom-mappings`.
api.config.mappings.default_on_attach(bufnr)
-- ... rest of your setup ...
end,
}
I've updated the README to mention this.
This may be unique to my setup, but I can't quite nail it down, so I thought it worth opening an issue. Maybe it's intended behavior? Thanks! And awesome plugin btw, love it!
With the
on_attach
from the main readme, most of (if not all) the default keymaps for nvim-tree are lost. Navigating files works, using the preview works, but more specific things like opening the help menu (g?
) do not.When adding them in manually inside the
on_attach
things function as expected: