Skip to content

Instantly share code, notes, and snippets.

@soomtong
Last active May 25, 2025 05:32
Show Gist options
  • Save soomtong/f689959935e753aa38a266ce402d3a99 to your computer and use it in GitHub Desktop.
Save soomtong/f689959935e753aa38a266ce402d3a99 to your computer and use it in GitHub Desktop.
Cursor(or VSCode based) User keybindings
// Place your key bindings in this file to override the defaults
[
// panel navigation
{
"key": "escape",
"command": "workbench.action.focusActiveEditorGroup",
"when": "!editorFocus"
},
{
"key": "alt+a",
"command": "workbench.files.action.focusFilesExplorer",
"when": "editorFocus"
},
// tab navigation
{
"key": "ctrl+.",
"command": "workbench.action.nextEditor",
"when": "editorTextFocus && vim.active && !inDebugRepl && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "ctrl+,",
"command": "workbench.action.previousEditor",
"when": "editorTextFocus && vim.active && !inDebugRepl && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
// inline action like emacs
{
"key": "ctrl+a",
"command": "cursorHome",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Insert' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "ctrl+e",
"command": "cursorEnd",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Insert' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "ctrl+n",
"command": "cursorDown",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Insert' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "ctrl+p",
"command": "cursorUp",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Insert' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "ctrl+d",
"command": "deleteRight",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Insert' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "ctrl+k",
"command": "deleteAllRight",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Insert' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
// cursor navigate
{
"key": "ctrl+alt+j",
"command": "editor.action.wordHighlight.next",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Normal' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "ctrl+alt+k",
"command": "editor.action.wordHighlight.prev",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Normal' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
// change set navigate
{
"key": "ctrl+cmd+j",
"command": "workbench.action.editor.nextChange",
"when": "editorTextFocus && !textCompareEditorActive && quickDiffDecorationCount != '0'"
},
{
"key": "ctrl+cmd+k",
"command": "workbench.action.editor.previousChange",
"when": "editorTextFocus && !textCompareEditorActive && quickDiffDecorationCount != '0'"
},
{
"key": "ctrl+cmd+j",
"command": "workbench.action.compareEditor.nextChange",
"when": "textCompareEditorVisible"
},
{
"key": "ctrl+cmd+k",
"command": "workbench.action.compareEditor.previousChange",
"when": "textCompareEditorVisible"
},
// block moving & duplicating
{
"key": "shift+alt+j",
"command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+alt+k",
"command": "editor.action.moveLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "shift+cmd+d",
"command": "editor.action.duplicateSelection",
"when": "editorTextFocus"
},
// revert changes
{
"key": "alt+cmd+z",
"command": "git.revertSelectedRanges",
"when": "editorTextFocus && !operationInProgress && resourceScheme == 'file'"
},
// selections
{
"key": "ctrl+shift+a",
"command": "editor.action.toggleColumnSelection",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+j",
"command": "editor.action.insertCursorBelow",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+k",
"command": "editor.action.insertCursorAbove",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+l",
"command": "editor.action.smartSelect.expand",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+h",
"command": "editor.action.smartSelect.shrink",
"when": "editorTextFocus"
},
// bookmark
{
"key": "shift+m",
"command": "bookmarks.toggle",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Normal' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "shift+h",
"command": "bookmarks.jumpToPrevious",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Normal' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "shift+l",
"command": "bookmarks.jumpToNext",
"when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode == 'Normal' && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
// highlight
{
"key": "alt+l",
"command": "rainbow-highlighter.toggleHighlight",
"when": "editorTextFocus && !editorReadonly && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "shift+alt+l",
"command": "rainbow-highlighter.removeHighlight",
"when": "editorTextFocus && !editorReadonly && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
// completion
{
"key": "alt+/",
"command": "simpleAutocomplete.next"
},
// more custom
{
"key": "cmd+l",
"command": "-aichat.newchataction"
},
{
"key": "cmd+l",
"command": "expandLineSelection",
"when": "textInputFocus"
}
]
@soomtong
Copy link
Author

settings.json

    "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["z", "e"],
            "commands": ["editor.foldAllExcept"]
        },
        {
            "before": ["<leader>", "w"],
            "commands": ["workbench.action.focusPreviousGroup"]
        },
        {
            "before": ["<leader>", "f", "a"],
            "commands": ["workbench.files.action.showActiveFileInExplorer"]
        },
        {
            "before": ["<leader>", "f", "e"],
            "commands": ["workbench.view.explorer"]
        },
        {
            "before": ["<leader>", "f", "o"],
            "commands": ["workbench.view.scm"]
        },
        {
            "before": ["<leader>", "f", "g"],
            "commands": ["workbench.view.search"]
        },
        {
            "before": ["<leader>", "f", "t"],
            "commands": ["workbench.view.extensions"]
        }
    ],

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