Computer Language/C++
[C++] vscode 스니펫 설정 방법
Bull_
2024. 3. 28. 20:25
스니펫 설정 방법
1. Command Palette 열기: Ctrl+Shift+P 또는 Cmd+Shift+P (macOS)를 누른다.
2. Preferences: Configure User Snippets를 검색하고 선택한다.
3. cpp.json (C++ 스니펫 파일)을 찾아 선택한다.
만약 C++용 스니펫 파일이 없다면, New Global Snippets file을 선택하고 파일 이름을 지정하여 새로 만든다.
4. 열린 JSON 파일에 아래의 스니펫을 추가한다.
cpp.json
{
"C++ Basic Template": {
"prefix": "ct",
"body": [
"#include <iostream>",
"",
"using namespace std;",
"",
"void init(){",
" cin.tie(NULL);",
" cout.tie(NULL);",
" ios::sync_with_stdio(false);",
"}",
"",
"int main(){",
" init();",
" ",
" return 0;",
"}"
],
"description": "C++ Basic Template"
}
}
prefix인 ct는 그냥 cpp template 줄임말로 해봤다.
결과
