3
  1. Suppose I run

    :terminal someprg_wide_output
    

    the output is wrapped by current terminal window size wrapped hard way, so :set nowrap there can't help

  2. When I run same program not from vim like this:

    someprg_wide_output | vim -
    

    vim accepts the whole width of the output without wrapping lines

I tried adding ++cols option, it does not seem to work as expected

:terminal ++cols=300 someprg_wide_output

Is there a way to make vim terminal think it is wider as visible part? I would like output looks in 1. like it does for 2.

1 Answer 1

4

No one has replied at all to this? Hmm. Well, I think I have an answer ("works for me") Note: ++cols won't do anything if the terminal window already takes up the full width of the surrounding Vim window.

Refer to the help section on terminal resizing. It discusses how to use the 'termwinsize' option to control terminal window dimensions. For your needs try a value that uses the rows*columns format. For example, if you do :set termwinsize=20*200 a subsequent :terminal cmd for a command that outputs text will not force line breaks into any lines that fit into 200 columns or less.

If you reset with :set termwinsize& and try again then the width will go back to being constrained by Vim window width.

That's it.

4
  • 1
    I've been using a workaround by redirecting output to a file and opening it afterwards - wrapped that actions into vim functions. Just out of curiousity - what is the natural way of figuring out there's a termwinsize option?
    – Tag Wint
    Jul 29, 2019 at 8:15
  • I'm not 100% sure what you mean by a "natural way". Really you just need to search for the obvious. In this case I just did :h :terminal and then /size and that immediately took me to a link to the terminal-resizing section that I mention in my (updated) answer. My general advice is a) understand that Vim's help is outstanding but you'll be better equipped to use it if you b) read user guide entry on help to learn important information about how the docs are navigated and pick up some important conventions (e.g. 'foo' vs :foo vs etc.).
    – B Layer
    Jul 30, 2019 at 5:11
  • 1
    The way you described I'd call natural. As an opposite to getting answers vie SE. Now it really looks easy to find. Thanks for sharing.
    – Tag Wint
    Jul 31, 2019 at 12:07
  • @TagWint Cool. Glad that helped. Cheers.
    – B Layer
    Aug 1, 2019 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.