简体   繁体   English

我的.vimrc文件在Ubuntu 14.04中的位置

[英]Location of my .vimrc file in Ubuntu 14.04

I am working on a newly installed Ubuntu system. 我正在开发一个新安装的Ubuntu系统。 I created a my vimrc by typing vim and the then I did :e $MYVIMRC. 我通过输入vim创建了一个我的vimrc然后我做了:e $ MYVIMRC。 I landed up in an empty file, I wrote something this 我登上了一个空文件,我写了一些东西

  " Add full file path to your existing statusline
  set statusline+=%F 

But even after that if I am opening vimrc again by using :e $MYVIMRC its not showing up anything on top as file location path. 但即便如此,如果我再次打开vimrc使用:e $ MYVIMRC它不会在文件位置路径上显示任何内容。

:help $MYVIMRC clearly states: :help $MYVIMRC明确指出:

The $MYVIMRC environment variable is set to the file that was first found, unless $MYVIMRC was already set and when using VIMINIT. $ MYVIMRC环境变量设置为首次找到的文件,除非已设置$ MYVIMRC并使用VIMINIT。

So you can use that to open an existing Vim configuration, but not to create it. 因此,您可以使用它来打开现有的 Vim配置,但不能创建它。 If you watch closely, you'll see that 如果仔细观察,你会看到

:e $MYVIMRC
:w

will respond with 会回应

"$MYVIMRC" [New File]

So, you've created a file named $MYVIMRC in the current directory (as the variable hasn't been set). 因此,您在当前目录中创建了一个名为$MYVIMRC的文件(因为尚未设置该变量)。


To create an empty .vimrc , just use 要创建一个空的.vimrc ,只需使用

:e $HOME/.vimrc

Since this is a one-time action, all this worrying about the right approach isn't really helpful, anyway. 由于这是一次性的行动,无论如何,所有这些令人担心的正确方法都不是真的有用。

我会退出vim,并且

echo 'set statusline+=%F' > $HOME/.vimrc

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

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