chore: float nvim-tree
parent
36f47ab0d6
commit
ebe1ffdd00
|
@ -121,6 +121,33 @@ require("packer").startup(function()
|
|||
"nvim-tree/nvim-tree.lua",
|
||||
config = function()
|
||||
require("nvim-tree").setup({
|
||||
view = {
|
||||
float = {
|
||||
enable = true,
|
||||
-- https://www.reddit.com/r/neovim/comments/wvcz64/nvimtreelua_how_to_center_floating_window
|
||||
-- https://github.com/MarioCarrion/videos/blob/main/2023/01/nvim/lua/plugins/nvim-tree.lua
|
||||
open_win_config = function()
|
||||
local HEIGHT_RATIO = 0.8
|
||||
local WIDTH_RATIO = 0.5
|
||||
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,
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
icons = {
|
||||
|
|
Loading…
Reference in New Issue