Debian 中的 vim Bug

Crq
Crq
管理员
1455
文章
0
粉丝
Linux教程评论305字数 439阅读1分27秒阅读模式

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 版本的通用加载语句, 但现在我对此很满意。

via: https://www.preining.info/blog/2017/10/fixing-vim-in-debian/

作者:Norbert Preining 译者:geekpi 校对:wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出

weinxin
我的微信
微信号已复制
我的微信
这是我的微信扫一扫
 
Crq
  • 本文由 Crq 发表于2024年9月29日 02:07:53
  • 转载请注明:https://www.cncrq.com/10946.html
linux关于网络的命令介绍 Linux教程

linux关于网络的命令介绍

本文将讲述网络相关命令,作者假定读者具备TCP/IP协议栈的基础知识。对于相关命令及其输出只介绍它的基本的使用方法和大概的描述,具体协议将不作详细解释。
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证