The location of my .vimrc file in Ubuntu 14.04

I am working on a recently installed Ubuntu system. I created my vimrc by typing vim, and then I did: e $ MYVIMRC. I landed in an empty file, I wrote something like this

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

But even after that, if I open vimrc again using: e $ MYVIMRC, it does not show anything from above as a file path.

+7
linux vim ubuntu
source share
2 answers

:help $MYVIMRC clearly states:

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

Thus, you can use this to open the existing Vim configuration, but not create it. If you look closely, you will see that

 :e $MYVIMRC :w 

will answer

 "$MYVIMRC" [New File] 

So, you created a file called $MYVIMRC in the current directory (since the variable was not set).


To create an empty .vimrc just use

 :e $HOME/.vimrc 

Since this is a one-time action, all this worries the right approach, in any case, not very useful.

+10
source share

I would exit vim and

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

All Articles