简体   繁体   中英

Location of my .vimrc file in Ubuntu 14.04

I am working on a newly installed Ubuntu system. I created a my vimrc by typing vim and the then I did :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.

:help $MYVIMRC clearly states:

The $MYVIMRC environment variable is set to the file that was first found, unless $MYVIMRC was already set and when using VIMINIT.

So you can use that to open an existing Vim configuration, but not to create it. 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).


To create an empty .vimrc , just use

: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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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