简体   繁体   English

为什么〜/ .vimrc在ubuntu服务器上对vim不起作用

[英]Why ~/.vimrc is not working for vim on ubuntu server

I installed ubuntu server on vmware player. 我在vmware player上安装了ubuntu服务器。 I want to use vim, so I put .vimrc file under my home directory. 我想使用vim,所以我将.vimrc文件放在主目录下。

But when I open vim , vim is not using the configuration from the file ~/.vimrc . 但是,当我打开vimvim 没有使用~/.vimrc文件中的配置。

If I do it the same way on a ubuntu desktop virtual machine, everything works fine. 如果我在ubuntu桌面虚拟机上以相同的方式进行操作,则一切正常。

What did I do wrong in the server environment? 在服务器环境中我做错了什么? What else should I do? 我该怎么办?

In order to tell if your .vimrc is running at all, put 为了确定您的.vimrc是否正在运行,请输入

echom ".vimrc message 1"

On the first line of ~/.vimrc 在〜/ .vimrc的第一行

Then launch vim and type 然后启动vim并输入

:messages

in regular mode. 在常规模式下。 If you see ".vimrc message 1", you know that the .vimrc is at least being read ... it may be stopping before it does anything useful, but at least vim is picking it up. 如果看到“ .vimrc消息1”,则说明至少正在读取.vimrc……它可能在做任何有用的事情之前就停止了,但是至少vim正在将其提取。

I would also try which vim to see which program is being called when you type vim . 当您键入vim时,我还将尝试使用which vim来查看正在调用哪个程序。

You can capture a full log of a Vim session with vim -V20vimlog . 您可以使用vim -V20vimlog捕获Vim会话的完整日志。 After quitting Vim, examine the vimlog log file. 退出Vim后,检查vimlog日志文件。 It will show where Vim searched. 它将显示Vim的搜索位置。

Does Vim correctly detect your home directory? Vim是否可以正确检测您的主目录? :echo $HOME will tell you. :echo $HOME会告诉您。

Also, read :help .vimrc for details on the resolution and locations of .vimrc . 此外,阅读:help .vimrc就决议的细节和位置.vimrc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM