neovim-project
neovim-project copied to clipboard
nvim-tree doesnt work with neovim-project
I was recently setting up a new vim install and I was running into issues with nvim-tree and neovim-project. When I added neovim-project to my plugin list nvim-tree just simply stops working. Here is my neovim-project config:
{
"coffebar/neovim-project",
opts = {
projects = { -- define project roots
"~/.config/*",
"~/.macos/",
},
},
init = function()
-- enable saving the state of plugins in the session
vim.opt.sessionoptions:append "globals" -- save global variables that start with an uppercase letter and contain at least one lowercase letter.
end,
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope.nvim", tag = "0.1.4" },
{ "Shatur/neovim-session-manager" },
},
lazy = false,
priority = 100,
},
Here is my nvim-tree config:
local HEIGHT_RATIO = 0.8 -- You can change this
local WIDTH_RATIO = 0.5 -- You can change this too
local function my_on_attach(bufnr)
local api = require "nvim-tree.api"
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- default mappings
api.config.mappings.default_on_attach(bufnr)
-- custom mappings
vim.keymap.set("n", "s", "<Plug>(leap-forward)", opts "Leap")
vim.keymap.set("n", "S", "<Plug>(leap-backward)", opts "Leap back")
end
M.nvimtree = {
filters = {
dotfiles = false,
exclude = { vim.fn.stdpath "config" .. "/lua/custom" },
},
on_attach = my_on_attach,
disable_netrw = true,
respect_buf_cwd = true,
hijack_netrw = true,
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = false,
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
update_root = false,
},
view = {
-- adaptive_size = false,
-- side = "left",
-- width = 30,
-- preserve_window_proportions = true,
relativenumber = true,
float = {
enable = true,
open_win_config = function()
local screen_w = vim.opt.columns:get()
local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get()
local window_w = screen_w * WIDTH_RATIO
local window_h = screen_h * HEIGHT_RATIO
local window_w_int = math.floor(window_w)
local window_h_int = math.floor(window_h)
local center_x = (screen_w - window_w) / 2
local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get()
return {
border = "rounded",
relative = "editor",
row = center_y,
col = center_x,
width = window_w_int,
height = window_h_int,
}
end,
},
width = function()
return math.floor(vim.opt.columns:get() * WIDTH_RATIO)
end,
},
git = {
enable = false,
ignore = true,
},
filesystem_watchers = {
enable = true,
},
actions = {
open_file = {
resize_window = true,
},
},
renderer = {
root_folder_label = false,
highlight_git = false,
highlight_opened_files = "none",
indent_markers = {
enable = false,
},
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = false,
},
glyphs = {
default = "",
symlink = "",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
git = {
unstaged = "✗",
staged = "✓",
unmerged = "",
renamed = "➜",
untracked = "★",
deleted = "",
ignored = "◌",
},
},
},
},
}
Update here i found this which seems to fix it https://github.com/coffebar/neovim-project/issues/7#issuecomment-1962073864
Ok, u can close if problem solved