Leo's dev blog

VSCode settings and keyboard shortcuts

Published on
Published on
/4 mins read/---

Launching code from the command line

In order to launch code from the command line, you need to add code to your PATH environment variable.

Open the VSCode's Command Palette (Cmd+Shift+P) and type shell command to open the Shell Command menu:

Shell command

Select Install 'code' command in PATH.

If you got permission denied error from your system like this:

EACCES: permission denied
unlink '/usr/local/bin/code'

Simply run Unintall 'code' command in PATH first, then run Install 'code' command in PATH again. That's should fix it.

Now try open a file or folder with code command:

$ code ~/.bash_profile
# or cd ./your-project && code .

The project/file should open in VSCode now.

VSCode settings

settings.json
{
  "editor.fontFamily": "JetBrains Mono, Monaco, 'Courier New', monospace",
  "prettier.useTabs": false,
  "editor.autoIndent": "full",
  "editor.tabSize": 2,
  "terminal.integrated.fontSize": 15,
  "editor.fontSize": 17,
  "git.autofetch": true,
  "javascript.updateImportsOnFileMove.enabled": "always",
  "editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?",
  "editor.suggest.snippetsPreventQuickSuggestions": false,
  "redhat.telemetry.enabled": false,
  "mdx-preview.preview.useWhiteBackground": true,
  "scss.validate": false,
  "turboConsoleLog.logMessagePrefix": "👉 -------->",
  "turboConsoleLog.insertEnclosingClass": false,
  "turboConsoleLog.insertEnclosingFunction": false,
  "turboConsoleLog.delimiterInsideMessage": "-",
  "debug.console.fontSize": 16,
  "markdown.preview.fontSize": 16,
  "editor.defaultFormatter": "dbaeumer.vscode-eslint",
  "typescript.updateImportsOnFileMove.enabled": "always",
  "turboConsoleLog.includeFileNameAndLineNum": false,
  "editor.inlineSuggest.enabled": true,
  "editor.bracketPairColorization.enabled": true,
  "editor.guides.bracketPairsHorizontal": false,
  "[shellscript]": {
    "editor.defaultFormatter": "foxundermoon.shell-format"
  },
  "[prisma]": {
    "editor.defaultFormatter": "Prisma.prisma"
  },
  "[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.unicodeHighlight.allowedCharacters": {
    "️": true
  },
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "editor.detectIndentation": false,
  "editor.insertSpaces": true,
  "editor.quickSuggestions": {
    "strings": true
  },
  "turboConsoleLog.quote": "'",
  "git.suggestSmartCommit": false,
  "workbench.iconTheme": "material-icon-theme",
  "editor.fontLigatures": true,
  "workbench.fontAliasing": "auto",
  "editor.fontWeight": "normal",
  "git.inputValidationSubjectLength": 100,
  "git.inputValidationLength": 100,
  "diffEditor.ignoreTrimWhitespace": false,
  "tailwindCSS.classAttributes": [
    "class",
    "className",
    "ngClass",
    "headerClass",
    "triggerClass",
    "cls",
    "wrapperClass",
    "containerClassName",
    ".*ClassName",
    ".*Class"
  ],
  "tailwindCSS.experimental.classRegex": [
    ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
    ["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
  ],
  "github.copilot.enable": {
    "*": false,
    "plaintext": true,
    "markdown": true,
    "scminput": false,
    "yaml": false
  },
  "files.associations": {
    "*.liquid": "liquid",
    "*.css": "tailwindcss"
  },
  "[liquid]": {
    "editor.formatOnSave": false,
    "editor.defaultFormatter": "Shopify.theme-check-vscode"
  },
  "files.autoSaveDelay": 100,
  "git.confirmSync": false,
  "tailwindCSS.includeLanguages": {
    "plaintext": "html"
  },
  "editor.formatOnSave": true,
  "[dotenv]": {
    "editor.defaultFormatter": "foxundermoon.shell-format"
  },
  "[svg]": {
    "editor.defaultFormatter": "jock.svg"
  },
  "workbench.preferredLightColorTheme": "Solarized Light",
  "[properties]": {
    "editor.defaultFormatter": "foxundermoon.shell-format"
  },
  "[ignore]": {
    "editor.defaultFormatter": "foxundermoon.shell-format"
  },
  "window.confirmBeforeClose": "keyboardOnly",
  "cSpell.userWords": [
    /*...*/
  ],
  "cSpell.enableFiletypes": ["schema.prisma"],
  "typescript.tsserver.log": "off",
  "window.autoDetectColorScheme": true,
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "workbench.colorTheme": "Solarized Light",
  "[tailwindcss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "github.copilot.editor.enableAutoCompletions": false,
  "github.copilot.editor.enableCodeActions": false,
  "supermaven.otherWarning": false,
  "git.openRepositoryInParentFolders": "never",
  "[markdown]": {
    "editor.defaultFormatter": "yzhang.markdown-all-in-one"
  },
  "editor.codeActionsOnSave": {},
  "[mdx]": {
    "editor.defaultFormatter": "unifiedjs.vscode-mdx"
  },
  "[plaintext]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "security.workspace.trust.untrustedFiles": "open"
}

Keyboard shortcuts:

keybindings.json
[
	{
		"key": "cmd+r",
		"command": "-workbench.action.reloadWindow",
		"when": "isDevelopment"
	},
	{
		"key": "cmd+k",
		"command": "workbench.action.terminal.clear",
		"when": "terminalFocus"
	},
	{
		"key": "ctrl+shift+r",
		"command": "-editor.action.refactor",
		"when": "editorHasCodeActionsProvider && editorTextFocus && !editorReadonly"
	},
	{
		"key": "cmd+r",
		"command": "editor.action.rename",
		"when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
	},
	{
		"key": "f2",
		"command": "-editor.action.rename",
		"when": "editorHasRenameProvider && editorTextFocus && !editorReadonly"
	},
	{
		"key": "shift+cmd+d",
		"command": "-workbench.view.debug",
		"when": "viewContainer.workbench.view.debug.enabled"
	},
	{
		"key": "shift+cmd+d",
		"command": "duplicate.execute"
	},
	{
		"key": "cmd+l",
		"command": "turboConsoleLog.displayLogMessage"
	},
	{
		"key": "ctrl+alt+l",
		"command": "-turboConsoleLog.displayLogMessage"
	},
	{
		"key": "cmd+j",
		"command": "-workbench.action.togglePanel"
	},
	{
		"key": "cmd+j",
		"command": "workbench.action.terminal.toggleTerminal",
		"when": "terminal.active"
	},
	{
		"key": "ctrl+`",
		"command": "-workbench.action.terminal.toggleTerminal",
		"when": "terminal.active"
	},
	{
		"key": "shift+cmd+l",
		"command": "turboConsoleLog.deleteAllLogMessages"
	},
	{
		"key": "shift+alt+d",
		"command": "-turboConsoleLog.deleteAllLogMessages"
	},
	{
		"key": "shift+cmd+g",
		"command": "workbench.view.scm",
		"when": "workbench.scm.active"
	},
	{
		"key": "ctrl+shift+g",
		"command": "-workbench.view.scm",
		"when": "workbench.scm.active"
	},
	{
		"key": "alt+p",
		"command": "git.push"
	},
	{
		"key": "shift+alt+p",
		"command": "git.pullFrom"
	},
	{
		"key": "cmd+u",
		"command": "references-view.findReferences",
		"when": "editorHasReferenceProvider"
	},
	{
		"key": "shift+alt+f12",
		"command": "-references-view.findReferences",
		"when": "editorHasReferenceProvider"
	},
	{
		"key": "cmd+u",
		"command": "-cursorUndo",
		"when": "textInputFocus"
	},
	{
		"key": "alt+tab",
		"command": "workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
		"when": "!activeEditorGroupEmpty"
	},
	{
		"key": "ctrl+tab",
		"command": "-workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",
		"when": "!activeEditorGroupEmpty"
	},
	{
		"key": "alt+tab",
		"command": "workbench.action.quickOpenNavigateNextInEditorPicker",
		"when": "inEditorsPicker && inQuickOpen"
	},
	{
		"key": "ctrl+tab",
		"command": "-workbench.action.quickOpenNavigateNextInEditorPicker",
		"when": "inEditorsPicker && inQuickOpen"
	},
	{
		"key": "shift+alt+tab",
		"command": "workbench.action.quickOpenLeastRecentlyUsedEditorInGroup",
		"when": "!activeEditorGroupEmpty"
	},
	{
		"key": "ctrl+shift+tab",
		"command": "-workbench.action.quickOpenLeastRecentlyUsedEditorInGroup",
		"when": "!activeEditorGroupEmpty"
	},
	{
		"key": "shift+alt+tab",
		"command": "workbench.action.quickOpenNavigatePreviousInEditorPicker",
		"when": "inEditorsPicker && inQuickOpen"
	},
	{
		"key": "ctrl+shift+tab",
		"command": "-workbench.action.quickOpenNavigatePreviousInEditorPicker",
		"when": "inEditorsPicker && inQuickOpen"
	},
	{
		"key": "shift+cmd+,",
		"command": "workbench.action.openSettings"
	},
	{
		"key": "cmd+,",
		"command": "-workbench.action.openSettings"
	},
	{
		"key": "cmd+q",
		"command": "-workbench.action.quit"
	},
	{
		"key": "cmd+o",
		"command": "-workbench.action.files.openFile",
		"when": "false"
	},
	{
		"key": "cmd+o",
		"command": "-workbench.action.files.openFolderViaWorkspace",
		"when": "!openFolderWorkspaceSupport && workbenchState == 'workspace'"
	},
	{
		"key": "cmd+o",
		"command": "-workbench.action.files.openFileFolder",
		"when": "isMacNative && openFolderWorkspaceSupport"
	},
	{
		"key": "cmd+o",
		"command": "-workbench.action.files.openLocalFileFolder",
		"when": "remoteFileDialogVisible"
	}
]

Happy coding!