How sync with on .git folder (root project) and change it on switch between files? #2036
-
I'm trying to set up nvim-tree to change the root folder with the project root folder (with .git). Which sync_root_with_cwd = true,
reload_on_bufenter = true,
prefer_startup_root = false,
view = {
mappings = {
custom_only = true,
list = {
{ key = "d", action = "remove" },
{ key = "h", action = "parent_node" },
{ key = "H", action = "close_node" },
{ key = "R", action = "rename" },
{ key = "m", action = "bulk_move" },
{ key = "p", action = "paste" },
{ key = "P", action = "preview" },
{ key = "cf", action = "create" },
{ key = "gr", action = "refresh" },
{ key = "oh", action = "split" },
{ key = "ov", action = "vsplit" },
{ key = "ox", action = "system_open" },
{ key = "yf", action = "copy" },
{ key = "ya", action = "copy_absolute_path" },
{ key = "yp", action = "copy_name" },
{ key = "yr", action = "copy_path" },
{ key = { "oo", "l" }, action = "edit" },
{ key = "?", action = "toggle_help" },
},
},
},
actions = {
change_dir = {
enable = true,
},
},
renderer = {
highlight_git = true,
root_folder_label = ":t",
icons = {
show = {
git = false,
},
},
},
update_focused_file = {
enable = true,
debounce_delay = 15,
update_root = true,
},
diagnostics = {
enable = true,
show_on_open_dirs = true,
},
git = {
ignore = false,
timeout = 200,
},
trash = {
cmd = "trash",
}, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
@alex-courtis I even tried your config, but I didn't get this event I want. Btw, thank you for all you've been doing for this project |
Beta Was this translation helpful? Give feedback.
-
To make the working directory be synchronized with the parent folder with P.S.: I had this problem that my working directory was changing all the time I opened a new file. After a log time trying to figure out what was going on, my local null_ls = require("null-ls")
null_ls.setup({
debug = true,
sources = {
...
-- null_ls.builtins.formatting.prettier,
...
},
}) This case can also happen, I guess, if the |
Beta Was this translation helpful? Give feedback.
To make the working directory be synchronized with the parent folder with
.git
folder, you can use ahmedkhalf/project.nvim.P.S.: I had this problem that my working directory was changing all the time I opened a new file. After a log time trying to figure out what was going on, my
null-ls.nvim
bellow had the active formatter withprettier
and it was changing automatically the working directory for some reason:This case can also happen, I guess, if the
autochdir
is active via command lineset autochdir
or via command file setting withvim.o…