Vim眼泪显示tmux窗格

FMM*_*FMM 8 vim tmux vagrant windows-10

我在Win10主机上运行Ubuntu虚拟机(通过vagrant),并且在其中一个窗格中tmux运行时无法正常运行vim.就其自身而言,vim显示良好; 但是,当在tmux窗格内时,换行符会变得混乱,并且会在窗格边界上撕裂:

在此输入图像描述

我在视频中使用ConEmu; 但是,cmd.exe中也会发生同样的事情.

更新:更改窗格会暂时修复此问题,但某些类型的编辑会再次发生.

Oli*_*lac 3

一旦 vim 运行,您可以设置宽度(列数):

根据vim的帮助:“columns”或“co”设置是:

'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.
Run Code Online (Sandbox Code Playgroud)

您还应该检查您的环境中是否没有设置“COLUMNS”(因此在 tmux 中“继承”),在这种情况下,vim 可能会依赖它的值而不是询问终端?(这里是围绕此类问题的讨论示例,但针对另一种环境(debian linux,而不是 windows tmux):https://bugs.debian.org/cgi-bin/bugreport.cgi ?bug=605279 :表明您不应在启动 tmux 之前导出 COLUMNS(如果可能)

您还应该能够启动 vim,同时仅在调用期间指定 COLUMNS 值:

  COLUMNS=40  vim
Run Code Online (Sandbox Code Playgroud)

例如