-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add flex resize, focus mode, hard-coded limits for now #2704
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
|
Nice one! Focus mode sounds great! Is it possible to have a 'zen' focus mode where the current window is centred with empty space either side, like https://github.com/folke/zen-mode.nvim ? Ideally the width would be 80 or maybe 100 characters. This is perfect for coding and writing while looking straight on at the monitor. |
|
The zen mode sounds very cool and is definitely worth having it's own issue in my opinion. The Maybe |
|
@Termina94
|
|
I've been trying this branch today. A few notes:
EDIT: |
| pub fn buffer_expand_mode(&mut self) { | ||
| self.tree.buffer_expand_mode(); | ||
| } |
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 think the name and description for this command should say toggle. I'm also a little hesitant to call it a "mode" since that would skew the terminology for editor modes.
Maybe something like toggle_focus_window?
| if let Some(index) = self.children.iter().position(|child| child == &node) { | ||
| return self.node_bounds.get_mut(index); | ||
| }; | ||
| None |
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 let Some(index) = self.children.iter().position(|child| child == &node) { | |
| return self.node_bounds.get_mut(index); | |
| }; | |
| None | |
| self.children | |
| .iter() | |
| .position(|child| child == &node) | |
| .and_then(|index| self.node_bounds.get_mut(index)) |
| self.node_bounds | ||
| .iter() | ||
| .map(|bounds| match bounds.expand { | ||
| true => 40, |
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.
40 is hard-coded in a few places. Can we make it a pub const that gets shared between the modules that use it? It could make sense to have this be configurable in the future for those that like resizing to be more fine-grained (or not).
| "A-w" => { "Alter Window" | ||
| "A-h"|"A-left" => shrink_buffer_width, | ||
| "A-l"|"A-right" => grow_buffer_width, | ||
| "A-j"|"A-down" => shrink_buffer_height, | ||
| "A-k"|"A-up" => grow_buffer_height, | ||
| "A-f" => buffer_expand_mode, | ||
| }, |
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.
Like the <C-w> bindings I think there should be <A-w><A-h> and also <A-w>h. That way you don't need to keep holding alt after you've hit <A-w>.
|
I would love to see this merged, this is the only thing blocking me from using helix <3 |
|
@Termina94 this has been idle for quite a while. Are you still planning to come back to it? If not, I think it's an important capability for any split-based text editor and would be willing to pick it up. @pascalkuthe @the-mikedavis just tagging for visibility to get your input on what all would need to be included to get this across the finish line. |
|
@Termina94 @the-mikedavis @dgkf Great work on this - I've switched over to Helix as a long time Vim user and am really enjoying it. |
|
See #8546, let's close this in favor of that new PR |
ref: helix-editor/helix#1176 ref: helix-editor/helix#2704 ref: helix-editor/helix#8546 Co-authored-by: Sander Cyber <[email protected]>
I have been playing around with different solutions to this issue and the nicest way I have found is using a flex-like approach where the parents container is split between the children bounds.
i.e | 1 | 1 | or | 2 | 1 | etc.
However this will not allow for reducing the size of a container that defaults to the value 1 and therefore all resizing will have to be managed by growing other children to make the one you want smaller which is not very intuitive.
For this draft example I have decided to hard code a
slotlimit per child of 20 and the each child starts with a default of 10. This feels much nicer but limits the accuracy of where you can resize your buffers to with a max of 20 potential sizes.I have also added a
focustoggle that will set the current buffers bounds to double the limit, ensuring it takes the majority of screen space allowing quick toggle to focus on different files which works quite nice with the flex approach.As it stands this will be a draft until people have a play with the branch and we decide on a solution
#1176