fix: cursor config

This commit is contained in:
2025-12-02 16:23:42 +08:00
parent 5a78b07c51
commit 7f087b9e5f
4 changed files with 566 additions and 2 deletions
+271
View File
@@ -0,0 +1,271 @@
// 将键绑定放入此文件中以覆盖默认值
[
{
"key": "alt+cmd+left",
"command": "workbench.action.navigateBack"
},
{
"key": "alt+cmd+right",
"command": "workbench.action.navigateForward"
},
{
"key": "alt+cmd+l",
"command": "editor.action.formatSelection",
"when": "editorHasDocumentFormattingProvider && editorHasSelection && editorTextFocus && !editorReadonly"
},
{
"key": "cmd+k m",
"command": "-workbench.action.editor.changeLanguageMode",
"when": "!notebookEditorFocused"
},
{
"key": "ctrl+j",
"command": "selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion"
},
{
"key": "ctrl+n",
"command": "-selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion"
},
{
"key": "ctrl+k",
"command": "-deleteAllRight",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+k",
"command": "selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion"
},
{
"key": "ctrl+p",
"command": "-selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion"
},
{
"key": "cmd+i",
"command": "composerMode.agent"
},
{
"key": "space",
"command": "vspacecode.space",
"when": "activeEditorGroupEmpty && focusedView == '' && !whichkeyActive && !inputFocus"
},
{
"key": "space",
"command": "vspacecode.space",
"when": "sideBarFocus && !inputFocus && !whichkeyActive"
},
// {
// "key": "tab",
// "command": "extension.vim_tab",
// "when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert' && editorLangId != 'magit'"
// },
// {
// "key": "tab",
// "command": "-extension.vim_tab",
// "when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert'"
// },
{
"key": "x",
"command": "magit.discard-at-point",
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
},
{
"key": "k",
"command": "-magit.discard-at-point"
},
{
"key": "-",
"command": "magit.reverse-at-point",
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
},
{
"key": "v",
"command": "-magit.reverse-at-point"
},
{
"key": "shift+-",
"command": "magit.reverting",
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
},
{
"key": "shift+v",
"command": "-magit.reverting"
},
{
"key": "shift+o",
"command": "magit.resetting",
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
},
{
"key": "shift+x",
"command": "-magit.resetting"
},
{
"key": "x",
"command": "-magit.reset-mixed"
},
{
"key": "ctrl+u x",
"command": "-magit.reset-hard"
},
{
"key": "y",
"command": "-magit.show-refs"
},
{
"key": "y",
"command": "vspacecode.showMagitRefMenu",
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode == 'Normal'"
},
{
"key": "g",
"command": "-magit.refresh",
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
},
{
"key": "g",
"command": "vspacecode.showMagitRefreshMenu",
"when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
},
{
"key": "ctrl+j",
"command": "workbench.action.quickOpenSelectNext",
"when": "inQuickOpen"
},
{
"key": "ctrl+k",
"command": "workbench.action.quickOpenSelectPrevious",
"when": "inQuickOpen"
},
{
"key": "ctrl+j",
"command": "selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "ctrl+k",
"command": "selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "ctrl+l",
"command": "acceptSelectedSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "ctrl+j",
"command": "showNextParameterHint",
"when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
},
{
"key": "ctrl+k",
"command": "showPrevParameterHint",
"when": "editorFocus && parameterHintsMultipleSignatures && parameterHintsVisible"
},
{
"key": "ctrl+j",
"command": "selectNextCodeAction",
"when": "codeActionMenuVisible"
},
{
"key": "ctrl+k",
"command": "selectPrevCodeAction",
"when": "codeActionMenuVisible"
},
{
"key": "ctrl+l",
"command": "acceptSelectedCodeAction",
"when": "codeActionMenuVisible"
},
// Quick Navigation for file browser
{
"key": "ctrl+h",
"command": "file-browser.stepOut",
"when": "inFileBrowser"
},
{
"key": "ctrl+l",
"command": "file-browser.stepIn",
"when": "inFileBrowser"
},
{
"key": "ctrl+h",
"command": "workbench.action.navigateLeft",
"when": "!inQuickOpen && !suggestWidgetVisible && !parameterHintsVisible && !isInDiffEditor"
},
{
"key": "ctrl+j",
"command": "workbench.action.navigateDown",
"when": "!codeActionMenuVisible && !inQuickOpen && !suggestWidgetVisible && !parameterHintsVisible"
},
{
"key": "ctrl+k",
"command": "workbench.action.navigateUp",
"when": "!codeActionMenuVisible && !inQuickOpen && !suggestWidgetVisible && !parameterHintsVisible"
},
{
"key": "ctrl+l",
"command": "workbench.action.navigateRight",
"when": "!codeActionMenuVisible && !inQuickOpen && !suggestWidgetVisible && !parameterHintsVisible && !isInDiffEditor"
},
// Quick Navigation for diff view
{
"key": "ctrl+h",
"command": "workbench.action.compareEditor.focusSecondarySide",
"when": "isInDiffEditor && !isInDiffLeftEditor"
},
{
"key": "ctrl+h",
"command": "workbench.action.navigateLeft",
"when": "isInDiffEditor && isInDiffLeftEditor"
},
{
"key": "ctrl+l",
"command": "workbench.action.compareEditor.focusPrimarySide",
"when": "isInDiffEditor && isInDiffLeftEditor"
},
{
"key": "ctrl+l",
"command": "workbench.action.navigateRight",
"when": "isInDiffEditor && !isInDiffLeftEditor"
},
{
"key": "ctrl+l",
"command": "workbench.action.terminal.clear",
"when": "terminalFocus && terminalHasBeenCreated && !accessibilityModeEnabled || terminalFocus && terminalProcessSupported && !accessibilityModeEnabled || accessibilityModeEnabled && accessibleViewIsShown && terminalHasBeenCreated && accessibleViewCurrentProviderId == 'terminal' || accessibilityModeEnabled && accessibleViewIsShown && terminalProcessSupported && accessibleViewCurrentProviderId == 'terminal'"
},
{
"key": "cmd+k",
"command": "-workbench.action.terminal.clear",
"when": "terminalFocus && terminalHasBeenCreated && !accessibilityModeEnabled || terminalFocus && terminalProcessSupported && !accessibilityModeEnabled || accessibilityModeEnabled && accessibleViewIsShown && terminalHasBeenCreated && accessibleViewCurrentProviderId == 'terminal' || accessibilityModeEnabled && accessibleViewIsShown && terminalProcessSupported && accessibleViewCurrentProviderId == 'terminal'"
},
{
"key": "space",
"command": "vspacecode.space",
"when": "terminalFocus && terminalHasBeenCreated && !accessibilityModeEnabled || terminalFocus && terminalProcessSupported && !accessibilityModeEnabled || accessibilityModeEnabled && accessibleViewIsShown && terminalHasBeenCreated && accessibleViewCurrentProviderId == 'terminal' || accessibilityModeEnabled && accessibleViewIsShown && terminalProcessSupported && accessibleViewCurrentProviderId == 'terminal'"
},
{
"key": "-",
"command": "lineBreakInsert",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+o",
"command": "-lineBreakInsert",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+o",
"command": "workbench.action.navigateBack",
"when": "canNavigateBack"
},
{
"key": "ctrl+-",
"command": "-workbench.action.navigateBack",
"when": "canNavigateBack"
}
]
+273
View File
@@ -0,0 +1,273 @@
{
"editor.fontLigatures": true,
"editor.fontSize": 16,
"editor.renderControlCharacters": true,
"workbench.iconTheme": "Monokai Classic Icons",
"workbench.welcome.enabled": false,
"workbench.colorTheme": "Dracula Theme Soft",
"vim.overrideCopy": false,
"vim.enableNeovim": true,
"vim.neovimPath": "/usr/local/bin/nvim",
"vim.disableAnnoyingNeovimMessage": true,
// Vim easymotion is required for Jump menu - <SPC> j
"vim.easymotion": true,
// Use system clipboard for vim
"vim.useSystemClipboard": true,
// Trigger the main which key menu with in the active editor with vim
// This cannot be put into keybindings.json because it will
// create conflict with Vim.
// https://github.com/stevenguh/spacecode/issues/3
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["<space>"],
"commands": ["vspacecode.space"]
},
{
"before": [","],
"commands": [
"vspacecode.space",
{
"command": "whichkey.triggerKey",
"args": "m"
}
]
}
],
"vim.visualModeKeyBindingsNonRecursive": [
{
"before": ["<space>"],
"commands": ["vspacecode.space"]
},
{
"before": [","],
"commands": [
"vspacecode.space",
{
"command": "whichkey.triggerKey",
"args": "m"
}
]
},
{
"before": [">"],
"commands": ["editor.action.indentLines"]
},
{
"before": ["<"],
"commands": ["editor.action.outdentLines"]
}
],
"workbench.panel.location": "right",
"gitHistory.hideCommitViewExplorer": true,
"python.linting.pylintEnabled": false,
"python.pythonPath": "/usr/local/bin/python3",
"editor.wordWrap": "on",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"sync.gist": "3c4e02a02a0d110622006b8c8b058fa5",
"go.languageServerFlags": ["-rpc.trace"],
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.associations": {
"*.html": "html",
"*.json": "jsonc",
"NOTES.txt": "helm",
"Dockerfile": "dockerfile"
},
"[helm]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
// "editor.formatOnSave": false // alternatively, force it to leave you alone
},
"gitlens.codeLens.recentChange.enabled": false,
"gitlens.codeLens.authors.enabled": false,
"sync.forceUpload": true,
"gitlens.currentLine.enabled": false,
"emmet.triggerExpansionOnTab": true,
// "terminal.integrated.shell.osx": "/bin/zsh",
"editor.fontFamily": "Fira Code, Sarasa Fixed SC Nerd Font, Menlo, Monaco, 'Courier New', monospace",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"search.followSymlinks": false,
"go.autocompleteUnimportedPackages": true,
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"vscode-neovim.mouseSelectionStartVisualMode": true,
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--config=~/.dotfile/golang/golangci.yml"],
"go.liveErrors": {
"enabled": false,
"delay": 500
},
"python.languageServer": "Pylance",
"go.overwriteGoplsMiddleware": {},
"go.useLanguageServer": true,
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"editor.snippetSuggestions": "none",
"editor.defaultFormatter": "golang.go"
},
"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"gopls": {
"usePlaceholders": true,
"staticcheck": false
},
"go.testFlags": ["-v"],
"vscode-neovim.neovimExecutablePaths.darwin": "/usr/local/bin/nvim",
"go.buildOnSave": "off",
"vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC",
"vim.autoSwitchInputMethod.obtainIMCmd": "/usr/local/bin/im-select",
"vim.autoSwitchInputMethod.switchIMCmd": "/usr/local/bin/im-select {im}",
"vim.autoSwitchInputMethod.enable": true,
"editor.cursorStyle": "line",
"editor.insertSpaces": false,
"editor.lineNumbers": "on",
"editor.wordSeparators": "/\\()\"':,.;<>~!@#$%^&*|+=[]{}`?-",
"security.workspace.trust.untrustedFiles": "open",
"workbench.tree.indent": 4,
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"python.defaultInterpreterPath": "/usr/local/bin/python3",
"[python]": {
"editor.formatOnType": true,
"editor.defaultFormatter": "ms-python.python"
},
"[go][go.mod]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
}
},
"update.showReleaseNotes": false,
"terminal.integrated.defaultProfile.osx": "fish",
"extensions.experimental.affinity": {
"asvetliakov.vscode-neovim": 1
},
"makefile.configureOnOpen": false,
"python.terminal.activateEnvInCurrentTerminal": true,
"remote.SSH.enableAgentForwarding": false,
"remote.SSH.defaultForwardedPorts": [],
"remote.SSH.useLocalServer": false,
"remote.SSH.connectTimeout": 30,
"remote.SSH.remotePlatform": {
"box1": "linux",
"hx80": "linux"
},
"editor.formatOnSave": true,
"pylint.enabled": false,
"python.analysis.typeCheckingMode": "standard",
"python.analysis.packageIndexDepths": [
{
"name": "sklearn",
"depth": 2
},
{
"name": "matplotlib",
"depth": 2
},
{
"name": "scipy",
"depth": 2
},
{
"name": "django",
"depth": 2
},
{
"name": "flask",
"depth": 2
},
{
"name": "fastapi",
"depth": 2
}
],
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
// "[dockerfile]": {
// "editor.defaultFormatter": "foxundermoon.shell-format"
// },
"[ignore]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[properties]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"[proto3]": {
"editor.defaultFormatter": "zxh404.vscode-proto3"
},
"[dotenv]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"typescript.preferences.quoteStyle": "single",
"javascript.preferences.quoteStyle": "single",
"go.toolsManagement.autoUpdate": true,
"pretty-formatter.quoteConvert": "single",
"html.completion.attributeDefaultValue": "singlequotes",
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.jsxSingleQuote": true,
"go.buildFlags": ["-tags=wireinject"],
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.autoIndent": "advanced",
"diffEditor.ignoreTrimWhitespace": false,
"editor.defaultColorDecorators": "never"
},
"html.format.unformatted": "",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"notebook.defaultFormatter": "esbenp.prettier-vscode",
"workbench.activityBar.orientation": "vertical", // cursor test
"vspacecode.bindingOverrides": [
{
"keys": ["space"],
"name": "Space (Global Leader)",
"type": "bind",
"command": "vspacecode.space",
"when": "editorTextFocus || explorerViewletVisible || terminalFocus"
},
{
"keys": "w.t",
"name": "Toggle Terminal",
"type": "command",
"command": "workbench.action.terminal.toggleTerminal"
},
{
"keys": "w.w",
"name": "Toggle AI Sidebar",
"type": "command",
"command": "workbench.action.toggleAuxiliaryBar"
},
{
"keys": "w.e",
"name": "Focus First Editor Group",
"type": "command",
"command": "workbench.action.focusFirstEditorGroup"
}
],
"[java]": {
"editor.suggest.snippetsPreventQuickSuggestions": false
},
"git.confirmSync": false,
"editor.dropIntoEditor.preferences": [],
"whichkey.bindingOverrides": [],
"cursor.general.disableHttp2": true,
"remote.SSH.localServerDownload": "always"
}
+2 -2
View File
@@ -7,11 +7,11 @@ src="$HOME/Library/Application Support/Cursor/User/settings.json"
if [ -f "$src" ]; then if [ -f "$src" ]; then
mv "$src" "$src.bak" mv "$src" "$src.bak"
fi fi
ln -s "$HOME/.dotfile/vscode/settings.json" "$src" ln -s "$HOME/.dotfile/cursor/config/settings.json" "$src"
# init keybindings.json # init keybindings.json
src="$HOME/Library/Application Support/Cursor/User/keybindings.json" src="$HOME/Library/Application Support/Cursor/User/keybindings.json"
if [ -f "$src" ]; then if [ -f "$src" ]; then
mv "$src" "$src.bak" mv "$src" "$src.bak"
fi fi
ln -s "$HOME/.dotfile/vscode/keybindings.json" "$src" ln -s "$HOME/.dotfile/cursor/config/keybindings.json" "$src"
+20
View File
@@ -247,5 +247,25 @@
"key": "space", "key": "space",
"command": "vspacecode.space", "command": "vspacecode.space",
"when": "terminalFocus && terminalHasBeenCreated && !accessibilityModeEnabled || terminalFocus && terminalProcessSupported && !accessibilityModeEnabled || accessibilityModeEnabled && accessibleViewIsShown && terminalHasBeenCreated && accessibleViewCurrentProviderId == 'terminal' || accessibilityModeEnabled && accessibleViewIsShown && terminalProcessSupported && accessibleViewCurrentProviderId == 'terminal'" "when": "terminalFocus && terminalHasBeenCreated && !accessibilityModeEnabled || terminalFocus && terminalProcessSupported && !accessibilityModeEnabled || accessibilityModeEnabled && accessibleViewIsShown && terminalHasBeenCreated && accessibleViewCurrentProviderId == 'terminal' || accessibilityModeEnabled && accessibleViewIsShown && terminalProcessSupported && accessibleViewCurrentProviderId == 'terminal'"
},
{
"key": "-",
"command": "lineBreakInsert",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+o",
"command": "-lineBreakInsert",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+o",
"command": "workbench.action.navigateBack",
"when": "canNavigateBack"
},
{
"key": "ctrl+-",
"command": "-workbench.action.navigateBack",
"when": "canNavigateBack"
} }
] ]