Skip to content

Instantly share code, notes, and snippets.

@mttchpmn
Last active October 13, 2023 03:46
Show Gist options
  • Save mttchpmn/4905289afc013949f98e4db915743d42 to your computer and use it in GitHub Desktop.
Save mttchpmn/4905289afc013949f98e4db915743d42 to your computer and use it in GitHub Desktop.
Keyboard shortcuts for mac OS, VS Code, and Google Chrome

Keyboard Shortcuts

mac OS

Requires Amethyst window manager to be installed

Description Key Command(s)cc Handled By Defined in Notes
Move left a space (desktop) ctrl+left mac OS
Move right a space (desktop) ctrl+right mac OS
Launch spotlight cmd+space mac OS
Switch to next open application cmd+tab mac OS
Switch to prev open application cmd+tab+\ mac OS
Switch to next window in active app cmd+\ mac OS
Cycle to next window layout shift+opt+space Amethyst Amethyst Preferences Download Amethyst from https://ianyh.com/amethyst/
Switch focus to next window in layout shift+opt+k Amethyst Amethyst Preferences
Switch focus to prev window in layout shift+opt+j Amethyst Amethyst Preferences
Minimise window cmd+m mac OS
Close active window cmd+w mac OS
Quit active app cmd+q mac OS
Open preferences for active app cmd+, mac OS
Toggle dock cmd+opt+d mac OS
Lock computer cmd+ctrl+q mac OS

VS Code

Requires Vim extension to be installed

Description Key Command(s) Handled By Defined in Notes
Next editor tab cmd+shift+\], ctrl+opt+k mac OS, VS Code keybindings.json
Prev editor tab cmd+shift+\], cmd+shift+j mac OS, VS Code keybindings.json
Move right a pane ctrl+l VS Code keybindings.json
Move left a pane ctrl+h VS Code keybindings.json
Move down a pane ctrl+j VS Code keybindings.json
Move up a pane ctrl+k VS Code keybindings.json
New editor tab space+n VS Code settings.json Requires '' to be set as leader key
Close current tab space+x VS Code settings.json Requires '' to be set as leader key
Open file fuzzy finder cmd+p, space+o mac OS, VS Code settings.json Requires '' to be set as leader key
Open command pallette cmd+shift+p, space+p mac OS, VS Code settings.json Requires '' to be set as leader key
Save current file cmd+s, space+w mac OS, VS Code settings.json Requires '' to be set as leader key
Split editor vertically cmd+\, space+s mac OS, VS Code settings.json Requires '' to be set as leader key
Split editor horizontally VS Code settings.json
Toggle sidebar visibility cmd+b mac OS, VS Code settings.json
Launch integrated terminal ctrl+ ` mac OS, VS Code settings.json

settings.json

Add the below lines to your settings.json file. Cmd+shift+p > 'Preferences: Open settings (JSON)'

"vim.leader": "<space>",
  "vim.easymotion": true,
  "vim.incsearch": true,
  "vim.useSystemClipboard": true,
  "vim.useCtrlKeys": false,
  "vim.hlsearch": true,
  "vim.searchHighlightColor": "purple",
  "vim.highlightedyank.enable": true,
  "vim.highlightedyank.color": "purple",
  "vim.insertModeKeyBindings": [
    {
      "before": ["j", "j"],
      "after": ["<Esc>"]
    }
  ],
  "vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": ["<leader>", "p"],
      "commands": ["workbench.action.showCommands"]
    },
    {
      "before": ["<leader>", "w"],
      "commands": ["workbench.action.files.save"]
    },
    {
      "before": ["<leader>", "s"],
      "commands": ["workbench.action.splitEditor"]
    },
    {
      "before": ["<leader>", "x"],
      "commands": ["workbench.action.closeActiveEditor"]
    },
    {
      "before": ["<leader>", "n"],
      "commands": ["workbench.action.files.newUntitledFile"]
    },
    {
      "before": ["<leader>", "t"],
      "commands": ["workbench.action.toggleSidebarVisibility"]
    },
    {
      "before": ["<leader>", "o"],
      "commands": ["workbench.action.quickOpen"]
    }
  ],

keybindings.json

Add the below lines to your keybindings.json file. Cmd+shift+p > 'Preferences: Open keyboard shortcuts (JSON)'

[
  // Navigate between open panes with Ctr+hjkl
  {
    "key": "ctrl+h",
    "command": "workbench.action.focusLeftGroup",
    "when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
  },
  {
    "key": "ctrl+l",
    "command": "workbench.action.focusRightGroup",
    "when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
  },
  {
    "key": "ctrl+k",
    "command": "workbench.action.focusAboveGroup",
    "when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
  },
  {
    "key": "ctrl+j",
    "command": "workbench.action.focusBelowGroup",
    "when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
  },
  {
    "key": "ctrl+k",
    "command": "workbench.action.focusAboveGroup",
    "when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
  },
  {
    "key": "ctrl+j",
    "command": "workbench.action.focusBelowGroup",
    "when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
  },
  // Navigate between tabs with Ctrl+opt+jk
  {
    "key": "ctrl+alt+j",
    "command": "workbench.action.previousEditor",
    "when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
  },
  {
    "key": "ctrl+alt+k",
    "command": "workbench.action.nextEditor",
    "when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
  }
]

Google Chrome

Requires Smooth Key Scroll extension to be installed. (For smooth scrolling using arrow keys)

Description Key Command(s) Handled By Defined in Notes
New tab cmd+t Chrome
Reopen last closed tab cmd+shift+t Chrome
Move right a tab cmd+shift+\], cmd+opt+right, ctrl+opt+j mac OS, Chrome System Preferences Keyboard > shortcuts > app shortcuts > Google Chrome > 'Select Next Tab'
Move left a tab cmd+shift+\[, cmd+opt+left, ctrl+opt+k mac OS, Chrome System Preferences Keyboard > shortcuts > app shortcuts > Google Chrome > 'Select Previous Tab'
Focus address bar cmd+l Chrome
Close current tab cmd+w Chrome
Bookmark current page cmd+d Chrome
Toggle bookmarks bar cmd+shift+b Chrome
Open bookmarks manager cmd+opt+b Chrome
Find on page cmd+f Chrome
Move to next match cmd+g Chrome
Move to prev match cmd+shift+g Chrome
Toggle developer tools (inspect) cmd+opt+i Chrome
Toggle JS console cmd+opt+j Chrome
Reload page (ignore cache) cmd+shift+r Chrome
Scroll page down down arrow, space Chrome Install 'Smooth Key Scroll' from Chrome Webstore for smoother & faster scrolling
Scroll page up up arrow, shift+space Chrome
Move to next clickable link tab Chrome
Move to prev clickable link shift+tab Chrome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment