feat(view): indicate modified buffers (#1835)

* Outlined new options

* highlight_modified is highlight_opened_files

* prototype with autocmd

* moved modified into glyphs

* show_on_dirs and show_on_open_dirs

* icon placement before & after

* _get_filename_offset

* fixed :wq doesn't update modified indicator

* highlight_modified, signcolumn modified_placement

Refactored to make everything use HighlightedString to remove all the complex `insert_highlight` calculation.
Not tested.

* updated doc to match the reality of no multi char for glyphs.modified

* fixed git signcolumn doesn't show

* fixed highlight_modified gets replaced by highlight_opened_files

* fixed renderer.icons.show.modified = false crash

* updated doc to reflect empty icon not breaking rendering

* removed debounce_delay to implement in a later PR

* doc nit: order placement

* change modified dirs default to be consistent with git

* illegal git & modified placement changed to default

* don't assume icon exist

* nit remove comment

* Noted in doc that glyphs can't have more than 2 characters if in signcolumn

* Don't sign_define if placement isn't signcolumn

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Richard Li
2022-12-31 17:54:04 +13:00
committed by GitHub
parent 9ad93b6ac0
commit dcc344cc72
10 changed files with 381 additions and 146 deletions

View File

@@ -68,6 +68,12 @@ local function get_padding_arrows(node, indent)
end
end
---@param depth integer
---@param idx integer
---@param nodes_number integer
---@param node table
---@param markers table
---@return HighlightedString
function M.get_padding(depth, idx, nodes_number, node, markers)
local padding = ""
@@ -86,7 +92,7 @@ function M.get_padding(depth, idx, nodes_number, node, markers)
padding = padding .. get_padding_arrows(node, not show_markers)
end
return padding
return { str = padding, hl = "NvimTreeIndentMarker" }
end
function M.setup(opts)