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.
Vim Configuration Files: Vim can be configured system wide (globally) via the /etc/vim/vimrc. local file on Ubuntu/Debian based operating systems. On CentOS 7 and RHEL 7, the system wide configuration file for Vim is in /etc/vimrc.
The global or system-wide vim configuration file is generally located under the /etc/vim/vimrc . This configuration file is applied to all users and when Vim is started this configuration file is read and Vim is configured according to this file contents.
vimrc using vim. In vim, add the commands that you know you want to put in, then type :wq to save the file. Now open vim again. Once in vim you can just type: :scriptnames to print a list of scripts that have been sourced.
: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.
I would exit vim, and
echo 'set statusline+=%F' > $HOME/.vimrc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With