Skip to content

Instantly share code, notes, and snippets.

@inscapist
Last active June 11, 2023 14:08
Show Gist options
  • Save inscapist/a632a853e6e3f78c64f1b4c017217b30 to your computer and use it in GitHub Desktop.
Save inscapist/a632a853e6e3f78c64f1b4c017217b30 to your computer and use it in GitHub Desktop.
VSCode omni-navigation with ctrl-hjkl (window navigation), ctrl-n/p (list navigation), cmd-hjkl (tab navigation)
[
  // ===================================================
  // window navigation
  {
    "key": "ctrl+h",
    "command": "workbench.action.navigateLeft"
  },
  {
    "key": "ctrl+l",
    "command": "workbench.action.navigateRight"
  },
  {
    "key": "ctrl+k",
    "command": "workbench.action.navigateUp"
  },
  {
    "key": "ctrl+j",
    "command": "workbench.action.navigateDown"
  },
  
  // ===================================================
  // navigate tabs
  {
    "key": "cmd+l",
    "command": "-expandLineSelection",
    "when": "textInputFocus"
  },
  {
    "key": "cmd+h",
    "command": "workbench.action.previousEditor"
  },
  {
    "key": "cmd+l",
    "command": "workbench.action.nextEditor"
  },
  {
    "key": "cmd+-",
    "command": "-workbench.action.zoomOut"
  },
  
  // ===================================================
  // equivalent to :sp
  {
    "key": "cmd+-",
    "command": "workbench.action.splitEditorOrthogonal"
  },
  {
    "key": "cmd+k cmd+\\",
    "command": "-workbench.action.splitEditorOrthogonal"
  },
  
  // ===================================================
  // equivalent to :NerdTreeToggle and :treemacs/toggle
  {
    "key": "cmd+o cmd+p",
    "command": "workbench.view.explorer",
    "when": "!sideBarVisible || activeViewlet != 'workbench.view.explorer'"
  },
  {
    "key": "cmd+o cmd+p",
    "command": "workbench.action.toggleSidebarVisibility",
    "when": "sideBarVisible && activeViewlet == 'workbench.view.explorer'"
  },
  {
    "key": "cmd+o cmd+o",
    "command": "outline.focus"
  },
  {
    "key": "cmd+;",
    "command": "workbench.action.terminal.toggleTerminal"
  },
  
  // ===================================================
  // spacemacs and doom emacs user will recognize this
  {
    "key": "space space",
    "command": "workbench.action.quickOpen",
    "when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
  },
  {
    "key": "cmd+p",
    "command": "-workbench.action.quickOpen"
  },
  
  // ===================================================
  // ctrl n(next) and p(previous) already works, just adding jk as a personal preference
  {
    "key": "ctrl+j",
    "command": "workbench.action.quickOpenSelectNext",
    "when": "inQuickOpen"
  },
  {
    "key": "ctrl+k",
    "command": "workbench.action.quickOpenSelectPrevious",
    "when": "inQuickOpen"
  },
  
  // ===================================================
  // navigate search results
  {
    "key": "ctrl+n",
    "command": "search.action.focusNextSearchResult",
    "when": "hasSearchResult || inSearchEditor"
  },
  {
    "key": "ctrl+p",
    "command": "search.action.focusPreviousSearchResult",
    "when": "hasSearchResult || inSearchEditor"
  },
  {
    "key": "ctrl+backspace",
    "command": "-deleteLeft",
    "when": "textInputFocus"
  },
  {
    "key": "ctrl+backspace",
    "command": "search.action.clearSearchResults"
  },
  
  // ===================================================
  // terminal related keybindings
  {
    "key": "cmd+h",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "`," },
    "when": "terminalFocus"
  },
  {
    "key": "cmd+l",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "`." },
    "when": "terminalFocus"
  },
  {
    "key": "cmd+l",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "`." },
    "when": "terminalFocus"
  },
  {
    "key": "cmd+n",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "`n" },
    "when": "terminalFocus"
  },
  {
    "key": "cmd+w",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "`x" },
    "when": "terminalFocus"
  },
  {
    "key": "cmd+r",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "`e" },
    "when": "terminalFocus"
  },
  {
    "key": "cmd+k",
    "command": "workbench.action.terminal.sendSequence",
    "args": { "text": "`K" },
    "when": "terminalFocus"
  },
  {
    "key": "ctrl+l",
    "command": "workbench.action.terminal.clear",
    "when": "terminalFocus"
  },
  {
    "key": "ctrl+n",
    "command": "workbench.action.nextPanelView",
    "when": "panelFocus"
  },
  {
    "key": "ctrl+p",
    "command": "workbench.action.previousPanelView",
    "when": "panelFocus"
  }
]
{
"editor.suggestSelection": "first",
"workbench.colorTheme": "Gruvbox Dark Hard",
"editor.fontSize": 16,
"editor.fontFamily": "Iosevka",
"editor.fontLigatures": true,
"editor.formatOnSave": true,
"terminal.integrated.fontFamily": "Iosevka Nerd Font",
"terminal.integrated.fontSize": 15,
"terminal.integrated.lineHeight": 1.3,
"explorer.openEditors.visible": 0,
"workbench.activityBar.visible": false,
"workbench.iconTheme": "Monokai Pro Icons",
"files.exclude": {
"**/__pycache__": true,
"**/*.resx": true,
"**/*.xml": true
},
"vim.incsearch": true,
"vim.useSystemClipboard": true,
"vim.useCtrlKeys": true,
"vim.hlsearch": true,
"vim.enableNeovim": true,
"vim.neovimPath": "/usr/local/bin/nvim",
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["Z", "Z"],
"commands": [":wq"]
},
{
"before": ["S"],
"commands": [":w"]
},
{
"before": ["j"],
"after": ["g", "j"]
},
{
"before": ["J"],
"after": ["1", "5", "j"]
},
{
"before": ["K"],
"after": ["1", "5", "k"]
},
{
"before": ["k"],
"after": ["g", "k"]
},
{
"before": [":"],
"commands": ["workbench.action.showCommands"]
}
],
"window.zoomLevel": 0,
"editor.codeLens": false,
"extensions.autoUpdate": true,
"explorer.confirmDelete": false,
"editor.largeFileOptimizations": false,
"python.languageServer": "Microsoft",
"editor.cursorBlinking": "phase",
"javascript.updateImportsOnFileMove.enabled": "always",
"explorer.confirmDragAndDrop": false,
"python.insidersChannel": "weekly",
"workbench.statusBar.visible": true
}
@inscapist
Copy link
Author

My other dotfiles for emacs, vim, tmux, yabai

https://github.com/sagittaros/dotfiles

@johanhugg
Copy link

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment