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:
@@ -1,7 +1,7 @@
|
||||
local M = { i = {} }
|
||||
|
||||
local function config_symlinks()
|
||||
M.i.symlink = #M.config.glyphs.symlink > 0 and M.config.glyphs.symlink .. M.config.padding or ""
|
||||
M.i.symlink = #M.config.glyphs.symlink > 0 and M.config.glyphs.symlink or ""
|
||||
M.i.symlink_arrow = M.config.symlink_arrow
|
||||
end
|
||||
|
||||
@@ -28,14 +28,14 @@ local function get_folder_icon(open, is_symlink, has_children)
|
||||
n = M.config.glyphs.folder.empty
|
||||
end
|
||||
end
|
||||
return n .. M.config.padding
|
||||
return n
|
||||
end
|
||||
|
||||
local function get_file_icon_default()
|
||||
local hl_group = "NvimTreeFileIcon"
|
||||
local icon = M.config.glyphs.default
|
||||
if #icon > 0 then
|
||||
return icon .. M.config.padding, hl_group
|
||||
return icon, hl_group
|
||||
else
|
||||
return ""
|
||||
end
|
||||
@@ -47,7 +47,7 @@ local function get_file_icon_webdev(fname, extension)
|
||||
hl_group = "NvimTreeFileIcon"
|
||||
end
|
||||
if icon and hl_group ~= "DevIconDefault" then
|
||||
return icon .. M.config.padding, hl_group
|
||||
return icon, hl_group
|
||||
elseif string.match(extension, "%.(.*)") then
|
||||
-- If there are more extensions to the file, try to grab the icon for them recursively
|
||||
return get_file_icon_webdev(fname, string.match(extension, "%.(.*)"))
|
||||
|
||||
Reference in New Issue
Block a user