diff --git a/iterm2/com.googlecode.iterm2.plist b/iterm2/com.googlecode.iterm2.plist index 4718cad..20703fc 100644 --- a/iterm2/com.googlecode.iterm2.plist +++ b/iterm2/com.googlecode.iterm2.plist @@ -1459,6 +1459,8 @@ kNextWindowPointerAction + Print In Black And White + SoundForEsc VisualIndicatorForEsc diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index cb60e37..b7d624a 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -5,6 +5,7 @@ "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" }, "bufferline.nvim": { "branch": "main", "commit": "5cc447cb2b463cb499c82eaeabbed4f5fa6a0a44" }, "catppuccin": { "branch": "main", "commit": "637d99e638bc6f1efedac582f6ccab08badac0c6" }, + "claudecode.nvim": { "branch": "main", "commit": "db91a0ac731a936c2d7e7c9ce34e6876cb99d061" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, diff --git a/nvim/lua/plugins/claude-code.lua b/nvim/lua/plugins/claude-code.lua new file mode 100644 index 0000000..ddd9bcc --- /dev/null +++ b/nvim/lua/plugins/claude-code.lua @@ -0,0 +1,51 @@ +--return { +-- "greggh/claude-code.nvim", +-- dependencies = { +-- "nvim-lua/plenary.nvim", -- Required for git operations +-- }, +-- config = function() +-- require("claude-code").setup({ +-- window = { +-- split_ratio = 0.3, -- Percentage of screen for the terminal window (height for horizontal, width for vertical splits) +-- position = "botright", -- Position of the window: "botright", "topleft", "vertical", "rightbelow vsplit", etc. +-- enter_insert = true, -- Whether to enter insert mode when opening Claude Code +-- hide_numbers = true, -- Hide line numbers in the terminal window +-- hide_signcolumn = true, -- Hide the sign column in the terminal window +-- }, +-- keymaps = { +-- toggle = { +-- normal = "cc", -- Normal mode keymap for toggling Claude Code, false to disable +-- terminal = "", -- Terminal mode keymap for toggling Claude Code, false to disable +-- variants = { +-- continue = "cC", -- Normal mode keymap for Claude Code with continue flag +-- verbose = "cV", -- Normal mode keymap for Claude Code with verbose flag +-- }, +-- }, +-- window_navigation = true, -- Enable window navigation keymaps () +-- scrolling = true, -- Enable scrolling keymaps () for page up/down +-- }, +-- }) +-- end, +--} + +return { + "coder/claudecode.nvim", + config = true, + keys = { + { "a", nil, desc = "AI/Claude Code" }, + { "ac", "ClaudeCode", desc = "Toggle Claude" }, + { "af", "ClaudeCodeFocus", desc = "Focus Claude" }, + { "ar", "ClaudeCode --resume", desc = "Resume Claude" }, + { "aC", "ClaudeCode --continue", desc = "Continue Claude" }, + { "as", "ClaudeCodeSend", mode = "v", desc = "Send to Claude" }, + { + "as", + "ClaudeCodeTreeAdd", + desc = "Add file", + ft = { "NvimTree", "neo-tree", "oil" }, + }, + -- Diff management + { "aa", "ClaudeCodeDiffAccept", desc = "Accept diff" }, + { "ad", "ClaudeCodeDiffDeny", desc = "Deny diff" }, + }, +} diff --git a/script/cursor-init.sh b/script/cursor-init.sh new file mode 100644 index 0000000..0c998ac --- /dev/null +++ b/script/cursor-init.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo 'Cursor config init' + +# init settings.json +src="$HOME/Library/Application Support/Cursor/User/settings.json" +if [ -f "$src" ]; then + mv "$src" "$src.bak" +fi +ln -s "$HOME/.dotfile/vscode/settings.json" "$src" + +# init keybindings.json +src="$HOME/Library/Application Support/Cursor/User/keybindings.json" +if [ -f "$src" ]; then + mv "$src" "$src.bak" +fi +ln -s "$HOME/.dotfile/vscode/keybindings.json" "$src" diff --git a/vscode/keybindings.json b/vscode/keybindings.json new file mode 100644 index 0000000..32a9365 --- /dev/null +++ b/vscode/keybindings.json @@ -0,0 +1,251 @@ +// 将键绑定放入此文件中以覆盖默认值 +[ + { + "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'" + } +] diff --git a/vscode/settings.json b/vscode/settings.json new file mode 100644 index 0000000..638ae4c --- /dev/null +++ b/vscode/settings.json @@ -0,0 +1,263 @@ +{ + "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 - 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": [""], + "commands": ["vspacecode.space"] + }, + { + "before": [","], + "commands": [ + "vspacecode.space", + { + "command": "whichkey.triggerKey", + "args": "m" + } + ] + } + ], + "vim.visualModeKeyBindingsNonRecursive": [ + { + "before": [""], + "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" + }, + "[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": ["--fast"], + "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": "tmux", + "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" + }, + "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": "ms-azuretools.vscode-docker" + }, + "[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" + } + ] +}