Compare commits
5 Commits
chore-poc-
...
nvim-tree-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6709463b2d | ||
|
|
b69914325a | ||
|
|
3281f331f7 | ||
|
|
80523101f0 | ||
|
|
70825f23db |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,4 @@
|
|||||||
/luals-out/
|
/luals-out/
|
||||||
/luals/
|
/luals/
|
||||||
/plenary.nvim/
|
|
||||||
# backup vim files
|
# backup vim files
|
||||||
*~
|
*~
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
"workspace": {
|
"workspace": {
|
||||||
"library": [
|
"library": [
|
||||||
"$VIMRUNTIME/lua/vim",
|
"$VIMRUNTIME/lua/vim",
|
||||||
"${3rd}/luv/library",
|
"${3rd}/luv/library"
|
||||||
"plenary.nvim"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"diagnostics": {
|
"diagnostics": {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
".": "1.10.0"
|
".": "1.11.0"
|
||||||
}
|
}
|
||||||
|
|||||||
17
CHANGELOG.md
17
CHANGELOG.md
@@ -1,5 +1,22 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.11.0](https://github.com/nvim-tree/nvim-tree.lua/compare/nvim-tree-v1.10.0...nvim-tree-v1.11.0) (2025-02-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **#1984:** add quit_on_open and focus opts to various api.node.open functions ([#3054](https://github.com/nvim-tree/nvim-tree.lua/issues/3054)) ([3281f33](https://github.com/nvim-tree/nvim-tree.lua/commit/3281f331f7f0bef13eb00fb2d5a9d28b2f6155a2))
|
||||||
|
* **#3037:** add API node.buffer.delete, node.buffer.wipe ([#3040](https://github.com/nvim-tree/nvim-tree.lua/issues/3040)) ([fee1da8](https://github.com/nvim-tree/nvim-tree.lua/commit/fee1da88972f5972a8296813f6c00d7598325ebd))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **#3045:** wipe scratch buffers for full name and show info popups ([#3050](https://github.com/nvim-tree/nvim-tree.lua/issues/3050)) ([fca0b67](https://github.com/nvim-tree/nvim-tree.lua/commit/fca0b67c0b5a31727fb33addc4d9c100736a2894))
|
||||||
|
* **#3059:** test for presence of new 0.11 API vim.hl.range ([#3060](https://github.com/nvim-tree/nvim-tree.lua/issues/3060)) ([70825f2](https://github.com/nvim-tree/nvim-tree.lua/commit/70825f23db61ecd900c4cfea169bffe931926a9d))
|
||||||
|
* arithmetic on nil value error on first git project open ([#3064](https://github.com/nvim-tree/nvim-tree.lua/issues/3064)) ([8052310](https://github.com/nvim-tree/nvim-tree.lua/commit/80523101f0ae48b7f1990e907b685a3d79776c01))
|
||||||
|
* stl and stlnc fillchars are hidden in window picker ([b699143](https://github.com/nvim-tree/nvim-tree.lua/commit/b69914325a945ee5157f0d21047210b42af5776e))
|
||||||
|
* window picker: hide fillchars: stl and stlnc ([#3066](https://github.com/nvim-tree/nvim-tree.lua/issues/3066)) ([b699143](https://github.com/nvim-tree/nvim-tree.lua/commit/b69914325a945ee5157f0d21047210b42af5776e))
|
||||||
|
|
||||||
## [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)
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
13
Makefile
13
Makefile
@@ -43,19 +43,6 @@ help-update:
|
|||||||
help-check: help-update
|
help-check: help-update
|
||||||
git diff --exit-code doc/nvim-tree-lua.txt
|
git diff --exit-code doc/nvim-tree-lua.txt
|
||||||
|
|
||||||
#
|
|
||||||
# test
|
|
||||||
#
|
|
||||||
test: plenary.nvim
|
|
||||||
scripts/test.sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Dependencies
|
|
||||||
#
|
|
||||||
# no plenary tags or releases available
|
|
||||||
plenary.nvim:
|
|
||||||
git clone git@github.com:nvim-lua/plenary.nvim.git
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: all lint style check luacheck style-check style-doc luals style-fix help-update help-check
|
.PHONY: all lint style check luacheck style-check style-doc luals style-fix help-update help-check
|
||||||
|
|
||||||
|
|||||||
@@ -2007,43 +2007,99 @@ fs.print_clipboard() *nvim-tree-api.fs.print_clipboard()*
|
|||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {node} (Node|nil) file or folder
|
• {node} (Node|nil) file or folder
|
||||||
|
|
||||||
node.open.edit({node}) *nvim-tree-api.node.open.edit()*
|
node.open.edit({node}, {opts}) *nvim-tree-api.node.open.edit()*
|
||||||
File: open as per |nvim-tree.actions.open_file|
|
File: open as per |nvim-tree.actions.open_file|
|
||||||
Folder: expand or collapse
|
Folder: expand or collapse
|
||||||
Root: change directory up
|
Root: change directory up
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
*nvim-tree-api.node.open.replace_tree_buffer()*
|
*nvim-tree-api.node.open.replace_tree_buffer()*
|
||||||
node.open.replace_tree_buffer({node})
|
node.open.replace_tree_buffer({node})
|
||||||
|nvim-tree-api.node.edit()|, file will be opened in place: in the
|
|nvim-tree-api.node.edit()|, file will be opened in place: in the
|
||||||
nvim-tree window.
|
nvim-tree window.
|
||||||
|
|
||||||
*nvim-tree-api.node.open.no_window_picker()*
|
*nvim-tree-api.node.open.no_window_picker()*
|
||||||
node.open.no_window_picker({node})
|
node.open.no_window_picker({node}, {opts})
|
||||||
|nvim-tree-api.node.edit()|, window picker will never be used as per
|
|nvim-tree-api.node.edit()|, window picker will never be used as per
|
||||||
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
||||||
|
|
||||||
node.open.vertical({node}) *nvim-tree-api.node.open.vertical()*
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
|
node.open.vertical({node}, {opts}) *nvim-tree-api.node.open.vertical()*
|
||||||
|nvim-tree-api.node.edit()|, file will be opened in a new vertical split.
|
|nvim-tree-api.node.edit()|, file will be opened in a new vertical split.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
*nvim-tree-api.node.open.vertical_no_picker()*
|
*nvim-tree-api.node.open.vertical_no_picker()*
|
||||||
node.open.vertical_no_picker({node})
|
node.open.vertical_no_picker({node}, {opts})
|
||||||
|nvim-tree-api.node.vertical()|, window picker will never be used as per
|
|nvim-tree-api.node.vertical()|, window picker will never be used as per
|
||||||
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
||||||
|
|
||||||
node.open.horizontal({node}) *nvim-tree-api.node.open.horizontal()*
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
|
node.open.horizontal({node}, {opts}) *nvim-tree-api.node.open.horizontal()*
|
||||||
|nvim-tree-api.node.edit()|, file will be opened in a new horizontal split.
|
|nvim-tree-api.node.edit()|, file will be opened in a new horizontal split.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
*nvim-tree-api.node.open.horizontal_no_picker()*
|
*nvim-tree-api.node.open.horizontal_no_picker()*
|
||||||
node.open.horizontal_no_picker({node})
|
node.open.horizontal_no_picker({node}, {opts})
|
||||||
|nvim-tree-api.node.horizontal()|, window picker will never be used as per
|
|nvim-tree-api.node.horizontal()|, window picker will never be used as per
|
||||||
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
*nvim-tree-api.node.open.toggle_group_empty()*
|
*nvim-tree-api.node.open.toggle_group_empty()*
|
||||||
node.open.toggle_group_empty({node})
|
node.open.toggle_group_empty({node}, {opts})
|
||||||
Toggle |nvim-tree.renderer.group_empty| for a specific folder.
|
Toggle |nvim-tree.renderer.group_empty| for a specific folder.
|
||||||
Does nothing on files.
|
Does nothing on files.
|
||||||
Needs |nvim-tree.renderer.group_empty| set.
|
Needs |nvim-tree.renderer.group_empty| set.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
node.open.drop({node}) *nvim-tree-api.node.open.drop()*
|
node.open.drop({node}) *nvim-tree-api.node.open.drop()*
|
||||||
Switch to window with selected file if it exists.
|
Switch to window with selected file if it exists.
|
||||||
Open file otherwise.
|
Open file otherwise.
|
||||||
@@ -2053,9 +2109,17 @@ node.open.drop({node}) *nvim-tree-api.node.open.drop()*
|
|||||||
Folder: expand or collapse
|
Folder: expand or collapse
|
||||||
Root: change directory up
|
Root: change directory up
|
||||||
|
|
||||||
node.open.tab({node}) *nvim-tree-api.node.open.tab()*
|
node.open.tab({node}, {opts}) *nvim-tree-api.node.open.tab()*
|
||||||
|nvim-tree-api.node.edit()|, file will be opened in a new tab.
|
|nvim-tree-api.node.edit()|, file will be opened in a new tab.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
*nvim-tree-api.node.open.tab_drop()*
|
*nvim-tree-api.node.open.tab_drop()*
|
||||||
node.open.tab_drop({node})
|
node.open.tab_drop({node})
|
||||||
Switch to tab containing window with selected file if it exists.
|
Switch to tab containing window with selected file if it exists.
|
||||||
@@ -2065,15 +2129,31 @@ node.open.tab_drop({node})
|
|||||||
Folder: expand or collapse
|
Folder: expand or collapse
|
||||||
Root: change directory up
|
Root: change directory up
|
||||||
|
|
||||||
node.open.preview({node}) *nvim-tree-api.node.open.preview()*
|
node.open.preview({node}, {opts}) *nvim-tree-api.node.open.preview()*
|
||||||
|nvim-tree-api.node.edit()|, file buffer will have |bufhidden| set to `delete`.
|
|nvim-tree-api.node.edit()|, file buffer will have |bufhidden| set to `delete`.
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
*nvim-tree-api.node.open.preview_no_picker()*
|
*nvim-tree-api.node.open.preview_no_picker()*
|
||||||
node.open.preview_no_picker({node})
|
node.open.preview_no_picker({node}, {opts})
|
||||||
|nvim-tree-api.node.edit()|, file buffer will have |bufhidden| set to `delete`.
|
|nvim-tree-api.node.edit()|, file buffer will have |bufhidden| set to `delete`.
|
||||||
window picker will never be used as per
|
window picker will never be used as per
|
||||||
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
|nvim-tree.actions.open_file.window_picker.enable| `false`
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
• {node} (Node|nil) file or folder
|
||||||
|
• {opts} (table) optional parameters
|
||||||
|
|
||||||
|
Options: ~
|
||||||
|
• {quit_on_open} (boolean) quits the tree when opening the file
|
||||||
|
• {focus} (boolean) keep focus in the tree when opening the file
|
||||||
|
|
||||||
node.navigate.git.next({node}) *nvim-tree-api.node.navigate.git.next()*
|
node.navigate.git.next({node}) *nvim-tree-api.node.navigate.git.next()*
|
||||||
Navigate to the next item showing git status.
|
Navigate to the next item showing git status.
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,14 @@ local function pick_win_id()
|
|||||||
local win_map = {}
|
local win_map = {}
|
||||||
local laststatus = vim.o.laststatus
|
local laststatus = vim.o.laststatus
|
||||||
vim.o.laststatus = 2
|
vim.o.laststatus = 2
|
||||||
|
local fillchars = vim.opt.fillchars:get()
|
||||||
|
local stl = fillchars.stl
|
||||||
|
local stlnc = fillchars.stlnc
|
||||||
|
fillchars.stl = nil
|
||||||
|
fillchars.stlnc = nil
|
||||||
|
vim.opt.fillchars = fillchars
|
||||||
|
fillchars.stl = stl
|
||||||
|
fillchars.stlnc = stlnc
|
||||||
|
|
||||||
local tabpage = vim.api.nvim_get_current_tabpage()
|
local tabpage = vim.api.nvim_get_current_tabpage()
|
||||||
local win_ids = vim.api.nvim_tabpage_list_wins(tabpage)
|
local win_ids = vim.api.nvim_tabpage_list_wins(tabpage)
|
||||||
@@ -179,6 +187,7 @@ local function pick_win_id()
|
|||||||
end
|
end
|
||||||
|
|
||||||
vim.o.laststatus = laststatus
|
vim.o.laststatus = laststatus
|
||||||
|
vim.opt.fillchars = fillchars
|
||||||
|
|
||||||
if not vim.tbl_contains(vim.split(M.window_picker.chars, ""), resp) then
|
if not vim.tbl_contains(vim.split(M.window_picker.chars, ""), resp) then
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -222,21 +222,46 @@ Api.fs.copy.absolute_path = wrap_node(wrap_explorer_member("clipboard", "copy_ab
|
|||||||
Api.fs.copy.filename = wrap_node(wrap_explorer_member("clipboard", "copy_filename"))
|
Api.fs.copy.filename = wrap_node(wrap_explorer_member("clipboard", "copy_filename"))
|
||||||
Api.fs.copy.basename = wrap_node(wrap_explorer_member("clipboard", "copy_basename"))
|
Api.fs.copy.basename = wrap_node(wrap_explorer_member("clipboard", "copy_basename"))
|
||||||
Api.fs.copy.relative_path = wrap_node(wrap_explorer_member("clipboard", "copy_path"))
|
Api.fs.copy.relative_path = wrap_node(wrap_explorer_member("clipboard", "copy_path"))
|
||||||
|
---
|
||||||
|
---@class NodeEditOpts
|
||||||
|
---@field quit_on_open boolean|nil default false
|
||||||
|
---@field focus boolean|nil default true
|
||||||
|
|
||||||
---@param mode string
|
---@param mode string
|
||||||
---@param node Node
|
---@param node Node
|
||||||
local function edit(mode, node)
|
---@param edit_opts NodeEditOpts?
|
||||||
|
local function edit(mode, node, edit_opts)
|
||||||
local file_link = node:as(FileLinkNode)
|
local file_link = node:as(FileLinkNode)
|
||||||
local path = file_link and file_link.link_to or node.absolute_path
|
local path = file_link and file_link.link_to or node.absolute_path
|
||||||
|
local cur_tabpage = vim.api.nvim_get_current_tabpage()
|
||||||
|
|
||||||
actions.node.open_file.fn(mode, path)
|
actions.node.open_file.fn(mode, path)
|
||||||
|
|
||||||
|
edit_opts = edit_opts or {}
|
||||||
|
|
||||||
|
local mode_unsupported_quit_on_open = mode == "drop" or mode == "tab_drop" or mode == "edit_in_place"
|
||||||
|
if not mode_unsupported_quit_on_open and edit_opts.quit_on_open then
|
||||||
|
view.close(cur_tabpage)
|
||||||
|
end
|
||||||
|
|
||||||
|
local mode_unsupported_focus = mode == "drop" or mode == "tab_drop" or mode == "edit_in_place"
|
||||||
|
local focus = edit_opts.focus == nil or edit_opts.focus == true
|
||||||
|
if not mode_unsupported_focus and not focus then
|
||||||
|
-- if mode == "tabnew" a new tab will be opened and we need to focus back to the previous tab
|
||||||
|
if mode == "tabnew" then
|
||||||
|
vim.cmd(":tabprev")
|
||||||
|
end
|
||||||
|
view.focus()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param mode string
|
---@param mode string
|
||||||
---@param toggle_group boolean?
|
---@param toggle_group boolean?
|
||||||
---@return fun(node: Node)
|
---@return fun(node: Node, edit_opts: NodeEditOpts?)
|
||||||
local function open_or_expand_or_dir_up(mode, toggle_group)
|
local function open_or_expand_or_dir_up(mode, toggle_group)
|
||||||
---@param node Node
|
---@param node Node
|
||||||
return function(node)
|
---@param edit_opts NodeEditOpts?
|
||||||
|
return function(node, edit_opts)
|
||||||
local root = node:as(RootNode)
|
local root = node:as(RootNode)
|
||||||
local dir = node:as(DirectoryNode)
|
local dir = node:as(DirectoryNode)
|
||||||
|
|
||||||
@@ -245,7 +270,7 @@ local function open_or_expand_or_dir_up(mode, toggle_group)
|
|||||||
elseif dir then
|
elseif dir then
|
||||||
dir:expand_or_collapse(toggle_group)
|
dir:expand_or_collapse(toggle_group)
|
||||||
elseif not toggle_group then
|
elseif not toggle_group then
|
||||||
edit(mode, node)
|
edit(mode, node, edit_opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ function HighlightDisplay:render(bufnr, fmt, l)
|
|||||||
|
|
||||||
vim.api.nvim_buf_set_lines(bufnr, l, -1, true, { text })
|
vim.api.nvim_buf_set_lines(bufnr, l, -1, true, { text })
|
||||||
|
|
||||||
if vim.fn.has("nvim-0.11") == 1 then
|
if vim.fn.has("nvim-0.11") == 1 and vim.hl and vim.hl.range then
|
||||||
vim.hl.range(bufnr, namespace_hi_test_id, self.group, { l, 0 }, { l, #self.group, }, {})
|
vim.hl.range(bufnr, namespace_hi_test_id, self.group, { l, 0 }, { l, #self.group, }, {})
|
||||||
else
|
else
|
||||||
vim.api.nvim_buf_add_highlight(bufnr, -1, self.group, l, 0, #self.group) ---@diagnostic disable-line: deprecated
|
vim.api.nvim_buf_add_highlight(bufnr, -1, self.group, l, 0, #self.group) ---@diagnostic disable-line: deprecated
|
||||||
|
|||||||
@@ -389,9 +389,9 @@ function Explorer:populate_children(handle, cwd, node, project, parent)
|
|||||||
nodes_by_path[child.absolute_path] = true
|
nodes_by_path[child.absolute_path] = true
|
||||||
child:update_git_status(node_ignored, project)
|
child:update_git_status(node_ignored, project)
|
||||||
end
|
end
|
||||||
else
|
elseif node.hidden_stats then
|
||||||
for reason, value in pairs(FILTER_REASON) do
|
for reason, value in pairs(FILTER_REASON) do
|
||||||
if filter_reason == value then
|
if filter_reason == value and type(node.hidden_stats[reason]) == "number" then
|
||||||
node.hidden_stats[reason] = node.hidden_stats[reason] + 1
|
node.hidden_stats[reason] = node.hidden_stats[reason] + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ local function open()
|
|||||||
|
|
||||||
-- highlight it
|
-- highlight it
|
||||||
for _, args in ipairs(hl_range_args) do
|
for _, args in ipairs(hl_range_args) do
|
||||||
if vim.fn.has("nvim-0.11") == 1 then
|
if vim.fn.has("nvim-0.11") == 1 and vim.hl and vim.hl.range then
|
||||||
vim.hl.range(M.bufnr, namespace_help_id, args.higroup, args.start, args.finish, {})
|
vim.hl.range(M.bufnr, namespace_help_id, args.higroup, args.start, args.finish, {})
|
||||||
else
|
else
|
||||||
vim.api.nvim_buf_add_highlight(M.bufnr, -1, args.higroup, args.start[1], args.start[2], args.finish[2]) ---@diagnostic disable-line: deprecated
|
vim.api.nvim_buf_add_highlight(M.bufnr, -1, args.higroup, args.start[1], args.start[2], args.finish[2]) ---@diagnostic disable-line: deprecated
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ local function show()
|
|||||||
local details = extmark[4]
|
local details = extmark[4]
|
||||||
|
|
||||||
if type(details) == "table" then
|
if type(details) == "table" then
|
||||||
if vim.fn.has("nvim-0.12") == 1 then
|
if vim.fn.has("nvim-0.11") == 1 and vim.hl and vim.hl.range then
|
||||||
vim.hl.range(0, ns_id, details.hl_group, { 0, col }, { 0, details.end_col, }, {})
|
vim.hl.range(0, ns_id, details.hl_group, { 0, col }, { 0, details.end_col, }, {})
|
||||||
else
|
else
|
||||||
vim.api.nvim_buf_add_highlight(0, ns_id, details.hl_group, 0, col, details.end_col) ---@diagnostic disable-line: deprecated
|
vim.api.nvim_buf_add_highlight(0, ns_id, details.hl_group, 0, col, details.end_col) ---@diagnostic disable-line: deprecated
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ function Renderer:render_hl(bufnr, hl_range_args)
|
|||||||
end
|
end
|
||||||
vim.api.nvim_buf_clear_namespace(bufnr, namespace_highlights_id, 0, -1)
|
vim.api.nvim_buf_clear_namespace(bufnr, namespace_highlights_id, 0, -1)
|
||||||
for _, args in ipairs(hl_range_args) do
|
for _, args in ipairs(hl_range_args) do
|
||||||
if vim.fn.has("nvim-0.11") == 1 then
|
if vim.fn.has("nvim-0.11") == 1 and vim.hl and vim.hl.range then
|
||||||
vim.hl.range(bufnr, namespace_highlights_id, args.higroup, args.start, args.finish, {})
|
vim.hl.range(bufnr, namespace_highlights_id, args.higroup, args.start, args.finish, {})
|
||||||
else
|
else
|
||||||
vim.api.nvim_buf_add_highlight(bufnr, namespace_highlights_id, args.higroup, args.start[1], args.start[2], args.finish[2]) ---@diagnostic disable-line: deprecated
|
vim.api.nvim_buf_add_highlight(bufnr, namespace_highlights_id, args.higroup, args.start[1], args.start[2], args.finish[2]) ---@diagnostic disable-line: deprecated
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ M.is_wsl = vim.fn.has("wsl") == 1
|
|||||||
-- false for WSL
|
-- false for WSL
|
||||||
M.is_windows = vim.fn.has("win32") == 1 or vim.fn.has("win32unix") == 1
|
M.is_windows = vim.fn.has("win32") == 1 or vim.fn.has("win32unix") == 1
|
||||||
|
|
||||||
function M._is_windows()
|
|
||||||
return vim.fn.has("win32") == 1 or vim.fn.has("win32unix") == 1
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param haystack string
|
---@param haystack string
|
||||||
---@param needle string
|
---@param needle string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
@@ -303,7 +299,7 @@ end
|
|||||||
---@param path string
|
---@param path string
|
||||||
---@return string
|
---@return string
|
||||||
function M.canonical_path(path)
|
function M.canonical_path(path)
|
||||||
if M._is_windows() and path:match("^%a:") then
|
if M.is_windows and path:match("^%a:") then
|
||||||
return path:sub(1, 1):upper() .. path:sub(2)
|
return path:sub(1, 1):upper() .. path:sub(2)
|
||||||
end
|
end
|
||||||
return path
|
return path
|
||||||
|
|||||||
@@ -270,9 +270,12 @@ function M.close_all_tabs()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.close()
|
---@param tabpage integer|nil
|
||||||
|
function M.close(tabpage)
|
||||||
if M.View.tab.sync.close then
|
if M.View.tab.sync.close then
|
||||||
M.close_all_tabs()
|
M.close_all_tabs()
|
||||||
|
elseif tabpage then
|
||||||
|
close(tabpage)
|
||||||
else
|
else
|
||||||
M.close_this_tab_only()
|
M.close_this_tab_only()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
DIR_REPO="$(git rev-parse --show-toplevel)"
|
|
||||||
export DIR_REPO
|
|
||||||
|
|
||||||
DIR_PLENARY="${DIR_REPO}/plenary.nvim"
|
|
||||||
export DIR_PLENARY
|
|
||||||
|
|
||||||
if [ "${#}" -eq 1 ]; then
|
|
||||||
TEST_NAME="${1}"
|
|
||||||
elif [ -z "${TEST_NAME}" ]; then
|
|
||||||
TEST_NAME="tests"
|
|
||||||
fi
|
|
||||||
export TEST_NAME
|
|
||||||
|
|
||||||
echo "testing: ${TEST_NAME}"
|
|
||||||
|
|
||||||
nvim --headless \
|
|
||||||
--clean \
|
|
||||||
-u "${DIR_REPO}/tests/minimal_init.lua" \
|
|
||||||
-l "${DIR_REPO}/tests/test_init.lua" \
|
|
||||||
-c "qa!"
|
|
||||||
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
-- Prepend these as plenary appends a "." and plenary directory
|
|
||||||
-- The spawned processes don't specify --clean so contain the full ~/.local runtime path
|
|
||||||
vim.o.runtimepath = string.format(
|
|
||||||
"%s,%s,%s",
|
|
||||||
vim.env.DIR_REPO,
|
|
||||||
vim.env.DIR_PLENARY,
|
|
||||||
vim.o.runtimepath
|
|
||||||
)
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
local test_harness = require("plenary.test_harness")
|
|
||||||
|
|
||||||
test_harness.test_directory(
|
|
||||||
vim.env.TEST_NAME,
|
|
||||||
{
|
|
||||||
minimal_init = vim.env.DIR_REPO .. "/tests/minimal_init.lua",
|
|
||||||
sequential = true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
---@type Luassert
|
|
||||||
local assert = require("luassert")
|
|
||||||
local stub = require("luassert.stub")
|
|
||||||
|
|
||||||
local utils = require("nvim-tree.utils")
|
|
||||||
|
|
||||||
describe("utils.path_add_trailing", function()
|
|
||||||
it("trailing added", function()
|
|
||||||
assert.equals("foo/", utils.path_add_trailing("foo"))
|
|
||||||
end)
|
|
||||||
|
|
||||||
it("trailing already present", function()
|
|
||||||
assert.equals("foo/", utils.path_add_trailing("foo/"))
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
describe("utils.canonical_path", function()
|
|
||||||
before_each(function()
|
|
||||||
stub(vim.fn, "has")
|
|
||||||
end)
|
|
||||||
|
|
||||||
it("is windows", function()
|
|
||||||
vim.fn.has.on_call_with("win32unix").returns(1)
|
|
||||||
assert.equals("C:\\foo\\bar", utils.canonical_path("c:\\foo\\bar"), "should be uppercase drive")
|
|
||||||
end)
|
|
||||||
|
|
||||||
it("not windows", function()
|
|
||||||
assert.equals("c:\\foo\\bar", utils.canonical_path("c:\\foo\\bar"))
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
Reference in New Issue
Block a user