Skip to content

Commit fbd421d

Browse files
committed
chore: remove non-functional sides bottom/top
1 parent ac8d259 commit fbd421d

File tree

4 files changed

+7
-46
lines changed

4 files changed

+7
-46
lines changed

doc/nvim-tree-lua.txt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ Subsequent calls to setup will replace the previous configuration.
185185
adaptive_size = false,
186186
centralize_selection = false,
187187
width = 30,
188-
height = 30,
189188
hide_root_folder = false,
190189
side = "left",
191190
preserve_window_proportions = false,
@@ -632,7 +631,6 @@ Window / buffer setup.
632631

633632
*nvim-tree.view.adaptive_size*
634633
Resize the window on each draw based on the longest line.
635-
Only works when |nvim-tree.view.side| is `left` or `right`.
636634
Type: `boolean`, Default: `false`
637635

638636
*nvim-tree.view.centralize_selection*
@@ -647,18 +645,10 @@ Window / buffer setup.
647645
*nvim-tree.view.width*
648646
Width of the window, can be a `%` string, a number representing columns or
649647
a function.
650-
Only works with `side` is `left` or `right`.
651-
Type: `string | number | function`, Default: `30`
652-
653-
*nvim-tree.view.height*
654-
Height of the window, can be `%` string or a number representing rows or a
655-
function.
656-
Only works with `side` is `top` or `bottom`
657648
Type: `string | number | function`, Default: `30`
658649

659650
*nvim-tree.view.side*
660-
Side of the tree, can be `"left"`, `"right"`, `"bottom"`, `"top"`.
661-
Note that bottom/top are not working correctly yet.
651+
Side of the tree, can be `"left"`, `"right"`.
662652
Type: `string`, Default: `"left"`
663653

664654
*nvim-tree.view.preserve_window_proportions*

lua/nvim-tree.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,6 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
445445
adaptive_size = false,
446446
centralize_selection = false,
447447
width = 30,
448-
height = 30,
449448
hide_root_folder = false,
450449
side = "left",
451450
preserve_window_proportions = false,
@@ -638,7 +637,6 @@ local FIELD_SKIP_VALIDATE = {
638637

639638
local FIELD_OVERRIDE_TYPECHECK = {
640639
width = { string = true, ["function"] = true, number = true },
641-
height = { string = true, ["function"] = true, number = true },
642640
remove_keymaps = { boolean = true, table = true },
643641
on_attach = { ["function"] = true, string = true },
644642
sort_by = { ["function"] = true, string = true },

lua/nvim-tree/actions/node/open-file.lua

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ local view = require "nvim-tree.view"
77

88
local M = {}
99

10-
local function get_split_side()
11-
local side = view.View.side
12-
if side == "right" then
13-
return "aboveleft"
14-
end
15-
if side == "left" then
16-
return "belowright"
17-
end
18-
if side == "top" then
19-
return "bot"
20-
end
21-
return "top"
22-
end
23-
2410
local function get_user_input_char()
2511
local c = vim.fn.getchar()
2612
while type(c) ~= "number" do
@@ -193,12 +179,11 @@ local function open_in_new_window(filename, mode, win_ids)
193179
return
194180
end
195181
local do_split = mode == "split" or mode == "vsplit"
196-
local split_side = get_split_side()
182+
local split_side = (view.View.side == "right") and "aboveleft" or "belowright"
197183

198184
-- Target is invalid or window does not exist in current tabpage: create new window
199185
if not target_winid or not vim.tbl_contains(win_ids, target_winid) then
200-
local split_cmd = view.is_vertical() and "vsplit" or "split"
201-
vim.cmd(split_side .. " " .. split_cmd)
186+
vim.cmd(split_side .. " vsplit")
202187
target_winid = api.nvim_get_current_win()
203188
lib.target_winid = target_winid
204189

lua/nvim-tree/view.lua

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ local function create_buffer(bufnr)
101101
end
102102

103103
local function get_size()
104-
local width_or_height = M.is_vertical() and "width" or "height"
105-
local size = M.View[width_or_height]
104+
local size = M.View.width
106105
if type(size) == "number" then
107106
return size
108107
elseif type(size) == "function" then
@@ -116,8 +115,6 @@ end
116115
local move_tbl = {
117116
left = "H",
118117
right = "L",
119-
bottom = "J",
120-
top = "K",
121118
}
122119

123120
-- setup_tabpage sets up the initial state of a tab
@@ -239,8 +236,7 @@ local function grow()
239236
end
240237

241238
function M.grow_from_content()
242-
local is_left_or_right = M.View.side == "left" or M.View.side == "right"
243-
if M.View.adaptive_size and is_left_or_right then
239+
if M.View.adaptive_size then
244240
grow()
245241
end
246242
end
@@ -276,11 +272,7 @@ function M.resize(size)
276272
end
277273

278274
local new_size = get_size()
279-
if M.is_vertical() then
280-
a.nvim_win_set_width(M.get_winnr(), new_size)
281-
else
282-
a.nvim_win_set_height(M.get_winnr(), new_size)
283-
end
275+
a.nvim_win_set_width(M.get_winnr(), new_size)
284276

285277
events._dispatch_on_tree_resize(new_size)
286278

@@ -353,10 +345,6 @@ function M.focus(winnr, open_if_closed)
353345
a.nvim_set_current_win(wnr)
354346
end
355347

356-
function M.is_vertical()
357-
return M.View.side == "left" or M.View.side == "right"
358-
end
359-
360348
--- Restores the state of a NvimTree window if it was initialized before.
361349
function M.restore_tab_state()
362350
local tabpage = a.nvim_get_current_tabpage()
@@ -442,7 +430,7 @@ function M.setup(opts)
442430
local options = opts.view or {}
443431
M.View.adaptive_size = options.adaptive_size
444432
M.View.centralize_selection = options.centralize_selection
445-
M.View.side = options.side
433+
M.View.side = (options.side == "right") and "right" or "left"
446434
M.View.width = options.width
447435
M.View.height = options.height
448436
M.View.initial_width = get_size()

0 commit comments

Comments
 (0)