-
So here I have this config copied from the repo documentation: -- set termguicolors to enable highlight groups vim.opt.termguicolors = true
local function on_attach(bufnr)
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent,
opts('Up'))
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
vim.keymap.set('n', '<leader>s', api.tree.toggle_help, opts('Help'))
end
-- pass to setup along with your other options
require("nvim-tree").setup {
sort_by = "case_sensitive",
view = {width = 30},
renderer = {group_empty = true},
filters = {dotfiles = true},
on_attach = on_attach
} Before I open nvim-tree, the As far as I understand on_attach setting is loaded once the nvim-tree is first launched, and then it propagates the changes on the rest of the vim. So what should I do if I want my key bindings to work only in nvim-tree window and the default behavior - everywhere else? Write some script that checks if current window is a nvim-tree window? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
What does your |
Beta Was this translation helpful? Give feedback.
Ok, actually I figured out that I need to pass bufnr parameter that I receive in on_attach function into the key bindings setting every time it's called. So now everything is working!