Skip to content

Commit

Permalink
Add gen-vscode-manual-config command and config
Browse files Browse the repository at this point in the history
At work, my VSCode config can only be edited through the VSCode GUI. In
order to version control it, check it in to homegit and add a small
Python program that merges common (shared by home and work) config with
work-specific config.

Relevant issues:
- gitpod-io/openvscode-server#199
- gitpod-io/openvscode-server#535
- microsoft/vscode#15909
  • Loading branch information
kerrick-js committed Feb 7, 2024
1 parent f1f6dbb commit 57fe046
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .config/vscode-manual-config/common.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"workbench.colorTheme": "Default Dark Modern",
"keyboard.dispatch": "keyCode",
"vim.vimrc.enable": true,
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
"vim.handleKeys": {
"<C-p>": false,
},
"vim.useSystemClipboard": true,
"files.autoSave": "onFocusChange",
"editor.autoClosingBrackets": "never",
"security.workspace.trust.untrustedFiles": "open",
"files.insertFinalNewline": true,
}
27 changes: 27 additions & 0 deletions bin/gen-vscode-manual-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python3
import json5
import os
from pathlib import Path


def main():
with open(
Path(os.environ["HOME"]) / ".config/vscode-manual-config/common.json5"
) as f:
common = json5.load(f)

try:
with open(
Path(os.environ["HOME"]) / ".config/vscode-manual-config/local.json5"
) as f:
local = json5.load(f)
except:
local = {}

merged = common | local

print(json5.dumps(merged, indent=4))


if __name__ == "__main__":
main()

0 comments on commit 57fe046

Please sign in to comment.