分页时 tmux 中的 vim 背景颜色会发生变化 [英] vim in tmux background color changes when paging
问题描述
我在 Solaris 上以 256 色模式使用 vim(在 Windows 上通过 Putty 连接).在 tmux 之外,一切看起来都很棒并且工作正常,但在 tmux 中,当分页/滚动文件时,背景颜色会定期更改.
I am using vim in 256 color mode on Solaris (connected via Putty on Windows). Everything looks great and works fine outside of tmux, but within tmux the background color changes periodically when paging/scrolling through a file.
它应该是这样的:
以下是翻页后的样子:
谢谢!
推荐答案
如解释在这里,通过清除t_ut
终端选项来禁用背景颜色擦除(BCE)(在Vim中运行:set t_ut=
,然后按 Control+L 刷新终端显示),以便在 tmux 和 GNU 屏幕中使用 Vim 时配色方案正常工作.
As explained here, disable Background Color Erase (BCE) by clearing the t_ut
terminal option (run :set t_ut=
in Vim and then press Control+L to refresh the terminal's display) so that color schemes work properly when Vim is used inside tmux and GNU screen.
根据上面的链接,可以通过添加以下内容在 .vimrc 中设置 BCE
Per the above link, BCE can be set in .vimrc by adding the following
if &term =~ '256color'
" disable Background Color Erase (BCE) so that color schemes
" render properly when inside 256-color tmux and GNU screen.
" see also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
endif
这篇关于分页时 tmux 中的 vim 背景颜色会发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!