summaryrefslogtreecommitdiff
path: root/nvim/lua/plugins/tree.lua
diff options
context:
space:
mode:
author2025-05-16 22:33:54 +0300
committer2025-05-16 22:33:54 +0300
commit49e5fa571005da10d156d14f82e145afaf96214e (patch)
treecefaf0227d17fd900858ec3ddb8b88665f443e08 /nvim/lua/plugins/tree.lua
parentПравки nvim конфига (diff)
downloaddotfiles-49e5fa571005da10d156d14f82e145afaf96214e.tar.gz
dotfiles-49e5fa571005da10d156d14f82e145afaf96214e.tar.bz2
dotfiles-49e5fa571005da10d156d14f82e145afaf96214e.tar.xz
dotfiles-49e5fa571005da10d156d14f82e145afaf96214e.zip
Обновления конфигов
Diffstat (limited to '')
-rw-r--r--nvim/lua/plugins/tree.lua41
1 files changed, 37 insertions, 4 deletions
diff --git a/nvim/lua/plugins/tree.lua b/nvim/lua/plugins/tree.lua
index 4807024..94d1f11 100644
--- a/nvim/lua/plugins/tree.lua
+++ b/nvim/lua/plugins/tree.lua
@@ -1,18 +1,49 @@
+local HEIGHT_RATIO = 0.8
+local WIDTH_RATIO = 0.5
+
return {
"nvim-tree/nvim-tree.lua",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
opts = {
+ disable_netrw = true,
+ hijack_netrw = true,
hijack_directories = {
- enable = true, -- Перехватывать открытие директорий
- auto_open = true, -- Автоматически открывать при старте
+ enable = true,
+ auto_open = true,
},
sort = {
sorter = "case_sensitive",
},
view = {
- width = 30,
+ -- width = 30,
+ 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,
+ adaptive_size = true,
+ centralize_selection = true,
},
git = {
enable = true,
@@ -29,9 +60,11 @@ return {
filters = {
dotfiles = false,
},
+ sync_root_with_cwd = true,
+ respect_buf_cwd = true,
update_focused_file = {
enable = true,
- update_root = false,
+ update_root = true,
},
},
keys = {