2

This is more gVim (Linux) related since Vim doesn't have a "window" of its own.

I'm trying to wrap a text at (say) 80th character, visual wrap only, no changes in file, hence no textwidth or wrapmargin.

Tried using columns=80 but this resizes the window and also counts in lines numbering (set number) which is both undesired. The former is absolutely undesired, the latter I can live with though.

Is there a way to have long lines wrapped at a certain column without having to physically format the text?

This is for readability/convenience purpose only so workarounds are welcome as well.

3
  • You can make the window 80 characters wide: :set columns 80. Commented May 31, 2015 at 13:14
  • The 80 columns limit made sense in the 70s and 80s because that was the usual width of terminals back then. Today, 80 is more superstition than anything. Anyway, Did you try :vnew?
    – romainl
    Commented May 31, 2015 at 14:06
  • 1
    You might be interested in Goyo, which sort of does what you want. It does more though, and perhaps some stuff that you are not interested in as well (creates a distraction-free environment). Commented Jun 1, 2015 at 6:39

2 Answers 2

3

This is not a direct solution but a hack.

With your editing window open, :vnew a vertical split and then go back to the window then use :vert resize N where N is your desired width / column size.

2

If you don't want to reduce the physical width of your Vim / GVIM instance, you have to create a dummy window next to the current one, and set its size so that the current one has proper width.

My LimitWindowSize plugin does the size calculations for you, and offers a simple :LimitWindowWidth [{width}] command.

1
  • Looks good but I went the Goyo way. Thanks anyway, perhaps in another use case I might get back to your plugin.
    – jficz
    Commented Jun 8, 2015 at 15:35

Your Answer

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

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