Skip to content
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

Reformat text on window resize #14

Open
jebaum opened this issue Feb 13, 2015 · 2 comments
Open

Reformat text on window resize #14

jebaum opened this issue Feb 13, 2015 · 2 comments

Comments

@jebaum
Copy link

jebaum commented Feb 13, 2015

If you vertically resize a window containing a manpage, the text remains formatted to fit whatever the original window size was. If the window was originally small and you make it wider, the text doesn't use any of the additional space. Conversely, if the window was originally wide and you make it narrower, it wraps in ways that make it difficult to read. I haven't looked at the code at all so I have no idea how this is done, but I think it would be useful to expose a mapping to reformat the text for the current window size, or for gvim, hook into the VimResized autocmd.

@bruno-
Copy link
Collaborator

bruno- commented Feb 13, 2015

Hey thank you for trying out the plugin.
I'd recommend setting the text width to 80 columns. There's an option for that (not documented yet): let g:man_width = 80.
That's pretty narrow compared to monitor size so it should fit in pretty much any window, no matter how small.
Also, I find 80 columns text easier to read.. maybe it should even be the default.

The issue with reformatting the window is that it's cumbersome and won't work well with Mangrep.

Btw. did you get to use mangrep feature? I'd appreciate some feedback on that.

@jebaum
Copy link
Author

jebaum commented Feb 13, 2015

I tried mangrep out of curiousity, although I haven't had an actual need to do it (ever, I think...). It worked very well! Not something I think you would need very often but very handy when you do. In case anyone stumbles on this conversation, if you lazy load dispatch with vim-plug or neobundle, mangrep can't use it unless it's already been loaded. So either don't lazy load dispatch, or write some vimL to call plug#load('vim-dispatch') before running mangrep.

The textwidth option sounds like a decent workaround. The map in the pull request I opened works perfectly (minus the part where it loses your place in the buffer), and it's only a single line of code. Knowing about g:man_width I'm on the fence about it. Sometimes I do end up with screens less than 80 columns and in that case, having the option to format dynamically is nice.

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

No branches or pull requests

2 participants