fix small bug with indent markers, add notice to README for netrw and gx
This commit is contained in:
parent
545ecbccba
commit
3ca7fd0aed
@ -107,6 +107,8 @@ highlight LuaTreeFolderIcon guibg=blue
|
|||||||
|
|
||||||
This plugin is very fast because it uses the `libuv` `scandir` and `scandir_next` functions instead of spawning an `ls` process which can get slow on large files when combining with `stat` to get file informations.
|
This plugin is very fast because it uses the `libuv` `scandir` and `scandir_next` functions instead of spawning an `ls` process which can get slow on large files when combining with `stat` to get file informations.
|
||||||
|
|
||||||
|
The Netrw vim plugin is disabled, hence features like `gx` don't work accross your windows/buffers. You could use a plugin like [this one](https://github.com/stsewd/gx-extended.vim) if you wish to use that feature.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Open file in current buffer or in split with FzF like bindings (`<CR>`, `<C-v>`, `<C-x>`, `<C-t>`)
|
- Open file in current buffer or in split with FzF like bindings (`<CR>`, `<C-v>`, `<C-x>`, `<C-t>`)
|
||||||
- File icons with nvim-web-devicons
|
- File icons with nvim-web-devicons
|
||||||
|
|||||||
@ -92,14 +92,16 @@ local get_padding = function(depth)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if vim.g.lua_tree_indent_markers == 1 then
|
if vim.g.lua_tree_indent_markers == 1 then
|
||||||
get_padding = function(depth, idx, tree, node)
|
get_padding = function(depth, idx, tree, node, last_node)
|
||||||
local padding = ""
|
local padding = ""
|
||||||
if depth ~= 0 then
|
if depth ~= 0 then
|
||||||
for i=1,depth/2 do
|
for i=1,depth/2 do
|
||||||
if idx == #tree.entries and i == depth/2 then
|
if idx == #tree.entries and i == depth/2 then
|
||||||
padding = padding..'└ '
|
padding = padding..'└ '
|
||||||
else
|
elseif not last_node or i < (depth/2) - 1 then
|
||||||
padding = padding..'│ '
|
padding = padding..'│ '
|
||||||
|
else
|
||||||
|
padding = padding..' '
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -121,7 +123,7 @@ local special = {
|
|||||||
["readme.md"] = true,
|
["readme.md"] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
local function update_draw_data(tree, depth)
|
local function update_draw_data(tree, depth, last_node)
|
||||||
if tree.cwd and tree.cwd ~= '/' then
|
if tree.cwd and tree.cwd ~= '/' then
|
||||||
table.insert(lines, "..")
|
table.insert(lines, "..")
|
||||||
table.insert(hl, {'LuaTreeFolderName', index, 0, 2})
|
table.insert(hl, {'LuaTreeFolderName', index, 0, 2})
|
||||||
@ -129,7 +131,7 @@ local function update_draw_data(tree, depth)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for idx, node in ipairs(tree.entries) do
|
for idx, node in ipairs(tree.entries) do
|
||||||
local padding = get_padding(depth, idx, tree, node)
|
local padding = get_padding(depth, idx, tree, node, last_node)
|
||||||
local offset = string.len(padding)
|
local offset = string.len(padding)
|
||||||
if depth > 0 then
|
if depth > 0 then
|
||||||
table.insert(hl, { 'LuaTreeIndentMarker', index, 0, offset })
|
table.insert(hl, { 'LuaTreeIndentMarker', index, 0, offset })
|
||||||
@ -141,7 +143,7 @@ local function update_draw_data(tree, depth)
|
|||||||
index = index + 1
|
index = index + 1
|
||||||
if node.open then
|
if node.open then
|
||||||
table.insert(lines, padding..icon..node.name.." "..git_icon)
|
table.insert(lines, padding..icon..node.name.." "..git_icon)
|
||||||
update_draw_data(node, depth + 2)
|
update_draw_data(node, depth + 2, idx == #tree.entries)
|
||||||
else
|
else
|
||||||
table.insert(lines, padding..icon..node.name.." "..git_icon)
|
table.insert(lines, padding..icon..node.name.." "..git_icon)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user