
問題
在 Vim 中設定顏色方案後(按照將 colorcheme.vim 檔案移至 ~/.vim/colors 的禁止方法),並執行多行移動,例如 Ctrl-D/Ctrl-U 進行向上/向下翻頁,Vim突出顯示一些到所有尾隨空白。你可以透過這張圖片看到我所看到的:
我注意到其他移動也有類似的行為,例如“100j/k”移動大量線條。觸發錯誤後,更多的移動似乎會加劇問題。較小的動作在開始移動螢幕之前似乎不會產生任何作用。
嘗試過
安裝不同的顏色方案來檢查它是否是特定的方案,在 Vagrant 框中嘗試 Vim 看看它是否是我的電腦。
搜尋 Google、Stack Overflow、Super User——令人驚訝的是沒有發現類似的內容。
環境
Surface Pro 上的 Windows 10。在 Windows 上使用 Ubuntu Bash (WSL)。 Vim 8.0。試試使用 molokai.vim 和 rigel.vim 顏色方案。這是我的 vimrc:
set ruler
set number
set textwidth=80
" Creates tabs:
set softtabstop=4
set shiftwidth=4
set expandtab " whether tabs are tabs or spaces
set autoindent
syntax enable
set wildmenu " visual autocomplete menu <tab>/<alt-tab> to cycle
set incsearch " search as characters are entered
set hlsearch " highlights search results
" turn off search highlight, since it persists, with: \<space>
nnoremap <leader><space> :nohlsearch<CR>
colorscheme rigel
答案1
可能有點晚了,但可能對其他人有幫助。我透過從 vimrc 中刪除這一行解決了這個問題:
set listchars=nbsp:█,eol:¶,tab:>-,extends:»,precedes:«,trail:•
答案2
我在另一篇文章中看到了這個答案,我遇到了同樣的問題,但這不是由於 listchars 選項造成的。這解決了一切:添加autocmd VimEnter * set t_ut= to your vimrc file
。
答案3
這是我在嘗試解決同一問題時看到的第一個線程,所以我認為用對我有用的內容更新這個問題是個好主意。
當我向下捲動頁面時,我的 vim 配色方案似乎正在讓位給我的終端(kitty)配色。幸運的是,我偶然發現了 kitty 的 GitHub 問題。
將以下內容添加到我的.vimrc
解決方案中解決了我的問題。
" vim hardcodes background color erase even if the terminfo file does
" not contain bce (not to mention that libvte based terminals
" incorrectly contain bce in their terminfo files). This causes
" incorrect background rendering when using a color theme with a
" background color.
let &t_ut=''