2018년 5월 15일 화요일

jupyterlab 단축키 지정법


commands 에 Notebook operations 에  restart kernel and run all cells 라는 것을

단축키 지정 하고 싶다.

먼저 https://github.com/jupyterlab/jupyterlab/blob/master/packages/notebook-extension/src/index.ts#L224

여기에 보면 command 안의 명령들의 명칭들을 볼 수 있다.

export
const restartRunAll = 'notebook:restart-run-all';

이렇게 되어있다.

"notebook:@@여기에는 소문자오 command 안의 내용을 쓴다. 스페이스는 - 로": {
      "command": @@ 여기에 위의 '' 안의 내용을 써준다.

이렇게

command 에는 Restart Run All 로 되어있으므로 restart-run-all 이라고

"notebook:restart-run-all": {
      "command": "notebook:restart-run-all",
      "keys": [
        "Shift 2"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },
     
       

---- 내 설정
{
"kernelmenu:restart": {
      "command": "kernelmenu:restart",
      "keys": [
        "Shift 1"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },
       
"notebook:restart-run-all": {
      "command": "notebook:restart-run-all",
      "keys": [
        "Shift 2"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },
       
"notebook:notebook:run-all-above": {
      "command": "notebook:run-all-above",
      "keys": [
        "Shift 3"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },
       
"notebook:close-and-shutdown": {
      "command": "notebook:close-and-shutdown",
      "keys": [
        "Shift 4"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },

       
  "notebook:collapse-selected-outputs": {
    "command": "notebook:hide-cell-outputs",
    "keys": [
      "Q"
    ],
    "selector": ".jp-Notebook:focus"
  },   

    "notebook:expand-selected-outputs": {
    "command": "notebook:show-cell-outputs",
    "keys": [
      "Q",
      "Q"
    ],
    "selector": ".jp-Notebook:focus"
  },   
 

  "notebook:collapse-selected-code": {
    "command": "notebook:hide-cell-code",
    "keys": [
      "W"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
"notebook:expand-selected-code": {
    "command": "notebook:show-cell-code",
    "keys": [
      "W",
      "W"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
     
             
"notebook:expand-all-inpouts": {
    "command": "notebook:show-all-cell-inputs",
    "keys": [
      "E",
      "E"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
"notebook:collapse-all-inputs": {
    "command": "notebook:hide-all-cell-inputs",
    "keys": [
      "E"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
   
"notebook:expand-all-code": {
    "command": "notebook:show-all-cell-code",
    "keys": [
      "R",
      "R"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
"notebook:collapse-all-code": {
    "command": "notebook:hide-all-cell-code",
    "keys": [
      "R"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
       
"notebook:change-to-cell-heading-1": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
       
    "notebook:change-to-cell-heading-2": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
        "notebook:change-to-cell-heading-3": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
        "notebook:change-to-cell-heading-4": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
        "notebook:change-to-cell-heading-5": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
           
"notebook:change-cell-to-raw": {
      "command": "notebook:change-cell-to-raw",
      "keys": [
     
      ],
      "selector": ".jp-Notebook:focus"
    }
   
}

댓글 없음:

댓글 쓰기