I am currently using gVim to code in C++. I've recently made a skeleton file that includes imports, macros, etc., so that every time I make a new .cpp file it automatically adds the skeleton to it.
To do this, I used this line:
autocmd BufNewFile *.cpp 0r C:/Me/template.cpp
Whenever I make a new file with command prompt (vim A.cpp
), a new file is created and the file contains the skeleton. However, when I create a new file using the gVim, it doesn't contain the skeleton.
In order to get the code skeleton in the file, I have to :q
out of gVim then :e
into the file. After :e
'ing into the file, if I make changes and then :wq
it says Can't write viminfo file C:/_viminfo.tmp
.
Also, when I try to open the file I made with gVim through File Explorer (after getting the template on it), it appears as blank file.
How do I get gVim to automatically have the code skeleton whenever I create a new .cpp file in gVim?
vimrc
as your terminal version? Open gVim and execute:scriptnames
. Do the same from your terminal Vim and compare. – Ralf Jul 11 '20 at 12:49