You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the last update, I cannot use this nvim plugin properly.
I saw that nvim-tree.view has been moved but with that config I don't really see what should I do and how should I initialize my local view variable
return {
"nvim-tree/nvim-tree.lua",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
local function my_on_attach(bufnr)
local api = require("nvim-tree.api")
local view = require("nvim-tree.view")
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
vim.keymap.set("n", "<C-n>", api.fs.create, opts("Create"))
vim.keymap.set("n", "<C-CR>", api.tree.change_root_to_node, opts("Change Root to Node"))
vim.keymap.set("n", "<CR>", api.node.open.edit, opts("Open"))
vim.keymap.set("n", "o", api.node.open.edit, opts("Open"))
vim.keymap.set("n", "<2-LeftMouse>", api.node.open.edit, opts("Open with mouse"))
vim.keymap.set("n", "<C-Right>", function()
if view.is_visible() then
local width = view.View.width
view.View.width = width + 5
view.resize()
end
end, opts("Increase Width"))
vim.keymap.set("n", "<C-Left>", function()
if view.is_visible() then
local width = view.View.width
view.View.width = math.max(width - 5, 10)
view.resize()
end
end, opts("Decrease Width"))
end
require("nvim-tree").setup({
on_attach = my_on_attach, -- Attache les remaps personnalisés
view = {
side = "left", -- Affiche l'arbre sur le côté gauche
width = 30, -- Largeur de la fenêtre
},
renderer = {
group_empty = true, -- Groupe les dossiers vides
},
filters = {
dotfiles = false, -- Affiche les fichiers cachés (.git, etc.)
},
git = {
enable = true, -- Affiche l'état Git
},
})
vim.keymap.set("n", "<leader>b", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle File Explorer" })
local function toggle_focus()
local view = require("nvim-tree.view")
if view.is_visible() then
if vim.api.nvim_get_current_win() == view.get_winnr() then
-- Si `nvim-tree` est actif, passe à la fenêtre de code
vim.cmd("wincmd l")
else
-- Sinon, passe à `nvim-tree`
vim.cmd("wincmd p")
end
end
end
vim.keymap.set("n", "<leader>c", toggle_focus, { desc = "Switch entre NvimTree et code" })
end,
}
I'm a newbie with neovim plugin sorry if I don't understand everything at the first time
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
Since the last update, I cannot use this nvim plugin properly.
I saw that nvim-tree.view has been moved but with that config I don't really see what should I do and how should I initialize my local view variable
I'm a newbie with neovim plugin sorry if I don't understand everything at the first time
Thank you for your help
Beta Was this translation helpful? Give feedback.
All reactions