I would like Vim (run in a terminal) to only use the leftmost 80 columns of the terminal (i.e., not display anything in the columns right of that). Of course, I don't want to have to resize my terminal window to 80 columns. How is it possible to achieve that?

I have tried:

  • Setting :set columns=80 in vim, but this has no effect
  • Running COLUMNS=80 vim, but vim ignores the variable altogether
  • Following posix-screen-size in help, putting set cpoptions=aABceFs| in my .vimrc and then retrying the above; but this has no effect either. I don't understand why -- :help posix-screen-size specifically promises that the | flag in cpoptions should make vim follow LINES and COLUMNS (see also :help cpo-bar).

To be precise, for the last point, because my shell (zsh) as a tendency to resetting COLUMNS to its default setting, I was careful to try in a separate shell. I tried what's below and it did not work:

$ export LINES=80 COLUMNS=80
80 80
$ vim -c 'set cpoptions+=|' path/to/file

I see that the vimroom plugin makes it possible to limit the number of columns used by vim (amongst other things), but doing this via such a plugin feels a bit overkill and also the plugin centers the display instead of using the leftmost columns which is not what I want.

How can I make vim use the leftmost 80 columns?

I'm happy with solutions that use, e.g., vsplits and additional panes (but provided they don't interfere with the editing, in particular, I would want :q to exit without having to close the useless panes); or alternatively using tmux...

2 Answers 2


Turns out there is a very simple solution, using stty:

$ stty columns 80
$ vim path/to/file

Thanks to immae I also have a solution using tmux:

tmux -L $(date +%s) unbind-key -a \; set -g mouse off \; set -g status off \; new-session sleep 36500d \; split-window -h -l 80 -b bash -c 'vim "$@"; tmux kill-server' bash "$@"

Note that this assumes your editing session lasts less than 36500 days. See this question for alternatives to the use of sleep

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.