Skip to content

Instantly share code, notes, and snippets.

@sam9291
Last active May 25, 2024 16:16
Show Gist options
  • Save sam9291/800fbd0d64b517ae87de187b8bfd5d30 to your computer and use it in GitHub Desktop.
Save sam9291/800fbd0d64b517ae87de187b8bfd5d30 to your computer and use it in GitHub Desktop.
VsCode Vim settings
{
"vim.smartRelativeLine": true,
"vim.leader": "<Space>",
"vim.hlsearch": true,
"vim.normalModeKeyBindingsNonRecursive": [
// NAVIGATION
// switch b/w buffers
{ "before": ["<S-h>"], "commands": [":bprevious"] },
{ "before": ["<S-l>"], "commands": [":bnext"] },
// splits
{ "before": ["leader", "v"], "commands": [":vsplit"] },
{ "before": ["leader", "s"], "commands": [":split"] },
// panes
{
"before": ["<C-h>"],
"commands": ["workbench.action.focusLeftGroup"]
},
{
"before": ["<C-j>"],
"commands": ["workbench.action.focusBelowGroup"]
},
{
"before": ["<C-k>"],
"commands": ["workbench.action.focusAboveGroup"]
},
{
"before": ["<C-l>"],
"commands": ["workbench.action.focusRightGroup"]
},
// NICE TO HAVE
{ "before": ["leader", "w"], "commands": [":w!"] },
{ "before": ["leader", "q"], "commands": [":q!"] },
{ "before": ["leader", "x"], "commands": [":x!"] },
{
"before": ["[", "d"],
"commands": ["editor.action.marker.prev"]
},
{
"before": ["]", "d"],
"commands": ["editor.action.marker.next"]
},
{ "before": ["leader", "f", "f"], "commands": ["workbench.action.quickOpen"] },
{ "before": ["leader", "f", "m"], "commands": ["editor.action.formatDocument"] },
{ "before": ["leader", "r"], "commands": ["editor.action.rename"] },
{
"before": ["K"],
"commands": ["editor.action.showDefinitionPreviewHover"]
},
{
"before": ["g", "u"],
"commands": ["editor.action.goToReferences"]
},
{
"before": ["g", "i"],
"commands": ["editor.action.goToImplementation"]
},
{ "before": ["Y"], "commands": ["editor.action.clipboardCopyAction"] },
{ "before": ["g", "c", "c"], "commands": ["editor.action.commentLine"] },
{ "before": ["leader", "x", "x"], "commands": ["workbench.actions.view.problems"] },
{ "before": ["<Esc>"], "commands": [":nohlsearch"] },
{ "before": ["<C-f>"], "commands": ["workbench.view.explorer"] }
],
"vim.insertModeKeyBindings": [
{ "before": ["j", "j"], "after": ["<Esc>"] }
],
"vim.visualModeKeyBindings": [
// Stay in visual mode while indenting
{ "before": ["<"], "commands": ["editor.action.outdentLines"] },
{ "before": [">"], "commands": ["editor.action.indentLines"] },
// Move selected lines while staying in visual mode
{ "before": ["J"], "commands": ["editor.action.moveLinesDownAction"] },
{ "before": ["K"], "commands": ["editor.action.moveLinesUpAction"] },
// toggle comment selection
{ "before": ["g", "c"], "commands": ["editor.action.commentLine"] },
{ "before": ["Y"], "commands": ["editor.action.clipboardCopyAction"] }
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment