junegunn / goyo.vim

:tulip: Distraction-free writing in Vim
MIT License
4.49k stars 115 forks source link

Redraw after terminal window resize #159

Closed timofurrer closed 5 years ago

timofurrer commented 6 years ago

Would it be possible to redraw the goyo window when the terminal window is resized? This is especially useful when specifying the width and heights* in percentages.

junegunn commented 6 years ago

You can do it manually by pressing CTRL-W + =. Currently I'm not triggering it automatically since it's not clear if it's always desirable as the user can manually adjust the size of the central window by pressing CTRL-W + [>, <, +, -].

henrebotha commented 6 years ago

@junegunn Would you consider a config option to enable automatic resize? Or a callback hook even.

timofurrer commented 6 years ago

@junegunn That actually works pretty good!

@junegunn Would you consider a config option to enable automatic resize? Or a callback hook even.

I'd love to see that, too! Even if it's a by-default disable option one could turn on.

henrebotha commented 6 years ago

For those who share my preferences, you can stick this in your .vimrc:

" On window resize, if goyo is active, do <c-w>= to resize the window
autocmd VimResized * if exists('#goyo') | exe "normal \<c-w>=" | endif
tgirod commented 6 years ago

@henrebotha thanks! I wonder why this is not the default behaviour.

astier commented 5 years ago

I think this should be the default behavior.