Open1

VSCodeの設定

heptapodheptapod
setting.json
{
    // "http.proxy": "http://xxx.xxx.xxx.xxx:8080",
    // "http.proxyStrictSSL": false,
    "security.workspace.trust.untrustedFiles": "open",
    //
    // "[c]": {
    "files.encoding": "utf8", // shiftjis",
    "editor.fontFamily": "Source Han Code JP",
    "editor.renderLineHighlight": "all",
    "editor.detectIndentation": true, // false,
    "editor.insertSpaces": true, // false,
    "editor.tabSize": 4,
    "editor.guides.indentation": true,
    "editor.acceptSuggestionOnEnter": "off",
    "editor.minimap.enabled": false,
    // },
    "files.autoSave": "off", // "afterDelay",
    "files.eol": "auto", // "\r\n",
    "files.autoGuessEncoding": true,
    "files.associations": {
        "*.h": "c",
        "*.gitattributes":"gitattributes",
        "*.gitignore":"gitignore",
    },
    //
    // ファイルブラウザに表示しない
    "files.exclude": {
        // "**/*.obj": true,
    },
    //
    // ファイルブラウザには表示するが、検索から除外する
    "search.exclude": {
        // "**/tags": true,
        // "**/*.BAK": true,
        // "**/Temp/*": true,
    },
    // シンボリックリンクの先のディレクトリを検索しない
    "search.followSymlinks": false,

    //
    "C_Cpp.clang_format_sortIncludes": false,
    "C_Cpp.clang_format_style": "{ BasedOnStyle: LLVM, UseTab: Always, TabWidth: 4, IndentWidth: 4, IndentCaseLabels: true, BreakBeforeBraces: Stroustrup, AllowShortIfStatementsOnASingleLine: false, AlignConsecutiveDeclarations: false, AlignConsecutiveAssignments: true, AlignTrailingComments: false, SpacesBeforeTrailingComments: 4, ColumnLimit: 0, Language: Cpp}",
    "C_Cpp.errorSquiggles": "enabled",

    //
    "update.mode": "manual",
    "extensions.autoUpdate": false,
    "extensions.ignoreRecommendations": false,
    "telemetry.telemetryLevel": "off",
    //
    "editor.mouseWheelZoom": false,
    "editor.renderControlCharacters": true,
    "editor.renderWhitespace": "boundary",
    "editor.autoClosingBrackets": "never",
    "editor.copyWithSyntaxHighlighting": false,
    "editor.largeFileOptimizations": true, // false
    "editor.find.autoFindInSelection": "multiline",
    "diffEditor.ignoreTrimWhitespace": false,
    "diffEditor.renderSideBySide": true,
    //
    // workbench
    "workbench.startupEditor": "newUntitledFile",
    "workbench.colorTheme": "Visual Studio Light",
    "workbench.editor.enablePreview": true,
    "workbench.editor.enablePreviewFromQuickOpen": true,
    "workbench.editor.pinnedTabsOnSeparateRow": true,
    "workbench.settings.editor": "json",
    "explorer.openEditors.visible": 40,
    "breadcrumbs.enabled": true,
    "terminal.integrated.fontFamily": "Consolas",
    "terminal.integrated.copyOnSelection": true,
    "terminal.integrated.defaultProfile.windows": "Command Prompt",
    "terminal.integrated.profiles.windows": {
        "Git Bash": {
            "source": "Git Bash",
            "icon": "terminal-bash"
        },
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell",
            "args": [
                // "-noExit"
                // "chcp",
                // "65001"
            ],
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\System32\\cmd.exe",
            ],
            "args": [
                // "/k",
                // "chcp",
                // "932"
            ],
            "overrideName": true,
            "icon": "terminal-cmd"
        }
    },

    "window.title": "${dirty}${activeEditorLong}${separator}${rootName}",
    "window.commandCenter": false,
    //
    // json, json with comments
    "[json][jsonc]": {},
    
    // gitattributes, gitignore
    "[gitattributes][gitignore]": {
        "editor.tabSize": 2,
    },
    // c, csv
    "[c][csv]": {},
    //
    // text
    "[plaintext]": {
        "editor.tabSize": 2,
        "files.trimFinalNewlines": true,
        "files.insertFinalNewline": true,
        "editor.rulers": [
            80
        ],
    },
    //
    // python
    "[python]": {
        "editor.formatOnPaste": false,
        "editor.rulers": [
            80
        ],
    },
    //
    // markdown
    "[markdown]": {
        "editor.tabSize": 2,
        "editor.quickSuggestions": {
            "comments": "on",
            "strings": "on",
            "other": "on"
        },
        "editor.defaultFormatter": "yzhang.markdown-all-in-one"
    },
    //
    // html, css, JavaScript
    "[html][css][javascript]": {
        "editor.tabSize": 2,
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
	"html.format.enable": true,
	"html.format.indentInnerHtml": true,

	// emmet
	"emmet.triggerExpansionOnTab": true,
    "emmet.variables": {
        "lang": "ja",
    },

    // ファイル監視から除外する
    "files.watcherExclude": {
        "**/Pictures/**": true,
        "**/images/**": true,
        "**/Debug/**": true,
        "**/Release/**": true,
    },
    //
    // Extensions
    //
    //
    // python
    "terminal.integrated.env.windows": {
        "PSExecutionPolicyPreference": "RemoteSigned"
    },
    //
    // partialDiff
    "partialDiff.enableTelemetry": false,
    "partialDiff.hideCommandsOnContextMenu": true,
    //
    // Hex Editor
    "workbench.editorAssociations": {
        "*.bin": "hexEditor.hexedit",
    },
	//
    // Code Runner
    "code-runner.runInTerminal": false,
    "code-runner.executorMap": {
        "c": "cd /d \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Auxiliary/Build/\" && .\\vcvarsall.bat x86 && cd /d $dir && cl $fileName /source-charset:shift-jis && $fileNameWithoutExt.exe",
    },
    //
    // Paste Image
    "pasteImage.path": "${currentFileDir}/images",
    //
    // vsnotes
    "vsnotes.defaultNotePath": "C:/User/xxx/vsnote",
    "vsnotes.defaultNoteTitle": "{title}.{ext}",
    //
    // print
    "print.alternateBrowser.path": "C:/Program Files/Google/Chrome/Application/chrome.exe",
    "print.sourcecode.fontSize": "9pt",
    //
    // todo tree
    "todo-tree.general.tags": [
        "TODO:",
    ],
    //
    // git
    "git.enableSmartCommit": true,
    "git.openRepositoryInParentFolders": "always",
    //
    // gitlens
    "gitlens.views.repositories.files.layout": "list",
    "gitlens.views.commits.files.layout": "list",
    //
    // deepl
    "deepl.formality": "default",
    "deepl.tagHandling": "xml", // "off",
    "deepl.splitSentences": "nonewlines", // "1"
    "deepl.translationMode": "InsertLineBelow",
    //
    // indentRainbow
    "indentRainbow.includedLanguages": [
        "json",
        "jsonc",
        "css",
        "html",
        "javascript"
    ],
    //
    // テキスト校正くん
    "japanese-proofreading.textlint.かっこ類と隣接する文字の間のスペースの有無": false,
    "japanese-proofreading.textlint.ダッシュ(-)": false,
    "japanese-proofreading.textlint.丸かっこ()": false,
    "japanese-proofreading.textlint.アルファベット": false,
    "japanese-proofreading.textlint.算用数字": false,
    "japanese-proofreading.textlint.全角文字と半角文字の間": false,
    "japanese-proofreading.textlint.ハイフン(-)": false,
    "japanese-proofreading.textlint.外来語カタカナ表記": false,
}
keybinding.json
[
  // 前の値に置換 との競合回避
  {
    "key": "ctrl+shift+oem_period",
    "command": "-breadcrumbs.focusAndSelect",
    "when": "breadcrumbsPossible && breadcrumbsVisible"
  },
  // タスクの実行 との競合回避
  {
    "key": "ctrl+shift+c",
    "command": "-workbench.action.terminal.openNativeConsole",
    "when": "!terminalFocus"
  },
  {
    "key": "ctrl+shift+c",
    "command": "workbench.action.tasks.runTask"
  },
  // Markdown でのTabキーの競合回避
  {
    "key": "tab",
    "command": "-markdown.extension.onTabKey",
    "when": "editorTextFocus && !editorReadonly && !editorTabMovesFocus && !hasOtherSuggestions && !hasSnippetCompletions && !inSnippetMode && !suggestWidgetVisible && editorLangId == 'markdown'"
  },
  {
    "key": "shift+tab",
    "command": "-markdown.extension.onShiftTabKey",
    "when": "editorTextFocus && !editorReadonly && !editorTabMovesFocus && !hasOtherSuggestions && !hasSnippetCompletions && !inSnippetMode && !suggestWidgetVisible && editorLangId == 'markdown'"
  },
  // Markdown での下にコピーの競合回避
  { 
    "key": "shift+alt+down",
    "command": "-markdown.extension.onCopyLineDown",
    "when": "editorTextFocus && !editorReadonly && !suggestWidgetVisible && editorLangId == 'markdown'"
  },
  // Markdown でのトグルコードのトグル
  {
    "key": "ctrl+q",
    "command": "markdown.extension.editing.toggleCodeSpan"
    },
  // Markdown でのコードブロックのトグル
  {
    "key": "ctrl+alt+q",
    "command": "markdown.extension.editing.toggleCodeBlock"
  },
  // Markdown でのリストのトグル
  {
    "key": "ctrl+alt+l",
    "command": "markdown.extension.editing.toggleList"
  },
  // Markdown での行を上に挿入の競合回避
  {
    "key": "ctrl+shift+enter",
    "command": "-markdown-preview-enhanced.runAllCodeChunks",
    "when": "editorLangId == 'markdown'"
  },
  // Regex previewer との競合回避
  {
    "key": "ctrl+alt+m",
    "command": "-code-runner.stop"
  },
  // 大文字変換
  {
    "key": "ctrl+shift+u",
    "command": "editor.action.transformToUppercase",
    "when": "editorHasSelection && editorTextFocus"
  },
  // 小文字変換
  {
    "key": "ctrl+k ctrl+u",
    "command": "editor.action.transformToLowercase",
    "when": "editorHasSelection && editorTextFocus"
  },
  // Partical Diff
  {
    "key": "ctrl+1",
    "command": "extension.partialDiff.markSection1",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+2",
    "command": "extension.partialDiff.markSection2AndTakeDiff",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+3",
    "command": "extension.partialDiff.diffSelectionWithClipboard",
    "when": "editorTextFocus"
  },
  // 宣言へ移動
  {
    "key": "f11",
    "command": "-workbench.action.toggleFullScreen",
    "when": "!isIOS"
  },
  {
    "key": "f11",
    "command": "editor.action.revealDeclaration"
  },
  {
    "key": "f4",
    "command": "-references-view.next",
    "when": "reference-list.hasResult"
  },
  // トグルタブフォーカスモード
  {
    "key": "ctrl+m ctrl+m",
    "command": "editor.action.toggleTabFocusMode"
  },
  {
    "key": "ctrl+m",
    "command": "-editor.action.toggleTabFocusMode"
  },
  // マルチカーソル
  {
    "key": "ctrl+shift+down",
    "command": "cursorColumnSelectDown",
    "when": "textInputFocus"
  },
  {
    "key": "ctrl+shift+up",
    "command": "cursorColumnSelectUp",
    "when": "textInputFocus"
  },
  // ズームのリセット
  {
    "key": "ctrl+0",
    "command": "workbench.action.zoomReset"
  },
  {
    "key": "ctrl+numpad0",
    "command": "-workbench.action.zoomReset"
  },
  // [場所の編集]で次に進む
  {
    "key": "ctrl+alt+right",
    "command": "workbench.action.navigateForwardInEditLocations"
  },
  {
    "key": "ctrl+k ctrl+alt+right",
    "command": "workbench.action.moveEditorToNextGroup"
  },
  {
    "key": "ctrl+alt+right",
    "command": "-workbench.action.moveEditorToNextGroup"
  },
  // [場所の編集]で前に戻る
  {
    "key": "ctrl+alt+left",
    "command": "workbench.action.navigateBackInEditLocations"
  },
  {
    "key": "ctrl+k ctrl+alt+left",
    "command": "workbench.action.moveEditorToPreviousGroup"
  },
  {
    "key": "ctrl+alt+left",
    "command": "-workbench.action.moveEditorToPreviousGroup"
  },
  // グループ内の他のエディターを閉じる
  {
    "key": "ctrl+alt+w",
    "command": "workbench.action.closeOtherEditors"
  },
  {
    "key": "alt+o",
    "command": "C_Cpp.SwitchHeaderSource",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+k ctrl+shift+s",
    "command": "workbench.action.saveWorkspaceAs"
},
{
    "key": "shift+alt+c",
    "command": "copyFilePath"
},
{
    "key": "shift+alt+c",
    "command": "-copyFilePath",
    "when": "!editorFocus"
},
{
    "key": "ctrl+k ctrl+shift+c",
    "command": "copyRelativeFilePath"
},
{
    "key": "ctrl+k ctrl+shift+c",
    "command": "-copyRelativeFilePath",
    "when": "!editorFocus"
},
{
    "key": "ctrl+k ctrl+e",
    "command": "workbench.explorer.fileView.focus"
},
{
    "key": "ctrl+k t",
    "command": "terminal.focus"
},
{
    "key": "ctrl+pageup",
    "command": "workbench.action.terminal.resizePaneUp",
    "when": "terminalFocus || focusedView == 'workbench.panel.output' || focusedView == 'workbench.panel.repl.view' || focusedView == 'workbench.panel.markers.view'"
},
{
    "key": "ctrl+pagedown",
    "command": "workbench.action.terminal.resizePaneDown",
    "when": "terminalFocus || focusedView == 'workbench.panel.markers.view' || focusedView == 'workbench.panel.output' || focusedView == 'workbench.panel.repl.view'"
},
{
    "key": "ctrl+oem_plus ctrl+shift+oem_plus",
    "command": "-codealignment.alignbyequalsfromcaret",
    "when": "editorTextFocus"
},
{
    "key": "ctrl+oem_plus ctrl+shift+oem_7",
    "command": "-codealignment.alignbyquotefromcaret",
    "when": "editorTextFocus"
},
{
    "key": "ctrl+oem_plus ctrl+oem_plus",
    "command": "-codealignment.alignbyequals",
    "when": "editorTextFocus"
},
{
    "key": "ctrl+oem_plus ctrl+oem_period",
    "command": "-codealignment.alignbyperiod",
    "when": "editorTextFocus"
},
{
    "key": "ctrl+oem_plus ctrl+oem_7",
    "command": "-codealignment.alignbyquote",
    "when": "editorTextFocus"
},
{
    "key": "ctrl+oem_plus ctrl+space",
    "command": "-codealignment.alignbyspace",
    "when": "editorTextFocus"
},
{
    "key": "ctrl+k ctrl+left",
    "command": "workbench.action.focusFirstSideEditor"
},
{
    "key": "ctrl+k ctrl+right",
    "command": "workbench.action.focusOtherSideEditor"
},
{
    "key": "ctrl+alt+0",
    "command": "-sequence-tool.insertSequence",
    "when": "editorTextFocus"
}
]
global.code-snippets
{
    // 境界線
    "境界線": {
        "prefix": "border line 80",
        "body": [
            "--------------------------------------------------------------------------------",
        ],
        "description": "境界線",
    },
    // TODO
    "TODO:": {
        "prefix": "TODO:",
        "body": [
            "TODO: "
        ],
        "description": "TODO:"
    },
    // YY/MM/DD
    "YY/MM/DD": {
        "prefix": "yy/mm/dd",
        "body": [
            "${CURRENT_YEAR_SHORT}/${CURRENT_MONTH}/${CURRENT_DATE}",
        ],
        "description": "YY/MM/DD"
    },
    // 多重インクルード防止処理
    "#if !defined(XXXXX_H)": {
        "prefix": "#if !defined",
        "body": [
            "#if !defined(${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_H)",
            "#define ${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_H\t// 多重インクルード防止処理",
            "",
            "#endif\t/* ${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_H */",
            "",
        ],
        "description": "#if !defined(XXXXX_H)"
    },
    // ソースファイルヘッダコメント
    "Doxygen C Souce File header Comment": {
        "prefix": "Doxygen C Souce File header Comment",
        "body": [
            "/******************************************************************************/",
            "/*!",
            " * @file  ${TM_FILENAME}",
            " * @brief ${1:xxxxx}",
            " *",
            " * @author xxxxx",
            " * @date ${CURRENT_YEAR}/${CURRENT_MONTH}/${CURRENT_DATE}",
            " *",
            " * Copyright (C) ${CURRENT_YEAR} xxxxx Co.,Ltd. All Rights Reserved.",
            " */",
            "/******************************************************************************/",
        ],
        "description": "Doxygen C Souce File header Comment"
    },
    // 関数ヘッダコメント
    "Doxygen Function Header Comment": {
        "prefix": "Doxygen Function Header Comment",
        "body": [
            "/******************************************************************************",
            " * @brief ${1:xxxxx}",
            " * @param[in] ${2:なし}",
            " * @param[out] ${3:なし}",
            " * @retval ${4:なし}",
            " ******************************************************************************/",
        ],
        "description": "Doxygen Function Header Comment"
    },
    // 定義コメント
    "Define Comment": {
        "prefix": "Define Comment",
        "body": [
            "/*******************************************************************************",
            " * ${1|定数,型,変数,関数プロトタイプ宣言|}",
            " *******************************************************************************/",
            "",
        ],
        "description": "Define Comment"
    },
    // BYTE ACCESS
    "byte bit field": {
        "prefix": "byte bit field",
        "body": [
            "\tunion {",
            "\t\tunsigned char BYTE_ACCESS;",
            "\t\tstruct {",
            "\t\t} BIT;",
            "\t} _xxxxxx;",
            "",
        ],
        "description": "#byte bit field"
    },
    // 正規表現
    "関数": {
        "prefix": "regex of Function",
        "body": [
            "^[_a-zA-Z][^\\(=;:]*[\\t ]+\\**[_a-zA-Z][_a-zA-Z0-9]*\\([^;]*$",
        ],
        "description": "regex of Function",
    },
    // extern
    "extern": {
        "prefix": "regex of extern trouble",
        "body": [
            "^( |\\t)*extern(( |\\t)*volatile|( |\\t)*const)?( |\\t)+[^( |\\t)]+( |\\t)*;",
        ],
        "description": "regex of extern trouble",
    },
    // ダメ文字
    "ダメ文字": {
        "prefix": "regex of shift-jis trouble",
        "body": [
            "//.*[―ソЫⅨ噂浬欺圭構蚕十申曾箪貼能表暴予禄兔喀媾彌拿杤歃濬畚秉綵臀藹觸軆鐔饅鷭偆砡纊犾]$",
        ],
        "description": "regex of shift-jis trouble",
    },
}
task.json
{
	"version": "2.0.0",
	"tasks": [
        {
            "label": "選択したテキストのパスを explorer で開く",
            "type": "process",
            "command": "python",
            "presentation": {
                "echo": true
            },
            "args": [
                "C:/Users/xxx/explorer.py",
                "${selectedText}"
            ],
            "problemMatcher": []
        },
        {
            "label": "\\\\xxx.xxx.xxx.xxx を explorer で開く",
            "type": "shell",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "command": "python",
            "args": [
                "C:/Users/xxx/explorer.py",
                "\\xxx.xxx.xxx.xxx
            ],
            "presentation": {
                "echo": false,
                "reveal": "always",
                "focus": false,
                "panel": "shared"
            },
            "problemMatcher": []
        }
    ]
}
explorer.py
# システムパラメータを扱う
import sys
import subprocess

# コマンドライン引数を取得する
f = [infile for infile in sys.argv]
print(f[1])

command = ["net", "use",  f[1], r"/user:xxxxx", "xxxxx"]
subprocess.run(command, shell=True)

command = ["explorer", f[1]]
subprocess.run(command, shell=True)