Reputation: 159
I've recently got started with competitive programming. I see a lot of competitors use vim in the competition. I want to add default code to every CPP file that I might open in vim so that I don't have to type the following routine code and a few Macros as well every time. please help me. thanks in advance.
#include <bits/stdc++.h>
using namespace std;
int main() {
return 0;
}
Upvotes: 0
Views: 195
Reputation: 447
One possible solution would be to create the template file and read it using the :r
command in vim. The next step would be using an autocommand on *.cpp files, whenever you create a new File. see :h autocmd-groups
Upvotes: 2