Skip to content

Commit 8563720

Browse files
committed
refactor(#2787): minimum nvim version 0.8 -> 0.9
1 parent e026466 commit 8563720

File tree

6 files changed

+9
-45
lines changed

6 files changed

+9
-45
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Questions and general support: [Discussions](https://github.com/nvim-tree/nvim-t
2828

2929
## Requirements
3030

31-
[neovim >=0.8.0](https://github.com/neovim/neovim/wiki/Installing-Neovim)
31+
[neovim >=0.9.0](https://github.com/neovim/neovim/wiki/Installing-Neovim)
3232

3333
[nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons) is optional and used to display file icons. It requires a [patched font](https://www.nerdfonts.com/). Your terminal emulator must be configured to use that font, usually "Hack Nerd Font"
3434

doc/nvim-tree-lua.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Git Integration
103103

104104
Requirements
105105

106-
This file explorer requires `neovim >= 0.8.0`
106+
This file explorer requires `neovim >= 0.9.0`
107107

108108
==============================================================================
109109
2. QUICKSTART *nvim-tree-quickstart*
@@ -832,7 +832,6 @@ Use nvim-tree in a floating window.
832832

833833
Highlight precedence, additive:
834834
git < opened < modified < bookmarked < diagnostics < copied < cut
835-
Neovim <= 0.8 will only show the highest.
836835

837836
*nvim-tree.renderer.add_trailing*
838837
Appends a trailing slash to folder names.

lua/nvim-tree.lua

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ local core = require "nvim-tree.core"
1111
local git = require "nvim-tree.git"
1212
local filters = require "nvim-tree.explorer.filters"
1313
local buffers = require "nvim-tree.buffers"
14-
local events = require "nvim-tree.events"
1514
local notify = require "nvim-tree.notify"
1615

1716
local _config = {}
@@ -338,21 +337,6 @@ local function setup_autocommands(opts)
338337
end,
339338
})
340339
end
341-
342-
-- TODO #1545 remove similar check from view.resize
343-
if vim.fn.has "nvim-0.9" == 1 then
344-
create_nvim_tree_autocmd("WinResized", {
345-
callback = function()
346-
if vim.v.event and vim.v.event.windows then
347-
for _, winid in ipairs(vim.v.event.windows) do
348-
if vim.api.nvim_win_is_valid(winid) and utils.is_nvim_tree_buf(vim.api.nvim_win_get_buf(winid)) then
349-
events._dispatch_on_tree_resize(vim.api.nvim_win_get_width(winid))
350-
end
351-
end
352-
end
353-
end,
354-
})
355-
end
356340
end
357341

358342
local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS

lua/nvim-tree/appearance/init.lua

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,8 @@ function M.setup()
183183

184184
-- hard link override when legacy only is present
185185
for from, to in pairs(M.LEGACY_LINKS) do
186-
local hl_from
187-
local hl_to
188-
if vim.fn.has "nvim-0.9" == 1 then
189-
hl_from = vim.api.nvim_get_hl(0, { name = from })
190-
hl_to = vim.api.nvim_get_hl(0, { name = to })
191-
else
192-
hl_from = vim.api.nvim__get_hl_defs(0)[from] or {}
193-
hl_to = vim.api.nvim__get_hl_defs(0)[to] or {}
194-
end
186+
local hl_from = vim.api.nvim_get_hl(0, { name = from })
187+
local hl_to = vim.api.nvim_get_hl(0, { name = to })
195188
if vim.tbl_isempty(hl_from) and not vim.tbl_isempty(hl_to) then
196189
vim.api.nvim_command("hi link " .. from .. " " .. to)
197190
end

lua/nvim-tree/renderer/builder.lua

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -295,24 +295,16 @@ function Builder:add_highlights(node)
295295
table.insert(name_groups, name)
296296
end
297297

298-
-- one or many icon groups; <= 0.8 always uses highest due to lack of a practical nvim_get_hl equivalent
298+
-- one or many icon groups
299299
if #icon_groups > 1 then
300-
if vim.fn.has "nvim-0.9" == 1 then
301-
icon_hl_group = self:create_combined_group(icon_groups)
302-
else
303-
icon_hl_group = icon_groups[#icon_groups]
304-
end
300+
icon_hl_group = self:create_combined_group(icon_groups)
305301
else
306302
icon_hl_group = icon_groups[1]
307303
end
308304

309-
-- one or many name groups; <= 0.8 always uses highest due to lack of a practical nvim_get_hl equivalent
305+
-- one or many name groups
310306
if #name_groups > 1 then
311-
if vim.fn.has "nvim-0.9" == 1 then
312-
name_hl_group = self:create_combined_group(name_groups)
313-
else
314-
name_hl_group = name_groups[#name_groups]
315-
end
307+
name_hl_group = self:create_combined_group(name_groups)
316308
else
317309
name_hl_group = name_groups[1]
318310
end

lua/nvim-tree/view.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,7 @@ function M.resize(size)
348348
local new_size = get_width()
349349
vim.api.nvim_win_set_width(M.get_winnr() or 0, new_size)
350350

351-
-- TODO #1545 remove similar check from setup_autocommands
352-
-- We let nvim handle sending resize events after 0.9
353-
if vim.fn.has "nvim-0.9" == 0 then
354-
events._dispatch_on_tree_resize(new_size)
355-
end
351+
events._dispatch_on_tree_resize(new_size)
356352

357353
if not M.View.preserve_window_proportions then
358354
vim.cmd ":wincmd ="

0 commit comments

Comments
 (0)