修復Debian中的vim奇怪行為

我一直在想,為什么我服務器上 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.vimendif" now set the line that the defaults file is not reloaded afterwards!let g:skip_defaults_vim = 1" turn of mouseset mouse=" other override settings go here
可能有更好的方式來獲得一個不依賴于 vim 版本的通用加載語句, 但現在我對此很滿意。



























