Skip to content

feat: Add toggle_zoom and :set-max-width with multiple :set/:toggle commands for Zen Mode like features in the future - #25

Open
RokKos wants to merge 7 commits into
gj1118:masterfrom
RokKos:feat/zen-mode
Open

feat: Add toggle_zoom and :set-max-width with multiple :set/:toggle commands for Zen Mode like features in the future#25
RokKos wants to merge 7 commits into
gj1118:masterfrom
RokKos:feat/zen-mode

Conversation

@RokKos

@RokKos RokKos commented Nov 13, 2025

Copy link
Copy Markdown

Hey, while browsing some PRs and discussion on original Helix repo I found 2 PR that came together really nicely.

This PR is based on:

It adds 3 small functionalities:

  • toggle_zoom: A new command that zooms the current view to take up the entire editor area.
  • :set-max-width : A new command to set a maximum width for the view. This centers the view, which is perfect for focused writing! (Setting it to 0 removes the max width).
  • fix for enabling multiple :set/:toggle commands

Especially with the last one, you can do some powerful commands that change the appearance of your editor.
And enable features like Zen mode. I believe this will be a great addition until we wait for the plugin system.

I was definitely looking for something like this to edit my notes in Markdown or just preview Markdown files.

My personal setup for Zen mode:

[keys.normal."space"]
# Set max width based on your terminal
z = ["toggle_zoom", ":set-max-width 80", ":set soft-wrap.enable true", ":set gutters.layout []"]
Z = ["toggle_zoom", ":set-max-width 0", ":set soft-wrap.enable false", ':set gutters.layout ["diagnostics","spacer","line-numbers","spacer","diff"]']

Preview Zen mode ON:

Screenshot 2025-11-13 at 20 41 25

Preview Zen mode OFF:

Screenshot 2025-11-13 at 20 41 38

lizclipse and others added 7 commits January 22, 2025 00:12
# Conflicts:
#	book/src/generated/typable-cmd.md
#	book/src/keymap.md
#	helix-term/src/commands/typed.rs
#	helix-term/src/ui/statusline.rs
#	helix-view/src/editor.rs
# Conflicts:
#	helix-term/src/application.rs
#	helix-view/src/editor.rs
@gj1118

gj1118 commented Nov 13, 2025

Copy link
Copy Markdown
Owner

There is already a similar change that was already merged - helix-editor#8546 ..

@RokKos

RokKos commented Nov 14, 2025

Copy link
Copy Markdown
Author

I checked that PR and it looks similar, at least the part about max size.
But correct me if I am wrong, it looked more for behavior when you have 2 buffers in a split to control the size of one.

Also can you hint how you would Zen mode with those commands? I am willing to remove the Zoom and Max width part and just keep this multi-command keybinding.

@gj1118

gj1118 commented Nov 14, 2025

Copy link
Copy Markdown
Owner

I checked that PR and it looks similar, at least the part about max size. But correct me if I am wrong, it looked more for behavior when you have 2 buffers in a split to control the size of one.

Also can you hint how you would Zen mode with those commands? I am willing to remove the Zoom and Max width part and just keep this multi-command keybinding.

It comes with its own keybindings. I have not configured it. When I merged it initially, I thought I would use it, but I keep using tmux and hence felt no need for this feature. Perhaps , we can remove the already merged and start afresh with your pull request.

here are the keybindings.

 "A-w" => { "Alter Window"
            "A-h"|"A-left" |"h"|"left" => shrink_buffer_width,
            "A-l"|"A-right"|"l"|"right" => grow_buffer_width,
            "A-j"|"A-down" |"j"|"down" => shrink_buffer_height,
            "A-k"|"A-up"   |"k"|"up" => grow_buffer_height,
            "A-f"|"f" => toggle_focus_window,
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants