enc: update default config

This commit is contained in:
pojok code 2025-06-21 13:33:57 +07:00
parent 5df3f7b2ab
commit dc19ff45d8
5 changed files with 144 additions and 60 deletions

View file

@ -127,6 +127,44 @@ return {
return opts
end,
config = function(_, opts)
if pcode.nvimtree_float then
-- set nvimtree float view (default left side)
opts.view = {
adaptive_size = false,
centralize_selection = true,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
float = {
enable = true,
open_win_config = function()
local screen_w = vim.opt.columns:get()
---@diagnostic disable-next-line: undefined-field
local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get()
local window_w = screen_w * 0.5
local window_h = screen_h * 0.9
local window_w_int = math.floor(window_w)
local window_h_int = math.floor(window_h)
local center_x = (screen_w - window_w) / 2
---@diagnostic disable-next-line: undefined-field
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() * 0.5)
end,
}
end
require("nvim-tree").setup(opts)
local api = require("nvim-tree.api")
api.events.subscribe(api.events.Event.FileCreated, function(file)