图片.png
    新建一个全局的,粘贴进去

    1. {
    2. // "名称": {
    3. // "scope": "适用的文件类型",
    4. // "prefix": "用来触发的前缀",
    5. // "body": [
    6. // // 你的代码,每行都要用双引号引起来,每行之间要加逗号。
    7. // // 断点用“$+数字”表示,有默认值的用{:}表示,最后要停的地方是$0
    8. // "${1:fun}()",
    9. // "{",
    10. // " $2",
    11. // " return $0;",
    12. // "}"
    13. // ]
    14. // },
    15. "c main body": {
    16. "scope": "c,cpp",
    17. "prefix": "cmain",
    18. "body": [
    19. "#include <stdio.h>",
    20. "// #include <stdlib.h>\n",
    21. "int main() {\n\t$0\n}"
    22. ],
    23. },
    24. "cpp main body": {
    25. "scope": "c,cpp",
    26. "prefix": "cppmain",
    27. "body": [
    28. "#include <cstdio>",
    29. "// #include <iostream>",
    30. "using namespace std;\n",
    31. "int main() {\n\t$0\n}"
    32. ],
    33. },
    34. "ios sync": {
    35. "scope": "c,cpp",
    36. "prefix": "iossync",
    37. "body": [
    38. "ios::sync_with_stdio(false);\ncin.tie(0);"
    39. ]
    40. },
    41. "long long int": {
    42. "scope": "c,cpp",
    43. "prefix": "LL",
    44. "body": [
    45. "typedef long long LL;\n"
    46. ],
    47. },
    48. "vector<int>": {
    49. "scope": "c,cpp",
    50. "prefix": "vi",
    51. "body": [
    52. "vector<int> "
    53. ],
    54. },
    55. "define the max": {
    56. "scope": "c,cpp",
    57. "prefix": "MAX",
    58. "body": [
    59. "#define MAX $0"
    60. ],
    61. },
    62. "n groups of test data": {
    63. "scope": "c,cpp",
    64. "prefix": "n--",
    65. "body": [
    66. "int ${1:n};",
    67. "scanf(\"%d\", &${1:n});",
    68. "while (${1:n}--)\n{\n\t$0\n}",
    69. ],
    70. },
    71. "for i++": {
    72. "scope": "c,cpp",
    73. "prefix": "fori",
    74. "body": [
    75. "for (int ${1:i} = ${2:0}; ${1:i} < ${3:size}; ${1:i}++) {",
    76. "\t$0\n}"
    77. ]
    78. },
    79. "for i--": {
    80. "scope": "c,cpp",
    81. "prefix": "for-",
    82. "body": [
    83. "for (int ${1:i} = ${2:size - 1}; ${1:i} >= 0; ${1:i}--) {",
    84. " $0",
    85. "}"
    86. ]
    87. },
    88. "format print data": {
    89. "scope": "c,cpp",
    90. "prefix": "print",
    91. "body": [
    92. "for (int ${1:i} = 0; ${1:i} < ${2:size}; ${1:i}++)",
    93. "\tprintf(\"%d%c\", ${3:a}[${1:i}], \" \\n\"[i == ${2:size} - 1]);"
    94. ]
    95. },
    96. "LeetCode Lintcode": {
    97. "scope": "c,cpp",
    98. "prefix": "lcode",
    99. "body": [
    100. "#include <bits/stdc++.h>\nusing namespace std;\n$0",
    101. "int main() {\n\tSolution a;\n\t;\n\treturn 0;\n}"
    102. ]
    103. }
    104. }
    1. {
    2. "gcd": {
    3. "scope": "c,cpp",
    4. "prefix": "gcd",
    5. "body": [
    6. "${1:LL} gcd(${1:LL} m, ${1:LL} n)",
    7. "{",
    8. " while (n != 0)",
    9. " {",
    10. " ${1:LL} t = m % n;",
    11. " m = n;",
    12. " n = t;",
    13. " }",
    14. " return m;",
    15. "}",
    16. ""
    17. ]
    18. },
    19. "isPrime": {
    20. "scope": "c,cpp",
    21. "prefix": "isPrime",
    22. "body": [
    23. "int isPrime(int n)",
    24. "{",
    25. " if (n == 1 || n == 0)",
    26. " return 0;",
    27. " for (int i = 2; i <= n / i; i++)",
    28. " if (n % i == 0)",
    29. " return 0;",
    30. " return 1;",
    31. "}"
    32. ]
    33. }
    34. }