9

I often program with lines no more than 80 characters long. I start with an 80-character-wide terminal, but sometimes due to a plugin runs or after creating a vsplit results in the editing area being less than 80 characters wide.

For example, :set number will take four columns from the editing area and use them for line numbers. After this, using :vertical resize, only changes the size relative to other splits, it doesn't widen the window.

Is there a way to keep the width of the editing area at a fixed width or to quickly resize the editing area or the window to a specified width?

200_success
  • 9,549
  • 5
  • 51
  • 64
drs
  • 3,028
  • 3
  • 23
  • 27
  • 1
    set columns=90 will resize a gvim, but unfortunately that's the total width, not the width of the displayed text. So you'd have to use 84+ with numbers on. – derobert Feb 18 '15 at 17:03
  • 1
    Are you talking about (internal) Vim-windows, or the Terminal itself, or both? – Runium Feb 18 '15 at 18:18
  • I'm talking about both. If the Vim window needs to be larger than the terminal width, I'd like the terminal to expand. Perhaps this isn't possible within vim... – drs Feb 19 '15 at 11:57

4 Answers4

3

Take a look at the various window functions. For example ctrl-w = will set all splits to equal width. There are also methods to set the window to a certain width, increase/decrease width by N, always maintain equal width, etc... :help window-resize

alxndr
  • 1,346
  • 1
  • 15
  • 26
Collin Peters
  • 2,246
  • 1
  • 15
  • 9
2

Ctrl+W+ (n) >/<: For right/left
Ctrl+W+ (n) +/-: For up/down
where n = any number.

shriek
  • 121
  • 3
1

:vertical resize 80 will set your current vsplit to 80 characters wide

Collin Grady
  • 326
  • 2
  • 6
0

CTRL-W with pipe | will set the window to a specific width. E.g., to set the window to 80 columns/characters wide:

CTRL-W + 80 + |

From :help window-resize (~ @collin-peters):

Set current window width to N (default: widest possible)

John
  • 121
  • 5