When wrapping text in GVim, the wrap occurs at the right side of the GVim window. I would prefer to have it wrap at column 80 however. A solution I have found is to :set columns=80, but this shrinks the window and gives me a kind of claustrophobic feeling. Therefore I was wondering whether anyone knows a way to wrap the text at a fixed column, without modifying the file on disk and without modifying the GVim window size. A fixed size blank space on the right of the screen would also work, but would not have my preference.

If it makes a difference: I'm mainly using GVim 7.4 on a Windows machine.


One non-Ideal solution is open another window and then set the vertical res to 80. The command would be:

:vnew | wincmd p | vertical res 80

I know this isn't quite what you had in mind, but it's better than nothing.

  • It's indeed non-ideal, but comes very close. I hadn't thought of using the extra space for something usefull, but maybe i can even put the extra window to good use. The fact that the columns resize when resizing the window is not very important to me, but can indeed be a nuisance.I'll wait a bit and see if anyone comes up with an even better idea, otherwise I'll accept this solution. – Octaviour Jul 26 '16 at 17:14

Unfortunately, this is not possible. There are many many ways to configure how a wrap should occur, such as with textwidth and wrapmargin, but these are only for hardwraps, not softwraps. The only way to change a softwrap is by changing your window size.

There are some plugins that sort of do what you want, where the wrap occurs in an area smaller than your window. There is mikewest/vimroom and junegunn/goyo.vim, but for both of these, a smaller softwrap is mainly just a side-effect of the main purpose of the plugin: To declutter your vim window and remove distractions.

An ugly workaround could be to open a split and resize it to column 80, but this hardly feels like an ideal solution. (Especially since the location of the split will change when you resize your window)

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.