How to open a vimrc file from within Vim?

How to open a vimrc file from within Vim?

Opening vimrc. If Vim finds your vimrc file during startup, Vim will set the MYVIMRC environment variable to the full path of the vimrc file. Similarly, if your gvimrc file is found, the MYGVIMRC variable is set. Therefore, you can easily edit these files from within Vim: :e $MYVIMRC :e $MYGVIMRC.

How do I set the myvimrc variable in Vim?

If Vim finds your vimrc file during startup, Vim will set the MYVIMRC environment variable to the full path of the vimrc file. Similarly, if your gvimrc file is found, the MYGVIMRC variable is set.

How to see what directories Vim is using?

These commands are useful to see what directories your Vim is using: Note the ‘system vimrc file’ and ‘user vimrc file’ paths displayed by the :version command. The system vimrc file can be created by an administrator to customize Vim for all users. In addition, each user can have his or her own user vimrc.

How to find the value of$ home in Vim?

On Windows systems, the best way to find the value of $HOME is from within Vim, as follows. These commands are useful to see what directories your Vim is using: Note the ‘system vimrc file’ and ‘user vimrc file’ paths displayed by the :version command. The system vimrc file can be created by an administrator to customize Vim for all users.

Where does Vim read commands from when starting?

Vim can be configured so that, when starting, it reads commands from a vimrc file in the current directory, after reading the primary vimrc. This is configured by adding set exrc to the primary vimrc file. Setting ‘exrc’ can be a security problem because it means Vim will execute commands from any vimrc file in the directory where Vim is started.

Why is my.vimrc file not reading Neovim?

If anyone happen upon this issue while using neovim you should know (before you start pulling off your hair) that the .vimrc file is loaded from ~/.config/nvim/init.vim. In case anyone else runs across this issue, and like me realizes . vimrc wasn’t read because of sudo, try using sudo -E.

Why is Vim editing _ vimrc not saving in gvim?

The issue I am running into right now is that after opening up _vimrc and adding in the line stated above, I cannot save the file, even when forcing it (with w!). I was wondering why this is and how I can go about fixing this. As an added note, I am running this in GVIM.