2025年5月10日土曜日

キーボードショートカット カスタム AutoHotKey vscode

  1. AutoHotKey
    • Toggle: 無変換 f でvimのNormalモードみたいになって、無変換を押さずに右手だけで操作できる(ソースコード読むなら素直にマウス使ったほうがいいことに気づいた)
    • script.ahk
      ; AutoHotKey v2
      ; {blind} shift同時押し
      ; sendevent  押しっぱ時貫通防止
      
      ; ! alt
      ; + shift
      ; ^ ctrl
      
      ; vk1d 無変換
      ; vkbb セミコロン
      ; vkba コロン
      
      vk1d & i::sendevent "{blind}{up}"
      vk1d & j::sendevent "{blind}{left}"
      vk1d & k::sendevent "{blind}{down}"
      vk1d & l::sendevent "{blind}{right}"
      
      vk1d & u::sendevent "{blind}{home}"
      vk1d & o::sendevent "{blind}{end}"
      
      vk1d & h::sendevent "{blind}{pgup}"
      vk1d & n::sendevent "{blind}{pgdn}"
      
      vk1d & vkbb::enter
      vk1d & p::bs
      
      vk1d & ,::send "!{left}"
      vk1d & .::send "!{right}"
      
      vk1d & q::escape
      
      vk1d & 8::[
      vk1d & 9::]
      
      vk1d & vkba::_
      vk1d & m::&
      
      vk1d & 1::reload
      
      ; vscode エクスプローラー ctrl 0
      vk1d & 0::^0
      
      ; デバッグ時
      ; vk1d & w::f11
      ; vk1d & e::f10
      
      ; 無変換 capslockで shift capslock発動 (大文字)
      vk1d & f12::SetCapsLockState !GetKeyState("CapsLock", "T")
      
      ; 無変換で英語 無変換+スペースで日本語
      vk1d::IME_SET(0)
      vk1d & space::IME_SET(1)
      IME_SET(setSts) {
      	hWnd := WinGetID("A")  ; アクティブウィンドウのハンドルを取得
      	DllCall("SendMessage", "UInt", DllCall("imm32.dll\ImmGetDefaultIMEWnd", "UInt", hWnd), "UInt", 0x0283, "Int", 0x006, "Int", setSts)
      }
      
  2. vscode
    • keybindings.json
      [
          {// ブレークポイント
              "key": "f9",
              "command": "editor.debug.action.toggleBreakpoint",
              "when": "debuggersAvailable"
          },
          {// 行複製
              "key": "ctrl+b",
              "command": "editor.action.copyLinesDownAction",
              "when": "editorTextFocus && !editorReadonly"
          },
          {// pageupをカーソル2行上に移動
              "key": "pageup",
              "command": "cursorMove",
              "args": {
                  "to": "up",
                  "by": "wrappedLine",
                  "value": 2,
              },
              "when": "editorFocus"
          },
          {// 選択用
              "key": "shift+pageup",
              "command": "cursorMove",
              "args": {
                  "to": "up",
                  "by": "wrappedLine",
                  "value": 2,
                  "select": true
              },
              "when": "editorFocus"
          },
          {// pagedonwをカーソル2行下に移動
              "key": "pagedown",
              "command": "cursorMove",
              "args": {
                  "to": "down",
                  "by": "wrappedLine",
                  "value": 2,
              },
              "when": "editorFocus"
          },
          {// 選択用
              "key": "shift+pagedown",
              "command": "cursorMove",
              "args": {
                  "to": "down",
                  "by": "wrappedLine",
                  "value": 2,
                  "select": true
              },
              "when": "editorFocus"
          },
          {// 行削除
              "key": "ctrl+l",
              "command": "editor.action.deleteLines"
          },
          {// ターミナル切り替え
              "key": "ctrl+j",
              "command": "workbench.action.terminal.toggleTerminal",
              "when": "terminal.active"
          }
           {// ファイル内シンボル一覧
              "key": "ctrl+o",
              "command": "workbench.action.gotoSymbol",
              "when": "!accessibilityHelpIsShown && !accessibleViewIsShown"
          },
          {// シンボル検索 ctrl+Tと同等
              "key": "ctrl+f12",
              "command": "workbench.action.showAllSymbols"
          }
      ]
                  
  3. Change Key
    • CapsLock: F12
    • 変換: Ctrl
    • かな: Shift
  4. 検索(vscode)
    1. ctrl f   : 検索
    2. ctrl shift f : 全体検索
    3. f12    : 定義元にジャンプ
    4. shift f12  : 参照検索(ポップアップ)
    5. alt shift f12 : 参照検索(サイドバー)

0 件のコメント:

コメントを投稿