Vim眼泪显示tmux窗格

时间:2016-05-09 14:38:59

标签: vim vagrant windows-10 tmux

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

enter image description here

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

更新:更改窗格会暂时解决问题,但某些类型的修改会再次发生。

1 个答案:

答案 0 :(得分:3)

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

根据vim的帮助:"列"或" 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.

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

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

  COLUMNS=40  vim

例如