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
feat: Indicate modified buffers #1835
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far.
OK
defaults
modified = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
debounce_delay = 50,
},
update_focused_file = {
enable = true,
debounce_delay = 15,
Manual refresh
:NvimTreeToggle
:NvimTreeClose :NvimTreeOpen
Change directory to a different sibling then back
NOT OK
does not show on opened directory
modified = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = false,
debounce_delay = 50,
},
does not show on any directory
modified = {
enable = true,
show_on_dirs = true,
show_on_open_dirs = true,
debounce_delay = 50,
},
f3573d2
to
b3ed7c9
Compare
Refactored to make everything use HighlightedString to remove all the complex `insert_highlight` calculation. Not tested.
Test cases:
|
dfcbab7
to
845069d
Compare
We could add to base16 when we are done echasnovski/mini.nvim#181 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, apologies for the delay.
Tested some with the following general cases:
- git
- diagnostics
- symlinks
- indent markers
Testing all permutations and combinations is not feasible however sampled the following:
-
modified.enabled
-
modified.show_on_dirs
-
modified.show_on_open_dirs
-
highlight_modified = "none"
-
highlight_modified = "icon"
-
highlight_modified = "name"
-
highlight_modified = "all"
-
highlight_modified = "bleh"
-
glyphs.modified = ""
-
glyphs.modified = "X"
-
icons.modified_placement = "after"
-
icons.modified_placement = "before"
-
icons.modified_placement = "signcolumn"
-
icons.show.modified
"Failing" but good enough as they are consistent
-
glyphs.modified = "XY"
shows both, missing, same as git and file icons, good enough -
icons.modified_placement = "bleh"
missing, same as git, good enough
TODO
- fix extra folder padding feat: Indicate modified buffers #1835 (comment)
doc/nvim-tree-lua.txt
Outdated
modified = { | ||
enable = false, | ||
show_on_dirs = true, | ||
show_on_open_dirs = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we perhaps change this to be consistent with git?
show_on_dirs = true,
show_on_open_dirs = true,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually wanted to change git & diagnostics to the same as modified because I think that'd be the default that most people want, but didn't cause i thought that'd be breaking.
Idk what is this plugin's stance on changes in default though, if you think it's alright I can make that change in this PR.
In the mean time I'll change modified to be consistent with git for now :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'd like to change those defaults, they make more sense. That's what I use.
Users do get upset when we make changes like that so we have avoided doing so.
I am open to trying it again: how about we make a separate PR for those sensible defaults that we can revert if there is upset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have this idea in my head for a while now. Wanted to open an issue but didn't find time to do investigation deep enough to justify it.
I would like to discuss future of the project and breaking changes moving forward. I wanted to argue in favour of releasing pre-release version with multiple breaking changes: removed/unified functionality, reorganised configuration options, general clean up. I think project could greatly benefit from refactor without worrying about breaking changes. It would then be released as version 2 for example. Would there be any appetite for that at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reorganised configuration options, general clean up
Yes. git.ignore
not being in filters. renderer
too large. diagnostics.icons
not in icons.glyphs
. Some root options not in view
or their own section.
I would like to discuss future of the project and breaking changes moving forward.
We can break things in a controlled manner that will result in a better experience. We are also good at refactoring options, although we don't use it much.
I wanted to argue in favour of releasing pre-release version with multiple breaking changes
It would then be released as version 2 for example.
Many lua plugins and packer are getting very good at handling versions. I think it is time.
master
could remain as "version 1" to avoid interruptions to users, however we could add devel
, weekly
etc. along with stable
, stable-2
, stable-2.1
, stable-2.1.3
etc. I like SEMVER.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did discover an interesting pattern with lualine:
User is prompted to run :LualineNotices
when there is a configuration problem.
theme(base16): nvim-base16 is not currently present in your runtimepath, make sure it is properly installed, fallback to default colors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's great to hear. Let's open a dedicated issue to discuss it further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not git_icons_and_hl_groups then | ||
---@class HighlightedString | ||
---@field str string | ||
---@field hl string|nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm interesting, it doesn't give me any warnings. But maybe putting in suppression in .luarc.json
is a good idea for this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem was on my end... I was putting the current directory in the workspace twice.
I've actually managed to remove all the suppressions: e322fbb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last one:
All defaults but modified = "[+]",
Error executing vim.schedule lua callback: ...vt-dev/site/pack/packer/start/packer.nvim/lua/packer.lua:359: Vim(lua):E5108: Error executing lua Vim:E239: Invalid sign text: [+]
stack traceback:
[C]: in function 'sign_define'
...start/dev/lua/nvim-tree/renderer/components/modified.lua:19: in function 'setup_signs'
...start/dev/lua/nvim-tree/renderer/components/modified.lua:36: in function 'setup'
...te/pack/packer/start/dev/lua/nvim-tree/renderer/init.lua:113: in function 'setup'
/tmp/nvt-dev/site/pack/packer/start/dev/lua/nvim-tree.lua:828: in function 'setup'
/home/alex/.local/share/nvim/nvt-dev.lua:34: in function 'setup'
[string ":lua"]:1: in main chunk
[C]: in function 'cmd'
...vt-dev/site/pack/packer/start/packer.nvim/lua/packer.lua:359: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
stack traceback:
[C]: in function 'cmd'
...vt-dev/site/pack/packer/start/packer.nvim/lua/packer.lua:359: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Happens for git and diagnostics too.
Proposal:
- Only call
vim.fn.sign_define
if the user has specified"signcolumn"
- Trim the glyph to 2 characters
@alex-courtis Sadly, because lua dose not do utf8 string properly. We can't determine the length of a string or trim a string without some dependency such as https://github.com/uga-rosa/utf8.nvim. I've also tried to pass the string via |
In that case, we will have to go with the first option:
It is failing if you specify many characters even when I really want to be able to use |
OH YEAH sure, I forgot that option existed after trying so hard to do the second one haha. |
The note is not enough... Try running with all defaults and |
whoops sorry, forgot to push. |
awesome
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will enjoy this.
closes #1577.
New options and their docs are already completed, I'm opened to feedback on those.
TODOs: