首頁 > 系統教程 > Linux > 主體

Debian 中的 vim Bug

WBOY
發布: 2024-04-20 09:04:01
轉載
812 人瀏覽過

Debian 中的 vim Bug
# 我一直在想,為什麼我伺服器上 vim 為什麼在滑鼠方面表現得如此愚蠢:不能像平常那樣跳躍、複製、貼上。儘管在 /etc/vim/vimrc.local 中已經設定了。

set mouse=
登入後複製

最後我終於知道為什麼了,多謝 bug #864074 並且修復了它。原因是,當沒有 ~/.vimrc 的時候,vim 在 vimrc.local 之後載入 defaults.vim,從而覆寫了幾個設定。

/etc/vim/vimrc 中有一個註解(雖然我沒有看到)解釋了這一點:

" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
" This happens after /etc/vim/vimrc(.local) are loaded, so it will override
" any settings in these files.
" If you don't want that to happen, uncomment the below line to prevent
" defaults.vim from being loaded.
" let g:skip_defaults_vim = 1
登入後複製

我同意這是在正常安裝 vim 後設定 vim 的好方法,但 Debian 套件可以做得更好。在錯誤報告中清楚地說明了這個問題:如果沒有 ~/.vimrc,/etc/vim/vimrc.local 中的設定被覆蓋。這在Debian中是違反直覺的 - 而且我也不知道其他包中是否採用類似的方法。

由於 defaults.vim 中的設定非常合理,所以我希望使用它,但只修改了一些我不同意的項目,例如滑鼠。最後,我在 /etc/vim/vimrc.local 中做了以下操作:

if filereadable("/usr/share/vim/vim80/defaults.vim")
  source /usr/share/vim/vim80/defaults.vim
endif
" now set the line that the defaults file is not reloaded afterwards!
let g:skip_defaults_vim = 1
" turn of mouse
set mouse=
" other override settings go here
登入後複製

可能有更好的方式來獲得一個不依賴 vim 版本的通用載入語句, 但現在我對此很滿意。

以上是Debian 中的 vim Bug的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:linuxprobe.com
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!