folke / zen-mode.nvim

🧘 Distraction-free coding for Neovim
Apache License 2.0
1.65k stars 46 forks source link

Typewrite-like centered writing #147

Closed nounder closed 1 hour ago

nounder commented 1 month ago

Did you check the docs?

Is your feature request related to a problem? Please describe.

It would be amazing to have typewrite-like experience by moving beginning of the document to the middle of the window. As words are written, new lines are always centered to the middle. Please see video below:

screenshot-2024-07-30T020707

Describe the solution you'd like

A typewriter flag option to enable this type of writing experience.

Describe alternatives you've considered

Using iA Writer instead of nvim? :sad:

Additional context

No response

b0ae989c commented 1 month ago

We don't need a new feature for this. Setting scrolloff to a large number will do. For example,

opts = {
  window = {
    options = {
      scrolloff = 999,
    },
  },
},
nounder commented 1 month ago

I tried that but there was no change whatsoever. Doing :set scrolloff 999 directly did nothing, too. What should be result of setting this option?

b0ae989c commented 1 month ago

What should be result of setting this option?

The current line will always be centered in insert, normal, and visual mode.

nounder commented 1 month ago

Just tried running nvim -u NONE with plain config and setting scrolloff doesn't seem to do anything.

b0ae989c commented 1 month ago

It's :set scrolloff=999.

nounder commented 1 month ago

Setting the scrolloff doesn't do anything in vanilla nvim or my config with zen-mode installed.

Terminal recording: https://asciinema.org/a/qwmwOVeytNKMmMzbIuFe3GcMT

b0ae989c commented 1 month ago

Either your config does not respect scrolloff, or your file does not have enough lines of visible text to satisfy scrolloff setting. The later is documented:

'scrolloff' 'so'        number  (default 0)
                        global or local to window global-local
        Minimal number of screen lines to keep above and below the cursor.
        This will make some context visible around where you are working.  If
        you set it to a very large value (999) the cursor line will always be
        in the middle of the window (except at the start or end of the file or
        when long lines wrap).
nounder commented 1 month ago

scrolloff cannot do what it described and shown in the original comment. It scrolls the text so that (when possible) there are always at least five lines visible above the cursor, and five lines visible below the cursor.

danrasmuson commented 1 month ago

I would love a feature like this. Any other suggestions or plans to support this kind of functionality in zen-mode?

github-actions[bot] commented 1 week ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 hour ago

This issue was closed because it has been stalled for 7 days with no activity.