-
-
Notifications
You must be signed in to change notification settings - Fork 623
feat: Indicate modified buffers #1835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b65ecd6
Outlined new options
chomosuke b14b135
Merge branch 'master' into feat-modified-buffers
chomosuke ece4c37
highlight_modified is highlight_opened_files
chomosuke a34c907
prototype with autocmd
chomosuke 84e4ff5
Merge branch 'master' into feat-modified-buffers
chomosuke e501f16
moved modified into glyphs
chomosuke 00d3739
show_on_dirs and show_on_open_dirs
chomosuke 2ad6125
icon placement before & after
chomosuke b3ed7c9
_get_filename_offset
chomosuke b4ef5e0
fixed :wq doesn't update modified indicator
chomosuke e95d3a5
highlight_modified, signcolumn modified_placement
chomosuke 9b04ff5
updated doc to match the reality of no multi char for glyphs.modified
chomosuke 8bf609c
fixed git signcolumn doesn't show
chomosuke c7b20ca
fixed highlight_modified gets replaced by highlight_opened_files
chomosuke 621d634
fixed renderer.icons.show.modified = false crash
chomosuke 2bbccb1
updated doc to reflect empty icon not breaking rendering
chomosuke 845069d
removed debounce_delay to implement in a later PR
chomosuke efb3805
doc nit: order placement
alex-courtis ad6cb10
change modified dirs default to be consistent with git
chomosuke 061a154
illegal git & modified placement changed to default
chomosuke 38846ab
don't assume icon exist
chomosuke 9e15b32
nit remove comment
alex-courtis e5c104d
Merge branch 'master' into feat-modified-buffers
chomosuke 4554681
Noted in doc that glyphs can't have more than 2 characters if in sign…
chomosuke 413dc30
Don't sign_define if placement isn't signcolumn
chomosuke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
local M = {} | ||
|
||
---@type table<string, boolean> record of which file is modified | ||
M._record = {} | ||
|
||
---refresh M.record | ||
function M.reload() | ||
M._record = {} | ||
local bufs = vim.fn.getbufinfo { bufmodified = true, buflisted = true } | ||
for _, buf in pairs(bufs) do | ||
local path = buf.name | ||
M._record[path] = true | ||
while path ~= vim.fn.getcwd() and path ~= "/" do | ||
path = vim.fn.fnamemodify(path, ":h") | ||
M._record[path] = true | ||
end | ||
end | ||
end | ||
|
||
---@param node table | ||
---@return boolean | ||
function M.is_modified(node) | ||
return M.config.enable | ||
and M._record[node.absolute_path] | ||
and (not node.nodes or M.config.show_on_dirs) | ||
and (not node.open or M.config.show_on_open_dirs) | ||
end | ||
|
||
---@param opts table | ||
function M.setup(opts) | ||
M.config = opts.modified | ||
end | ||
|
||
return M |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.