joshuadanpeterson / typewriter.nvim

A Neovim plugin that emulates a typewriter, keeping the cursor centered on the screen for a focused writing experience.
MIT License
23 stars 0 forks source link

Center horizontally? #3

Closed NonlinearFruit closed 2 months ago

NonlinearFruit commented 2 months ago

I like this implementation you went with here! Listening to cursor events instead of remapping individual bindings is a cool idea

Could add zs and zH to center horizontally in addition to vertically (code). When in 'centering mode' I prefer also have the cursor horizontally centered as well

joshuadanpeterson commented 2 months ago

Glad you like it.

That's an interesting idea. I personally have text wrap enabled, so horizontal centering wasn't really a forethought for me, but I can look at adding it. I started playing around with it and right now I can have it center horizontally if you move toward the end of the line, moving the text left. Is that what you're thinking?

NonlinearFruit commented 2 months ago

Yes, I believe so. I changed the normal! zz to normal! zzzszH so when the cursor tries to move to the right hand side of the window, the viewport also moves right (which is the same as the text moving left)

joshuadanpeterson commented 2 months ago

Cool, I'll work on something this weekend. I think I'll make it configurable as well, just so that way people can turn it on and off if they want it or not

joshuadanpeterson commented 2 months ago

Feature added. Update the plugin and enable the feature in the plugin config. Thanks again for the idea!