본문 바로가기

환경설정/기타

[VS CODE] 단축키로 파일 생성

매번 마우스로 파일 생성하기 귀찮아서 단축키로 파일생성 하는 방법을 소개하고자 합니다.

  1. ctrl+shift+p를 누른 후 Keyboard Shortcuts에 들어갑니다.



  2. 오른쪽 상단에 Open Keyboard Shortcuts (JSON)에 들어갑니다.



  3. json 파일에 다음과 같이 입력합니다.

    
    [
        // 파일 탐색기(Files Explorer)에서 활성화되는 경우
        {
            "key": "ctrl+shift+a",
            "command": "workbench.files.action.newFile",
            "when": "filesExplorerFocus && !inputFocus && !explorerResourceIsRoot && explorerViewletVisible"
        },
        // 에디터(Editor)에 초점이 없는 경우
        {
            "key": "ctrl+shift+a",
            "command": "explorer.newFile",
            "when": "!editorFocus"
        },
        // 파일 탐색기(Files Explorer)에서 루트 디렉토리의 경우
        {
            "key": "ctrl+shift+a",
            "command": "explorer.newFile",
            "when": "explorerResourceIsRoot && explorerViewletVisible && !inputFocus"
        },
        // 에디터(Editor)에 초점이 있는 경우
        {
            "key": "ctrl+shift+a",
            "command": "explorer.newFile",
            "when": "editorFocus"
        },
    ]

    key에 원하는 단축키를 입력합니다.