I'm running a Ubuntu virtual machine on a Win10 host (via vagrant) and having trouble getting tmux
to behave properly when running vim
in one of its panes. On its own, vim
displays fine; however, when inside a tmux
pane, the line breaks get all confused and it tears across the pane boundaries:
I'm using ConEmu in the video; however, the same thing happens in cmd.exe.
Update: changing panes fixes the issue temporarily, but certain kinds of edits make it happen again.
You can, once vim is running, set the width (the number of columns) :
according to vim's help: the "columns" or "co" setting is:
'columns' 'co' number (default 80 or terminal width)
global
{not in Vi}
Number of columns of the screen. Normally this is set by the terminal
initialization and does not have to be set by hand. Also see
|posix-screen-size|.
When Vim is running in the GUI or in a resizable window, setting this
option will cause the window size to be changed. When you only want
to use the size for the GUI, put the command in your |gvimrc| file.
When you set this option and Vim is unable to change the physical
number of columns of the display, the display may be messed up. For
the GUI it is always possible and Vim limits the number of columns to
what fits on the screen. You can use this command to get the widest
window possible:
:set columns=9999
Minimum value is 12, maximum value is 10000.
You should also check if you don't have "COLUMNS" set in your environment (and therefore "inherited" inside tmux), and in that case vim may be relying on its value instead of interrogating the terminal? (here is an exemple of discussion around that kind of issue, but for another environment (debian linux, instead of windows tmux for you) : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=605279 : shows that you shouldn't export COLUMNS before launching tmux, if possible)
You should also be able to launch vim while specifying the COLUMNS value just for the duration of its invocation, with:
COLUMNS=40 vim
for example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With