Closed anurag3301 closed 2 years ago
the event should be bufread, not bufnewfile (because the file has already been created)
It works fine when the file is created after :CphReceive
, but it add the code to any time I open an existing solution.cpp
As I can understand its autocmd BufRead
It will trigger every time I read the file.
ah right, should be fixed now (with bufnewfile)
btw you can just use snippets instead of workarounds like these - which are also useful for other standard procedures
Yeah, I'll look for snippet way. But it would be really great if we have an option to inject a custom boilerplate code for the solution.cpp
. A lot of people have their own boilerplate code specifically for competitive programming. I think It can be done when cphelper creates the solution.cpp file
then put your boilerplate in a snippet - it'll even place your cursor in the right position when you select it
#include<bits/stdc++.h>
#define FOR(n) for(int i=0; i<n; i++)
using namespace std;
int main(){
int t; cin >> t;
while(t--) {
// CURSOR HERE
}
}
Hey I wanted to create a template for solution.cpp and inject the following code. This is whats inside
~/.config/nvim/templates/cptemp.cpp
I followed online guide and added following in my nvim config
If I create a file with
nivm solution.cpp
its working but in cphelper it isn't. Cphelper is still creating blank solution.cpp.If I am doing something wrong, How can I fix it. :)