0

I read the similar posts that popped up on google, none of them had resolved the issue, so I'm asking this again.

I want to create a snippet for C++ file to initialize a new file with the following lines of code

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long l;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,pair<int,int> > tii;
typedef vector<pair<int,int> > vec_pii;
#define fastinput ios_base::sync_with_stdio(false); cin.tie(false);
#define mp make_pair
#define setbits(n) __builtin_popcount((n))
#define pb push_back
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define sf(n) scanf("%lld",&(n))
#define pf(n) printf("%lld\n",(n))
#define min3(a,b,c) (min((c),min((a),(b))))
#define max3(a,b,c) (max((a),max((b),(c))))

This is the snippet code that I came up with (doesn't work). Please correct the mistake and verify if it works.

<snippet>
    <content><![CDATA[
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long l;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,pair<int,int> > tii;
typedef vector<pair<int,int> > vec_pii;
#define fastinput ios_base::sync_with_stdio(false); cin.tie(false);
#define mp make_pair
#define setbits(n) __builtin_popcount((n))
#define pb push_back
#define mod 1000000007
#define gcd(a,b) __gcd(a,b)
#define sf(n) scanf("%lld",&(n))
#define pf(n) printf("%lld\n",(n))
#define min3(a,b,c) (min((c),min((a),(b))))
#define max3(a,b,c) (max((a),max((b),(c))))
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>newfile</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.cpp</scope>
</snippet>

1 Answer 1

1

Change
<scope>source.cpp</scope>
to
<scope>source.c++</scope>


You can use SublimeText's show_scope_name command or a plugin like ScopeHunter to find the correct scope name for your target documents & regions.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! This was taking ages for me to figure out

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.