1

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.

  • You can make the window 80 characters wide: :set columns 80. – Martin Tournoij May 31 '15 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 May 31 '15 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). – Karl Yngve Lervåg Jun 1 '15 at 6:39
2

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.

1

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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