Add vscode setup script and configs

master
Jordan Atwood 2 years ago
parent 98d86f6cfa
commit 8e8956128f
Signed by: nightfirecat
GPG Key ID: 615A619C2D73A6DF
  1. 3
      setup.sh
  2. 56
      vscode.sh
  3. 2
      vscode/extensions
  4. 47
      vscode/keybindings.json
  5. 34
      vscode/settings.json

@ -53,3 +53,6 @@ elif [ $remove -eq 0 ]; then
fi fi
done done
fi fi
# install vscode configs
source vscode.sh

@ -0,0 +1,56 @@
#!/usr/bin/env bash
set -e
###
### Install a base of vscode extensions I expect to have in all installations and install settings
### and keybindings config files.
###
# determine OS / vscode path & executable
case "$OSTYPE" in
linux-gnu*)
VSCODE_CONFIG_PATH="$HOME/.var/app/com.visualstudio.code/config/Code/User"
VSCODE_BINARY=(flatpak run com.visualstudio.code)
;;
darwin*)
VSCODE_CONFIG_PATH="$HOME/Library/Application Support/Code/User"
VSCODE_BINARY=('/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code')
;;
cygwin|msys|win32)
# TODO: implement this later
# windows
;;
*)
# unknown
echo 'Unknown OS, skipping vscode setup'
return
;;
esac
if [[ ! -d "$VSCODE_CONFIG_PATH" ]]; then
echo "Could not locate vscode config path (expected at '$VSCODE_CONFIG_PATH')"
return 1
elif ! type "${VSCODE_BINARY[0]}" >/dev/null 2>/dev/null; then
echo "Could not identify vscode binary (expected '${VSCODE_BINARY[*]}')"
return 2
fi
# install extensions
while read -r line; do
"${VSCODE_BINARY[@]}" --install-extension "$line"
done < vscode/extensions
# backup settings/keybinds files, then create symlinks
# TODO: do the same for snippets dir files
for file in settings.json keybindings.json; do
source="$( dirname "$(readlink -f "${BASH_SOURCE[0]}")" )/vscode/$file"
target="$VSCODE_CONFIG_PATH/$file"
if [[ -h "$target" ]] && [[ "$source" == "$(readlink -f "$target")" ]]; then
echo "Skipping '$source' -> '$target' link as it is already linked"
elif [[ -f "$target" ]]; then
mv "$target" "$target.bak"
echo "Backed up existing $file to $target.bak"
else
ln -sv "$source" "$target"
fi
done

@ -0,0 +1,2 @@
EditorConfig.EditorConfig
timonwong.shellcheck

@ -0,0 +1,47 @@
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+shift+tab",
"command": "-workbench.action.quickOpenLeastRecentlyUsedEditorInGroup",
"when": "!activeEditorGroupEmpty",
},
{
"key": "ctrl+shift+tab",
"command": "-workbench.action.quickOpenNavigatePreviousInEditorPicker",
"when": "inEditorsPicker && inQuickOpen",
},
{
"key": "ctrl+shift+tab",
"command": "workbench.action.previousEditor",
},
{
"key": "ctrl+tab",
"command": "-workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
"when": "!activeEditorGroupEmpty",
},
{
"key": "ctrl+tab",
"command": "-workbench.action.quickOpenNavigateNextInEditorPicker",
"when": "inEditorsPicker && inQuickOpen",
},
{
"key": "ctrl+tab",
"command": "workbench.action.nextEditor",
},
{
"key": "ctrl+shift+alt+,",
"command": "workbench.action.openSettingsJson",
},
{
"key": "ctrl+shift+cmd+,",
"command": "workbench.action.openSettingsJson",
},
{
"key": "ctrl+shift+alt+.",
"command": "workbench.action.openGlobalKeybindingsFile",
},
{
"key": "ctrl+shift+cmd+.",
"command": "workbench.action.openGlobalKeybindingsFile",
},
]

@ -0,0 +1,34 @@
{
// custom settings
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/usr/bin/flatpak-spawn",
"args": ["--host", "--env=TERM=xterm-256color", "/bin/bash"]
},
},
// settings managed by VS Code UI changes, etc.
"diffEditor.ignoreTrimWhitespace": false,
"editor.fontFamily": "'Fira Code', 'Droid Sans Mono', 'Courier New', Menlo, Monaco, Consolas, monospace, 'Droid Sans Fallback'",
"editor.fontLigatures": true,
"editor.insertSpaces": false,
"editor.minimap.maxColumn": 100,
"editor.renderWhitespace": "all",
"editor.tabSize": 4,
"explorer.autoReveal": false,
"explorer.confirmDragAndDrop": false,
"files.autoSave": "afterDelay",
"files.enableTrash": false,
"html.autoCreateQuotes": false,
"python.analysis.typeCheckingMode": "strict",
"workbench.startupEditor": "none",
"[markdown]": {
"editor.rulers": [120],
"editor.wordWrap": "off",
},
"[shellscript]": {
"editor.tabSize": 2,
"files.eol": "\n",
},
}
Loading…
Cancel
Save