-
Notifications
You must be signed in to change notification settings - Fork 271
feat: Auto Width or Full Name Under Cursor (related to #547) #580
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
Conversation
Thanks!
You can just call
Don't worry about that. That's just an example for devs to see how sources work. You can just move that to another unused binding. I was originally picturing a floating window popup that shows the full name of a truncated item on hover. Have you thought about that? It is a standard way of handling this situation in other apps. If we do stick with auto expand, I would keep track of the width prior to the auto expand instead of just using the default value from the settings. I know I will usually adjust the width manually after opening to fit different projects and screen sizes. |
Codecov Report
@@ Coverage Diff @@
## main #580 +/- ##
==========================================
- Coverage 51.59% 50.49% -1.11%
==========================================
Files 47 47
Lines 5915 6092 +177
==========================================
+ Hits 3052 3076 +24
- Misses 2863 3016 +153
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I tried to do this but as far as I had not mistaken something, it goes into an infinite recursive function call and results to an error.
1f32cda : Changed to
I once thought about this but currently it is difficult. hoge/
fuga/
foo/
bar.txt |
You would just have to keep track of it in the Another option is that you can take advantage of neo-tree.nvim/lua/neo-tree/ui/renderer.lua Lines 331 to 334 in 35e9f9b
But you can use it earlier to just change the window size before this point when auto width is on.
It's definitely easier the way you are doing it.
I mean gui apps like VSCode.
Fair enough. In that case I would make sure the option is renamed and the value is a string rather than a boolean so it can be a three state option to expand the width of the window, show a float, or do nothing.
I feel like there must be a way to logically distinguish between a user change and your changes, but maybe it's not worth the effort to do so. Don't worry about it. |
|
Sorry for the late update but I revised the code quite a lot and I think I was able to fix most of the bugs and issues. One warning is that you should call |
No problem, that was a nice solution to the problem. There is one more place to replace neo-tree.nvim/lua/neo-tree/ui/renderer.lua Lines 503 to 514 in 683d027
I tested it out and I think it works well. The only other left to do is to add some documentation about the new feature to the help file and add the mapping in the README's Quickstart section. |
|
I know that line but I think there's no need to call Possible change in width only happens when opening a new window with Therefore, I couldn't think of any situation of needing to change width with that But in any cases, I think it's not difficult to change to
Thank you for testing 👍
May I hand it to you to write the docs and README because I was not sure enough where in the document I should write about this. config = {
window = {
auto_expand_width = false, -- expand the window when file exceeds the window width. does not work with position = "float"
}
} |
Sure. Thanks for contributing! |
|
Nice job.. This is an awesome feature. Thanks :) |
|
@dudicoco it looks like it is working fine to me, assuming "ten" is the end of the filename. You may just want to turn off character fading if you don't like that look. You can disable character fading by adding this to your config: default_component_configs = {
container = {
enable_character_fade = false
}, |
@cseickel the file name ends with |
|
@cseickel i've found out the cause for this - I have a config to add relative line numbers to the neo-tree buffer: Commenting out this block fixes the issue. |
It sounds like a bug where the needed with is not accounting for the width of the line numbers. Open a bug report, or better yet, find the bug and submit a PR. |

Hi, I love the extensibility of this plugin.
I think this feature (#547) is quite useful, especially when you want to peek a filename or dealing with very deep file structures.
I tried to implement this feature with the following configs and I would like to hear your opinions.
What I did
1. Added option
window.auto_expand_widthDefault:
falseUsually, long file names and deep hierarchy folders (by the indents) are truncated and goes underneath modified symbols etc. However, by setting this to
true, the filename is not truncated and instead, the window width is expanded (ignoringwindow.widthoption) to show the whole content.window.auto_expand_width = trueWhat it differs from
width = "fit_content"is that the window width expands even after launching neotree, meaning that when a new folder with a very longfile name is expanded, neotree window adjusts its width to fit the new filename.2. Added command
toggle_auto_expand_width(with keybind)Although I added the above feature, I actually like the fading effect on normal circumstances.
So I created a keybind that toggles
window.auto_expand_width.In my usecase (and IMO recommended to everybody) is to keep
window.auto_expand_widthoption tofalseand toggle the feature whenever needed.Currently it is binded to
e. In the gif bellow, I am pressingeseveral times after opening neotree.Know Issues
There are some issues with the current implementation. However, I don't think this is a big problem because, first of all, not so many people are going to use (or even notice) this feature, and second, it hardly effects the usability.
very-long-file-name.txtis not updatedrenderer.redraw(state), i.e. doing any of the followingseconflicts withexample.window.example_command?window.position = "float"I hope this helps,
pysan3