Compare commits
8 Commits
v1.9
...
nvim-tree-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d529a99f88 | ||
|
|
39bc630816 | ||
|
|
aae01853dd | ||
|
|
68fc4c20f5 | ||
|
|
f7b76cd1a7 | ||
|
|
c3d9b1779f | ||
|
|
db8d7ac1f5 | ||
|
|
6b4be1dc0c |
@@ -1,3 +1,3 @@
|
||||
{
|
||||
".": "1.9.0"
|
||||
".": "1.10.0"
|
||||
}
|
||||
|
||||
17
CHANGELOG.md
17
CHANGELOG.md
@@ -1,5 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
## [1.10.0](https://github.com/nvim-tree/nvim-tree.lua/compare/nvim-tree-v1.9.0...nvim-tree-v1.10.0) (2025-01-13)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **api:** add node.open.vertical_no_picker, node.open.horizontal_no_picker ([#3031](https://github.com/nvim-tree/nvim-tree.lua/issues/3031)) ([68fc4c2](https://github.com/nvim-tree/nvim-tree.lua/commit/68fc4c20f5803444277022c681785c5edd11916d))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **#3015:** dynamic width no longer truncates on right_align icons ([#3022](https://github.com/nvim-tree/nvim-tree.lua/issues/3022)) ([f7b76cd](https://github.com/nvim-tree/nvim-tree.lua/commit/f7b76cd1a75615c8d6254fc58bedd2a7304eb7d8))
|
||||
* **#3018:** error when focusing nvim-tree when in terminal mode ([#3019](https://github.com/nvim-tree/nvim-tree.lua/issues/3019)) ([db8d7ac](https://github.com/nvim-tree/nvim-tree.lua/commit/db8d7ac1f524fc6f808764b29fa695c51e014aa6))
|
||||
* **#3041:** use vim.diagnostic.get for updating diagnostics ([#3042](https://github.com/nvim-tree/nvim-tree.lua/issues/3042)) ([aae0185](https://github.com/nvim-tree/nvim-tree.lua/commit/aae01853ddbd790d1efd6ff04ff96cf38c02c95f))
|
||||
* Can't re-enter normal mode from terminal mode ([db8d7ac](https://github.com/nvim-tree/nvim-tree.lua/commit/db8d7ac1f524fc6f808764b29fa695c51e014aa6))
|
||||
* hijack directory "BufEnter", "BufNewFile" events are nested ([#3044](https://github.com/nvim-tree/nvim-tree.lua/issues/3044)) ([39bc630](https://github.com/nvim-tree/nvim-tree.lua/commit/39bc63081605c1d4b974131ebecaea11e8a8595f))
|
||||
* view.width functions may return strings ([#3020](https://github.com/nvim-tree/nvim-tree.lua/issues/3020)) ([6b4be1d](https://github.com/nvim-tree/nvim-tree.lua/commit/6b4be1dc0cd4d5d5b8e8b56b510a75016e99746f))
|
||||
|
||||
## [1.9.0](https://github.com/nvim-tree/nvim-tree.lua/compare/nvim-tree-v1.8.0...nvim-tree-v1.9.0) (2024-12-07)
|
||||
|
||||
|
||||
|
||||
@@ -800,22 +800,22 @@ Width of the window: can be a `%` string, a number representing columns, a
|
||||
function or a table.
|
||||
A table indicates that the view should be dynamically sized based on the
|
||||
longest line.
|
||||
Type: `string | number | table | function()` returning a number
|
||||
Type: `string | number | table | fun(): number|string`
|
||||
Default: `30`
|
||||
|
||||
*nvim-tree.view.width.min*
|
||||
Minimum dynamic width.
|
||||
Type: `string | number | function()` returning a number
|
||||
Type: `string | number | fun(): number|string`
|
||||
Default: `30`
|
||||
|
||||
*nvim-tree.view.width.max*
|
||||
Maximum dynamic width, -1 for unbounded.
|
||||
Type: `string | number | function()` returning a number
|
||||
Type: `string | number | fun(): number|string`
|
||||
Default: `-1`
|
||||
|
||||
*nvim-tree.view.width.padding*
|
||||
Extra padding to the right.
|
||||
Type: `number | function()` returning a number
|
||||
Type: `number | fun(): number|string`
|
||||
Default: `1`
|
||||
|
||||
*nvim-tree.view.float*
|
||||
@@ -2025,9 +2025,19 @@ node.open.no_window_picker({node})
|
||||
node.open.vertical({node}) *nvim-tree-api.node.open.vertical()*
|
||||
|nvim-tree-api.node.edit()|, file will be opened in a new vertical split.
|
||||
|
||||
*nvim-tree-api.node.open.vertical_no_picker()*
|
||||
node.open.vertical_no_picker({node})
|
||||
|nvim-tree-api.node.vertical()|, window picker will never be used as per
|
||||
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
||||
|
||||
node.open.horizontal({node}) *nvim-tree-api.node.open.horizontal()*
|
||||
|nvim-tree-api.node.edit()|, file will be opened in a new horizontal split.
|
||||
|
||||
*nvim-tree-api.node.open.horizontal_no_picker()*
|
||||
node.open.horizontal_no_picker({node})
|
||||
|nvim-tree-api.node.horizontal()|, window picker will never be used as per
|
||||
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
||||
|
||||
*nvim-tree-api.node.open.toggle_group_empty()*
|
||||
node.open.toggle_group_empty({node})
|
||||
Toggle |nvim-tree.renderer.group_empty| for a specific folder.
|
||||
@@ -3189,6 +3199,7 @@ highlight group is not, hard linking as follows: >
|
||||
|nvim-tree-api.node.open.drop()|
|
||||
|nvim-tree-api.node.open.edit()|
|
||||
|nvim-tree-api.node.open.horizontal()|
|
||||
|nvim-tree-api.node.open.horizontal_no_picker()|
|
||||
|nvim-tree-api.node.open.no_window_picker()|
|
||||
|nvim-tree-api.node.open.preview()|
|
||||
|nvim-tree-api.node.open.preview_no_picker()|
|
||||
@@ -3197,6 +3208,7 @@ highlight group is not, hard linking as follows: >
|
||||
|nvim-tree-api.node.open.tab_drop()|
|
||||
|nvim-tree-api.node.open.toggle_group_empty()|
|
||||
|nvim-tree-api.node.open.vertical()|
|
||||
|nvim-tree-api.node.open.vertical_no_picker()|
|
||||
|nvim-tree-api.node.run.cmd()|
|
||||
|nvim-tree-api.node.run.system()|
|
||||
|nvim-tree-api.node.show_info_popup()|
|
||||
|
||||
@@ -190,7 +190,7 @@ local function setup_autocommands(opts)
|
||||
end
|
||||
|
||||
if opts.hijack_directories.enable then
|
||||
create_nvim_tree_autocmd({ "BufEnter", "BufNewFile" }, { callback = M.open_on_directory })
|
||||
create_nvim_tree_autocmd({ "BufEnter", "BufNewFile" }, { callback = M.open_on_directory, nested = true })
|
||||
end
|
||||
|
||||
if opts.view.centralize_selection then
|
||||
@@ -199,6 +199,10 @@ local function setup_autocommands(opts)
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_buf_call(0, function()
|
||||
local is_term_mode = vim.api.nvim_get_mode().mode == "t"
|
||||
if is_term_mode then
|
||||
return
|
||||
end
|
||||
vim.cmd([[norm! zz]])
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -235,9 +235,8 @@ end
|
||||
|
||||
local function get_target_winid(mode)
|
||||
local target_winid
|
||||
if not M.window_picker.enable or mode == "edit_no_picker" or mode == "preview_no_picker" then
|
||||
if not M.window_picker.enable or string.find(mode, "no_picker") then
|
||||
target_winid = lib.target_winid
|
||||
|
||||
-- first available window
|
||||
if not vim.tbl_contains(vim.api.nvim_tabpage_list_wins(0), target_winid) then
|
||||
target_winid = first_win_id()
|
||||
@@ -280,6 +279,11 @@ local function open_in_new_window(filename, mode)
|
||||
return
|
||||
end
|
||||
|
||||
local position = string.find(mode, "no_picker")
|
||||
if position then
|
||||
mode = string.sub(mode, 0, position - 2)
|
||||
end
|
||||
|
||||
-- non-floating, non-nvim-tree windows
|
||||
local win_ids = vim.tbl_filter(function(id)
|
||||
local config = vim.api.nvim_win_get_config(id)
|
||||
|
||||
@@ -25,7 +25,7 @@ end
|
||||
---@param new_tabpage integer
|
||||
---@return boolean
|
||||
local function is_window_event(new_tabpage)
|
||||
local is_event_scope_window = vim.v.event.scope == "window" or vim.v.event.changed_window
|
||||
local is_event_scope_window = vim.v.event.scope == "window" or vim.v.event.changed_window or false
|
||||
return is_event_scope_window and new_tabpage == M.current_tab
|
||||
end
|
||||
|
||||
|
||||
@@ -255,7 +255,9 @@ Api.node.open.tab_drop = wrap_node(open_or_expand_or_dir_up("tab_drop"))
|
||||
Api.node.open.replace_tree_buffer = wrap_node(open_or_expand_or_dir_up("edit_in_place"))
|
||||
Api.node.open.no_window_picker = wrap_node(open_or_expand_or_dir_up("edit_no_picker"))
|
||||
Api.node.open.vertical = wrap_node(open_or_expand_or_dir_up("vsplit"))
|
||||
Api.node.open.vertical_no_picker = wrap_node(open_or_expand_or_dir_up("vsplit_no_picker"))
|
||||
Api.node.open.horizontal = wrap_node(open_or_expand_or_dir_up("split"))
|
||||
Api.node.open.horizontal_no_picker = wrap_node(open_or_expand_or_dir_up("split_no_picker"))
|
||||
Api.node.open.tab = wrap_node(open_or_expand_or_dir_up("tabnew"))
|
||||
Api.node.open.toggle_group_empty = wrap_node(open_or_expand_or_dir_up("toggle_group_empty", true))
|
||||
Api.node.open.preview = wrap_node(open_or_expand_or_dir_up("preview"))
|
||||
|
||||
@@ -128,8 +128,7 @@ function M.update_lsp(ev)
|
||||
|
||||
local profile_event = log.profile_start("DiagnosticChanged event")
|
||||
|
||||
---@type vim.Diagnostic[]
|
||||
local diagnostics = ev.data.diagnostics
|
||||
local diagnostics = vim.diagnostic.get(ev.buf)
|
||||
|
||||
-- use the buffer from the event, as ev.data.diagnostics will be empty on resolved diagnostics
|
||||
local bufname = uniformize_path(vim.api.nvim_buf_get_name(ev.buf))
|
||||
|
||||
@@ -119,7 +119,7 @@ local function get_size(size)
|
||||
if type(size) == "number" then
|
||||
return size
|
||||
elseif type(size) == "function" then
|
||||
return size()
|
||||
return get_size(size())
|
||||
end
|
||||
local size_as_number = tonumber(size:sub(0, -2))
|
||||
local percent_as_decimal = size_as_number / 100
|
||||
@@ -321,8 +321,19 @@ local function grow()
|
||||
max_width = get_width(M.View.max_width) - padding
|
||||
end
|
||||
|
||||
for _, l in pairs(lines) do
|
||||
local ns_id = vim.api.nvim_get_namespaces()["NvimTreeExtmarks"]
|
||||
for line_nr, l in pairs(lines) do
|
||||
local count = vim.fn.strchars(l)
|
||||
-- also add space for right-aligned icons
|
||||
local extmarks = vim.api.nvim_buf_get_extmarks(M.get_bufnr(), ns_id, { line_nr, 0 }, { line_nr, -1 }, { details = true })
|
||||
for _, extmark in ipairs(extmarks) do
|
||||
local virt_texts = extmark[4].virt_text
|
||||
if virt_texts then
|
||||
for _, virt_text in ipairs(virt_texts) do
|
||||
count = count + vim.fn.strchars(virt_text[1])
|
||||
end
|
||||
end
|
||||
end
|
||||
if resizing_width < count then
|
||||
resizing_width = count
|
||||
end
|
||||
|
||||
@@ -4,6 +4,8 @@ local utils = require("nvim-tree.utils")
|
||||
|
||||
local Class = require("nvim-tree.classic")
|
||||
|
||||
local MESSAGE_EMFILE = "fs.inotify.max_user_watches exceeded, see https://github.com/nvim-tree/nvim-tree.lua/wiki/Troubleshooting"
|
||||
|
||||
local FS_EVENT_FLAGS = {
|
||||
-- inotify or equivalent will be used; fallback to stat has not yet been implemented
|
||||
stat = false,
|
||||
@@ -75,6 +77,18 @@ function Event:start()
|
||||
local event_cb = vim.schedule_wrap(function(err, filename)
|
||||
if err then
|
||||
log.line("watcher", "event_cb '%s' '%s' FAIL : %s", self.path, filename, err)
|
||||
|
||||
-- do nothing if watchers have already been disabled
|
||||
if not M.config.filesystem_watchers.enable then
|
||||
return
|
||||
end
|
||||
|
||||
-- EMFILE is catastrophic
|
||||
if name == "EMFILE" then
|
||||
M.disable_watchers(MESSAGE_EMFILE)
|
||||
return
|
||||
end
|
||||
|
||||
local message = string.format("File system watcher failed (%s) for path %s, halting watcher.", err, self.path)
|
||||
if err == "EPERM" and (utils.is_windows or utils.is_wsl) then
|
||||
-- on directory removal windows will cascade the filesystem events out of order
|
||||
@@ -94,7 +108,7 @@ function Event:start()
|
||||
rc, _, name = self.fs_event:start(self.path, FS_EVENT_FLAGS, event_cb)
|
||||
if rc ~= 0 then
|
||||
if name == "EMFILE" then
|
||||
M.disable_watchers("fs.inotify.max_user_watches exceeded, see https://github.com/nvim-tree/nvim-tree.lua/wiki/Troubleshooting")
|
||||
M.disable_watchers(MESSAGE_EMFILE)
|
||||
else
|
||||
notify.warn(string.format("Could not start the fs_event watcher for path %s : %s", self.path, name))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user