mirror of
https://github.com/nvim-tree/nvim-tree.lua
synced 2024-09-16 14:34:03 +02:00
This reverts commit 1d629a5d3f
.
This commit is contained in:
parent
1d629a5d3f
commit
b2640685a8
6 changed files with 18 additions and 46 deletions
|
@ -944,12 +944,6 @@ Configuration options for icons.
|
|||
Icon order and sign column precedence:
|
||||
git < modified < bookmarked < diagnostics
|
||||
|
||||
`renderer.icons.*_placement` options may be:
|
||||
- `"before"` : before file/folder, after the file/folders icons
|
||||
- `"after"` : after file/folder
|
||||
- `"signcolumn"` : far left, requires |nvim-tree.view.signcolumn| enabled
|
||||
- `"right_align"` : far right
|
||||
|
||||
*nvim-tree.renderer.icons.web_devicons*
|
||||
Configure optional plugin `"nvim-tree/nvim-web-devicons"`
|
||||
|
||||
|
@ -978,19 +972,27 @@ Icon order and sign column precedence:
|
|||
Type: `boolean`, Default: `true`
|
||||
|
||||
*nvim-tree.renderer.icons.git_placement*
|
||||
Git icons placement.
|
||||
Place where the git icons will be rendered.
|
||||
Can be `"after"` or `"before"` filename (after the file/folders icons)
|
||||
or `"signcolumn"` (requires |nvim-tree.view.signcolumn| enabled).
|
||||
Type: `string`, Default: `"before"`
|
||||
|
||||
*nvim-tree.renderer.icons.diagnostics_placement*
|
||||
Diganostic icon placement.
|
||||
Place where the diagnostics icon will be rendered.
|
||||
Can be `"after"` or `"before"` filename (after the file/folders icons)
|
||||
or `"signcolumn"` (requires |nvim-tree.view.signcolumn| enabled).
|
||||
Type: `string`, Default: `"signcolumn"`
|
||||
|
||||
*nvim-tree.renderer.icons.modified_placement*
|
||||
Modified icon placement.
|
||||
Place where the modified icon will be rendered.
|
||||
Can be `"after"` or `"before"` filename (after the file/folders icons)
|
||||
or `"signcolumn"` (requires |nvim-tree.view.signcolumn| enabled).
|
||||
Type: `string`, Default: `"after"`
|
||||
|
||||
*nvim-tree.renderer.icons.bookmarks_placement*
|
||||
Bookmark icon placement.
|
||||
Place where the bookmarks icon will be rendered.
|
||||
Can be `"after"` or `"before"` filename (after the file/folders icons)
|
||||
or `"signcolumn"` (requires |nvim-tree.view.signcolumn| enabled).
|
||||
Type: `string`, Default: `signcolumn`
|
||||
|
||||
*nvim-tree.renderer.icons.padding*
|
||||
|
|
|
@ -672,10 +672,10 @@ local ACCEPTED_STRINGS = {
|
|||
highlight_diagnostics = { "none", "icon", "name", "all" },
|
||||
highlight_clipboard = { "none", "icon", "name", "all" },
|
||||
icons = {
|
||||
git_placement = { "before", "after", "signcolumn", "right_align" },
|
||||
modified_placement = { "before", "after", "signcolumn", "right_align" },
|
||||
diagnostics_placement = { "before", "after", "signcolumn", "right_align" },
|
||||
bookmarks_placement = { "before", "after", "signcolumn", "right_align" },
|
||||
git_placement = { "before", "after", "signcolumn" },
|
||||
modified_placement = { "before", "after", "signcolumn" },
|
||||
diagnostics_placement = { "before", "after", "signcolumn" },
|
||||
bookmarks_placement = { "before", "after", "signcolumn" },
|
||||
},
|
||||
},
|
||||
help = {
|
||||
|
|
|
@ -16,7 +16,6 @@ M.ICON_PLACEMENT = {
|
|||
signcolumn = 1,
|
||||
before = 2,
|
||||
after = 3,
|
||||
right_align = 4,
|
||||
}
|
||||
|
||||
return M
|
||||
|
|
|
@ -60,7 +60,6 @@ function Builder:new()
|
|||
lines = {},
|
||||
markers = {},
|
||||
signs = {},
|
||||
extmarks = {},
|
||||
}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
|
@ -229,14 +228,6 @@ function Builder:format_line(indent_markers, arrows, icon, name, node)
|
|||
add_to_end(line, M.decorators[i]:icons_after(node))
|
||||
end
|
||||
|
||||
local rights = {}
|
||||
for i = #M.decorators, 1, -1 do
|
||||
add_to_end(rights, M.decorators[i]:icons_right_align(node))
|
||||
end
|
||||
if #rights > 0 then
|
||||
self.extmarks[self.index] = rights
|
||||
end
|
||||
|
||||
return line
|
||||
end
|
||||
|
||||
|
|
|
@ -74,17 +74,6 @@ function Decorator:icons_after(node)
|
|||
return self:calculate_icons(node)
|
||||
end
|
||||
|
||||
---Icons when ICON_PLACEMENT.right_align
|
||||
---@param node Node
|
||||
---@return HighlightedString[]|nil icons
|
||||
function Decorator:icons_right_align(node)
|
||||
if not self.enabled or self.icon_placement ~= ICON_PLACEMENT.right_align then
|
||||
return
|
||||
end
|
||||
|
||||
return self:calculate_icons(node)
|
||||
end
|
||||
|
||||
---Maybe icons, optionally implemented
|
||||
---@protected
|
||||
---@param _ Node
|
||||
|
|
|
@ -18,7 +18,7 @@ local namespace_id = vim.api.nvim_create_namespace "NvimTreeHighlights"
|
|||
---@param lines string[]
|
||||
---@param hl_args AddHighlightArgs[]
|
||||
---@param signs string[]
|
||||
local function _draw(bufnr, lines, hl_args, signs, extmarks)
|
||||
local function _draw(bufnr, lines, hl_args, signs)
|
||||
if vim.fn.has "nvim-0.10" == 1 then
|
||||
vim.api.nvim_set_option_value("modifiable", true, { buf = bufnr })
|
||||
else
|
||||
|
@ -38,15 +38,6 @@ local function _draw(bufnr, lines, hl_args, signs, extmarks)
|
|||
for i, sign_name in pairs(signs) do
|
||||
vim.fn.sign_place(0, SIGN_GROUP, sign_name, bufnr, { lnum = i + 1 })
|
||||
end
|
||||
for i, extname in pairs(extmarks) do
|
||||
for _, mark in ipairs(extname) do
|
||||
vim.api.nvim_buf_set_extmark(bufnr, namespace_id, i, -1, {
|
||||
virt_text = { { mark.str, mark.hl } },
|
||||
virt_text_pos = "right_align",
|
||||
hl_mode = "combine",
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.render_hl(bufnr, hl)
|
||||
|
@ -76,7 +67,7 @@ function M.draw()
|
|||
|
||||
local builder = Builder:new():build()
|
||||
|
||||
_draw(bufnr, builder.lines, builder.hl_args, builder.signs, builder.extmarks)
|
||||
_draw(bufnr, builder.lines, builder.hl_args, builder.signs)
|
||||
|
||||
if cursor and #builder.lines >= cursor[1] then
|
||||
vim.api.nvim_win_set_cursor(view.get_winnr() or 0, cursor)
|
||||
|
|
Loading…
Reference in a new issue