chore: remove non-functional sides bottom/top
This commit is contained in:
parent
ac8d259bad
commit
fbd421da71
@ -185,7 +185,6 @@ Subsequent calls to setup will replace the previous configuration.
|
||||
adaptive_size = false,
|
||||
centralize_selection = false,
|
||||
width = 30,
|
||||
height = 30,
|
||||
hide_root_folder = false,
|
||||
side = "left",
|
||||
preserve_window_proportions = false,
|
||||
@ -632,7 +631,6 @@ Window / buffer setup.
|
||||
|
||||
*nvim-tree.view.adaptive_size*
|
||||
Resize the window on each draw based on the longest line.
|
||||
Only works when |nvim-tree.view.side| is `left` or `right`.
|
||||
Type: `boolean`, Default: `false`
|
||||
|
||||
*nvim-tree.view.centralize_selection*
|
||||
@ -647,18 +645,10 @@ Window / buffer setup.
|
||||
*nvim-tree.view.width*
|
||||
Width of the window, can be a `%` string, a number representing columns or
|
||||
a function.
|
||||
Only works with `side` is `left` or `right`.
|
||||
Type: `string | number | function`, Default: `30`
|
||||
|
||||
*nvim-tree.view.height*
|
||||
Height of the window, can be `%` string or a number representing rows or a
|
||||
function.
|
||||
Only works with `side` is `top` or `bottom`
|
||||
Type: `string | number | function`, Default: `30`
|
||||
|
||||
*nvim-tree.view.side*
|
||||
Side of the tree, can be `"left"`, `"right"`, `"bottom"`, `"top"`.
|
||||
Note that bottom/top are not working correctly yet.
|
||||
Side of the tree, can be `"left"`, `"right"`.
|
||||
Type: `string`, Default: `"left"`
|
||||
|
||||
*nvim-tree.view.preserve_window_proportions*
|
||||
|
||||
@ -445,7 +445,6 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
|
||||
adaptive_size = false,
|
||||
centralize_selection = false,
|
||||
width = 30,
|
||||
height = 30,
|
||||
hide_root_folder = false,
|
||||
side = "left",
|
||||
preserve_window_proportions = false,
|
||||
@ -638,7 +637,6 @@ local FIELD_SKIP_VALIDATE = {
|
||||
|
||||
local FIELD_OVERRIDE_TYPECHECK = {
|
||||
width = { string = true, ["function"] = true, number = true },
|
||||
height = { string = true, ["function"] = true, number = true },
|
||||
remove_keymaps = { boolean = true, table = true },
|
||||
on_attach = { ["function"] = true, string = true },
|
||||
sort_by = { ["function"] = true, string = true },
|
||||
|
||||
@ -7,20 +7,6 @@ local view = require "nvim-tree.view"
|
||||
|
||||
local M = {}
|
||||
|
||||
local function get_split_side()
|
||||
local side = view.View.side
|
||||
if side == "right" then
|
||||
return "aboveleft"
|
||||
end
|
||||
if side == "left" then
|
||||
return "belowright"
|
||||
end
|
||||
if side == "top" then
|
||||
return "bot"
|
||||
end
|
||||
return "top"
|
||||
end
|
||||
|
||||
local function get_user_input_char()
|
||||
local c = vim.fn.getchar()
|
||||
while type(c) ~= "number" do
|
||||
@ -193,12 +179,11 @@ local function open_in_new_window(filename, mode, win_ids)
|
||||
return
|
||||
end
|
||||
local do_split = mode == "split" or mode == "vsplit"
|
||||
local split_side = get_split_side()
|
||||
local split_side = (view.View.side == "right") and "aboveleft" or "belowright"
|
||||
|
||||
-- Target is invalid or window does not exist in current tabpage: create new window
|
||||
if not target_winid or not vim.tbl_contains(win_ids, target_winid) then
|
||||
local split_cmd = view.is_vertical() and "vsplit" or "split"
|
||||
vim.cmd(split_side .. " " .. split_cmd)
|
||||
vim.cmd(split_side .. " vsplit")
|
||||
target_winid = api.nvim_get_current_win()
|
||||
lib.target_winid = target_winid
|
||||
|
||||
|
||||
@ -101,8 +101,7 @@ local function create_buffer(bufnr)
|
||||
end
|
||||
|
||||
local function get_size()
|
||||
local width_or_height = M.is_vertical() and "width" or "height"
|
||||
local size = M.View[width_or_height]
|
||||
local size = M.View.width
|
||||
if type(size) == "number" then
|
||||
return size
|
||||
elseif type(size) == "function" then
|
||||
@ -116,8 +115,6 @@ end
|
||||
local move_tbl = {
|
||||
left = "H",
|
||||
right = "L",
|
||||
bottom = "J",
|
||||
top = "K",
|
||||
}
|
||||
|
||||
-- setup_tabpage sets up the initial state of a tab
|
||||
@ -239,8 +236,7 @@ local function grow()
|
||||
end
|
||||
|
||||
function M.grow_from_content()
|
||||
local is_left_or_right = M.View.side == "left" or M.View.side == "right"
|
||||
if M.View.adaptive_size and is_left_or_right then
|
||||
if M.View.adaptive_size then
|
||||
grow()
|
||||
end
|
||||
end
|
||||
@ -276,11 +272,7 @@ function M.resize(size)
|
||||
end
|
||||
|
||||
local new_size = get_size()
|
||||
if M.is_vertical() then
|
||||
a.nvim_win_set_width(M.get_winnr(), new_size)
|
||||
else
|
||||
a.nvim_win_set_height(M.get_winnr(), new_size)
|
||||
end
|
||||
a.nvim_win_set_width(M.get_winnr(), new_size)
|
||||
|
||||
events._dispatch_on_tree_resize(new_size)
|
||||
|
||||
@ -353,10 +345,6 @@ function M.focus(winnr, open_if_closed)
|
||||
a.nvim_set_current_win(wnr)
|
||||
end
|
||||
|
||||
function M.is_vertical()
|
||||
return M.View.side == "left" or M.View.side == "right"
|
||||
end
|
||||
|
||||
--- Restores the state of a NvimTree window if it was initialized before.
|
||||
function M.restore_tab_state()
|
||||
local tabpage = a.nvim_get_current_tabpage()
|
||||
@ -442,7 +430,7 @@ function M.setup(opts)
|
||||
local options = opts.view or {}
|
||||
M.View.adaptive_size = options.adaptive_size
|
||||
M.View.centralize_selection = options.centralize_selection
|
||||
M.View.side = options.side
|
||||
M.View.side = (options.side == "right") and "right" or "left"
|
||||
M.View.width = options.width
|
||||
M.View.height = options.height
|
||||
M.View.initial_width = get_size()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user