dotfiles/vs-code/user-keybindings.json

307 lines
8.5 KiB
JSON

// Place your key bindings in this file to override the defaults
[
// Remove undesired defaults
{
"key": "ctrl+\\",
"command": "-workbench.action.splitEditor"
},
{
"key": "ctrl+k ctrl+\\",
"command": "-workbench.action.splitEditorOrthogonal"
},
{
"key": "ctrl+k ctrl+\\",
"command": "-workbench.action.splitEditorLeft"
},
{
"key": "ctrl+k ctrl+\\",
"command": "-workbench.action.splitEditorUp"
},
{
"key": "ctrl+k ctrl+\\",
"command": "-workbench.action.splitEditorDown"
},
{
"key": "ctrl+k ctrl+\\",
"command": "-workbench.action.splitEditorRight"
},
{
"key": "ctrl+k ctrl+left",
"command": "-workbench.action.focusLeftGroup"
},
{
"key": "ctrl+k ctrl+right",
"command": "-workbench.action.focusRightGroup"
},
{
"key": "ctrl+k ctrl+up",
"command": "-workbench.action.focusAboveGroup"
},
{
"key": "ctrl+k ctrl+down",
"command": "-workbench.action.focusBelowGroup"
},
{
"key": "ctrl+shift+`",
"command": "-workbench.action.terminal.new",
"when": "terminalProcessSupported || terminalWebExtensionContributedProfile"
},
{
"key": "ctrl+t",
"command": "-workbench.action.showAllSymbols"
},
{
"key": "ctrl+j",
"command": "-workbench.action.togglePanel"
},
{
"key": "ctrl+`",
"command": "-workbench.action.terminal.toggleTerminal",
"when": "terminal.active"
},
{
"key": "ctrl+p",
"command": "-extension.vim_ctrl+p",
"when": "editorTextFocus && vim.active && vim.use<C-p> && !inDebugRepl || vim.active && vim.use<C-p> && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use<C-p> && !inDebugRepl && vim.mode == 'SearchInProgressMode'"
},
{
"key": "ctrl+h",
"command": "-extension.vim_ctrl+h",
"when": "editorTextFocus && vim.active && vim.use<C-h> && !inDebugRepl"
},
{
"key": "ctrl+l",
"command": "-extension.vim_navigateCtrlL",
"when": "editorTextFocus && vim.active && vim.use<C-l> && !inDebugRepl"
},
{
"key": "ctrl+p",
"command": "-workbench.action.quickOpen"
},
{
"key": "ctrl+e",
"command": "-workbench.action.quickOpen"
},
{
"key": "ctrl+f12",
"command": "-editor.action.revealDefinition",
"when": "editorHasDefinitionProvider && editorTextFocus && isWeb"
},
{
"key": "f12",
"command": "-editor.action.revealDefinition",
"when": "editorHasDefinitionProvider && editorTextFocus"
},
{
"key": "ctrl+shift+m",
"command": "-workbench.actions.view.problems",
"when": "workbench.panel.markers.view.active"
},
{
"key": "alt+left",
"command": "-workbench.action.navigateBack",
"when": "canNavigateBack"
},
{
"key": "alt+right",
"command": "-workbench.action.navigateForward",
"when": "canNavigateForward && editorTextFocus && vim.active"
},
// Editing
{
"key": "shift+k",
"command": "editor.action.showHover",
"when": "editorTextFocus && vim.active && vim.mode != 'Insert'"
},
{
"key": "escape",
"command": "workbench.action.closeSidebar",
"when": "sideBarVisible"
},
// Editor pane navigation and management
{
"key": "ctrl+k",
"command": "workbench.action.focusAboveGroup",
"when": "editorTextFocus && vim.active && !inDebugRepl"
},
{
"key": "ctrl+j",
"command": "workbench.action.focusBelowGroup",
"when": "editorTextFocus && vim.active && !inDebugRepl"
},
{
"key": "ctrl+h",
"command": "workbench.action.focusLeftGroup",
"when": "editorTextFocus && vim.active && !inDebugRepl"
},
{
"key": "ctrl+l",
"command": "workbench.action.focusRightGroup",
"when": "editorTextFocus && vim.active && !inDebugRepl"
},
{
"key": "ctrl+b shift+5",
"command": "workbench.action.newGroupRight",
"when": "editorTextFocus"
},
{
"key": "ctrl+b shift+'",
"command": "workbench.action.newGroupBelow",
"when": "editorTextFocus"
},
{
"key": "ctrl+b z",
"command": "workbench.action.toggleEditorWidths",
"when": "editorTextFocus"
},
// Terminal Tmux pane navigation and management
{
"key": "ctrl+t",
"command": "workbench.action.terminal.toggleTerminal",
"when": "terminal.active"
},
{
"key": "ctrl+shift+`",
"command": "workbench.action.toggleMaximizedPanel"
},
// These escape codes allow sending keyboard shortcuts to tmux
// when normally vs-code would not send any chorded keyboard shortcuts.
// It also is setup so that these keyboard shortcuts work in both the editor
// and the terminal, but have different commands.
// Resources:
// - https://code.visualstudio.com/docs/terminal/advanced#_custom-sequence-keybindings
// - https://stackoverflow.com/questions/61742559/need-vscode-sendsequence-keybindings-for-previous-command-next-command-move-to
// - https://gist.github.com/riipandi/2f304a1cbf7615a8f912473b5f4a7cc3
// - `showkey -a`
{
"key": "ctrl+b p",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u0070"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b n",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u006e"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b d",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u0064"
},
"when": "terminalFocus"
},
{
"key": "ctrl+k",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u001b[A"
},
"when": "terminalFocus"
},
{
"key": "ctrl+j",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u001b[B"
},
"when": "terminalFocus"
},
{
"key": "ctrl+h",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u001b[D"
},
"when": "terminalFocus"
},
{
"key": "ctrl+l",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u001b[C"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b shift+5",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u0025"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b shift+'",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u0022"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b ,",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u002c"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b shift+;",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u003a"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b c",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u0063"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b [",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u005b"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b z",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u007a"
},
"when": "terminalFocus"
},
{
"key": "ctrl+b g",
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "\u0002\u0067"
},
"when": "terminalFocus"
},
{
"key": "ctrl+o",
"command": "workbench.action.navigateBack",
"when": "canNavigateBack"
},
{
"key": "ctrl+i",
"command": "workbench.action.navigateForward",
"when": "canNavigateForward && editorTextFocus && vim.active"
}
]