diff --git a/.gitignore b/.gitignore index 29e966f..7dc9c4f 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,5 @@ tools/nushell/ .venv/ platforms/win/komorebi/applications.json + +gitconfig diff --git a/.vscode/settings.json b/.vscode/settings.json index acd5456..a719ff3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,6 +11,7 @@ "pip.conf": "python-misc", "*.kdl": "json", "gitconfig": "git", + "gitconfig.example": "git", "nvim/init.lua": "vim", "markdownlint.json": "markdownlint", "wslconfig": "settings", diff --git a/bootstrap/set_symlink_win.ps1 b/bootstrap/set_symlink_win.ps1 index 99e0293..cc19bde 100644 --- a/bootstrap/set_symlink_win.ps1 +++ b/bootstrap/set_symlink_win.ps1 @@ -2,30 +2,30 @@ # Date: 2024-12-01 # Author: js0ny # Set symlinks for dotfiles on Windows -# 在 Windows 上设置 dotfiles 的符号链接 +# 在 Windows 上设置 配置文件的符号链接 -$DOTFILES = Join-Path $env:UserProfile ".dotfiles" +$DOTFILES = Join-Path $Env:UserProfile ".dotfiles" $BASE_COMMON = Join-Path $DOTFILES "common" $BASE_TOOLS = Join-Path $DOTFILES "tools" $BASE_WIN = Join-Path $DOTFILES "platforms" "win" $linkDots = @{ - "$BASE_WIN\wslconfig" = "$env:UserProfile\.wslconfig" + "$BASE_WIN\wslconfig" = "$Env:UserProfile\.wslconfig" "$BASE_WIN\neovide.toml" = "$Env:AppData\neovide\config.toml" "$BASE_WIN\vsvimrc" = "$Env:Vim\.vsvimrc" - "$BASE_WIN\komorebi" = "$env:KOMOREBI_CONFIG_HOME" - "$BASE_COMMON\condarc.yaml" = "$env:XDG_CONFIG_HOME\conda\.condarc" - "$BASE_COMMON\gitconfig" = "$env:UserProfile\.gitconfig" - "$BASE_COMMON\glow.yaml" = "$env:AppData\glow\glow.yml" - "$BASE_COMMON\haskeline" = "$env:UserProfile\.haskeline" - "$BASE_COMMON\ideavimrc" = "$env:XDG_CONFIG_HOME\ideavim\ideavimrc" - "$BASE_COMMON\lesskey" = "$env:LessKeyIn" - "$BASE_COMMON\npmrc" = "$env:NPM_CONFIG_USERCONFIG" - "$BASE_COMMON\NuGet.Config" = "$env:AppData\NuGet\NuGet.Config" - "$BASE_COMMON\obsidian.vimrc" = "$env:UserProfile\Obsidian\.obsidian.vimrc" - "$BASE_COMMON\pip.conf" = "$env:AppData\pip\pip.ini" - "$BASE_COMMON\vimrc" = "$env:Vim\_vimrc" - "$BASE_TOOLS\ipython" = "$env:IPYTHONDIR" - "$BASE_TOOLS\nvim" = "$env:XDG_CONFIG_HOME\nvim" + "$BASE_WIN\komorebi" = "$Env:KOMOREBI_CONFIG_HOME" + "$BASE_COMMON\condarc.yaml" = "$Env:XDG_CONFIG_HOME\conda\.condarc" + "$BASE_COMMON\gitconfig" = "$Env:UserProfile\.gitconfig" + "$BASE_COMMON\glow.yaml" = "$Env:AppData\glow\glow.yml" + "$BASE_COMMON\haskeline" = "$Env:UserProfile\.haskeline" + "$BASE_COMMON\ideavimrc" = "$Env:XDG_CONFIG_HOME\ideavim\ideavimrc" + "$BASE_COMMON\lesskey" = "$Env:LessKeyIn" + "$BASE_COMMON\npmrc" = "$Env:NPM_CONFIG_USERCONFIG" + "$BASE_COMMON\NuGet.Config" = "$Env:AppData\NuGet\NuGet.Config" + "$BASE_COMMON\obsidian.vimrc" = "$Env:UserProfile\Obsidian\.obsidian.vimrc" + "$BASE_COMMON\pip.conf" = "$Env:AppData\pip\pip.ini" + "$BASE_COMMON\vimrc" = "$Env:Vim\_vimrc" + "$BASE_TOOLS\ipython" = "$Env:IPYTHONDIR" + "$BASE_TOOLS\nvim" = "$Env:XDG_CONFIG_HOME\nvim" } # TODO: Auto create directories @@ -35,4 +35,4 @@ foreach ($target in $linkDots.Keys) { New-Item -ItemType SymbolicLink -Target $target -Path $path -Force } -New-Item -ItemType SymbolicLink -Target "$BASE_WIN\Microsoft.PowerShell_profile.ps1" -Path "$env:UserProfile\Documents\PowerShell\Microsoft.PowerShell_profile.ps1" -Force +New-Item -ItemType SymbolicLink -Target "$BASE_WIN\Microsoft.PowerShell_profile.ps1" -Path "$Env:UserProfile\Documents\PowerShell\Microsoft.PowerShell_profile.ps1" -Force diff --git a/common/ideavimrc b/common/ideavimrc index e61739b..789945b 100644 --- a/common/ideavimrc +++ b/common/ideavimrc @@ -1,6 +1,6 @@ "$XDG_CONFIG_HOME/ideavim/ideavimrc " New-Item -ItemType SymbolicLink -Path ~\.ideavimrc -Target $DOTFILES\.config\ideavim\ideavimrc.vimrc -" ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc +" ln -sf $DOTFILES/.config/ideavim/ideavimrc.vimrc $XDG_CONFIG_HOME/ideavim/ideavimrc """ Basic Configs """ let mapleader = " " " set to @@ -15,7 +15,7 @@ noremap L I " ne[k]st noremap k n noremap K N -" [j]ump +" [j]ump noremap j e noremap J E @@ -146,6 +146,7 @@ nnoremap rG :action Generate """ Handling Ctrls """ +sethandler i:ide sethandler n-v:vim i:ide sethandler a:ide -sethandler > a:ide \ No newline at end of file +sethandler > a:ide diff --git a/platforms/win/Microsoft.PowerShell_profile.ps1 b/platforms/win/Microsoft.PowerShell_profile.ps1 index 2b0ac16..05b468a 100644 --- a/platforms/win/Microsoft.PowerShell_profile.ps1 +++ b/platforms/win/Microsoft.PowerShell_profile.ps1 @@ -72,3 +72,5 @@ ${function:wini} = { winget install $args } ${function:winr} = { winget uninstall $args } ${function:wins} = { winget search $args } ${function:winu} = { winget upgrade $args } + +${function:killp} = {ps | ? ProcessName -like $args | kill -Force} diff --git a/platforms/win/ahk/main.ahk b/platforms/win/ahk/main.ahk index 519a77d..f02aa26 100644 --- a/platforms/win/ahk/main.ahk +++ b/platforms/win/ahk/main.ahk @@ -1,33 +1,142 @@ #Requires AutoHotkey v2.0 -; #b:: -; Run '"C:\Program Files\Zotero\zotero.exe"' -; return - -; #f:: -; Run '"C:\Program Files\GPSoftware\Directory Opus\dopus.exe"' -; return - -; #q:: -; Send '!{F4}' -; return - -; #r:: -; Run '"C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.21.3231.0_x64__8wekyb3d8bbwe\wt.exe"' -; return - #h:: -Send '{Left}' -return +{ + Send("{Left}") +} #n:: -Send '{Down}' -return +{ + Send("{Down}") +} #e:: -Send '{Up}' -return +{ + Send("{Up}") +} #i:: -Send '{Right}' -return +{ + Send("{Right}") +} + +{ + Send("{Home}") +} +#a:: ; Vim-like navigation: Append +{ + Send("{End}") +} + +#q:: ; Simulate cmd+q in macOS +{ + Send("!{F4}") +} + +; 定义一个全局状态变量,标记是否触发了组合键 +global CapsLockState := false + +; 当 CapsLock 作为修饰键与其他键一起使用时 +CapsLock & s:: { + global CapsLockState + CapsLockState := true + Run("ShareX.exe -RectangleRegion") +} + +; 单独按下 CapsLock 时,发送 Esc +CapsLock:: { + global CapsLockState + ; 如果之前未使用组合键,则发送 Esc + if not CapsLockState { + Send("{Esc}") + } + CapsLockState := false ; 重置状态 +} + +; 释放 CapsLock 时重置状态 +*CapsLock Up:: { + global CapsLockState + CapsLockState := false +} + +#HotIf WinActive('ahk_exe' 'QQ.exe') +^n:: +{ + Send("^{Down}") +} +^h:: +{ + Send("^{Left}") +} +^i:: +{ + Send("^{Enter}") +} +^e:: +{ + Send("^{Up}") +} +#HotIf WinActive('ahk_exe' 'Weixin.exe') +^n:: +{ + Send("{Down}") +} +^e:: +{ + Send("{Up}") +} +#HotIf WinActive('ahk_exe' 'Discord.exe') +^n:: +{ + Send("^!{Down}") +} +^e:: +{ + Send("^!{Up}") +} + +#HotIf WinActive('ahk_exe' 'olk.exe') +^n:: +{ + Send("{Down}") +} +^+n:: +{ + Send("^.") +} +^+e:: +{ + Send("^,") +} +^e:: +{ + Send("{Up}") +} +#HotIf WinActive('ahk_exe' 'SumatraPDF.exe') +^\:: +{ + Send("{F12}") +} +#HotIf WinActive('ahk_exe' 'Flow.Launcher.exe') +^a:: +{ + Send("{End}") +} +^+a:: +{ + Send("^a") +} +^l:: +{ + Send("{Home}") +} +^+BackSpace:: +{ + Send("^a{Backspace}") +} +#HotIf WinActive('ahk_exe' 'Obsidian.exe') +^e:: +{ + Send("^p") +} +#HotIf \ No newline at end of file diff --git a/tools/browser/surfingkeys.js b/tools/browser/surfingkeys.js index e0a7bbd..d778b0a 100644 --- a/tools/browser/surfingkeys.js +++ b/tools/browser/surfingkeys.js @@ -1,6 +1,6 @@ // Paste this into surfingkeys advanced settings // or use: -// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/browser/surfingkeys.js +// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/tools/browser/surfingkeys.js // TODO: Visual Mode // #region Example diff --git a/tools/obsidian/obsidian.vimrc b/tools/obsidian/obsidian.vimrc index 09c7427..db4a0cc 100644 --- a/tools/obsidian/obsidian.vimrc +++ b/tools/obsidian/obsidian.vimrc @@ -1,9 +1,9 @@ " Put this in OBSIDIAN_VAULT/.obsidian.vimrc set clipboard=unnamed " Sync with System Clipboard -" Word wrap -noremap n gj -noremap e gk +" Colemak vim-like +noremap n j +noremap e k noremap i l " Similar position to i @@ -31,11 +31,21 @@ vnoremap * :addbold " Add bold to selection vnoremap _ :additalic " Add italic to selection vnoremap = :addhighlight " Add highlight to selection +""" Commands +exmap write editor:save-file +exmap w editor:save-file +exmap q workspace:close-tab-group + exmap prevtab obcommand workspace:previous-tab exmap nexttab obcommand workspace:next-tab nnoremap H :prevtab nnoremap I :nexttab +exmap prevhist obcommand app:go-back +exmap nexthist obcommand app:go-forward +nnoremap gh :prevhist +nnoremap gi :nexthist + exmap reload :source .obsidian.vimrc unmap @@ -48,12 +58,54 @@ map - :hsplit exmap chat obcommand obsidian-custom-frames:open-custom-frames-chatgpt map ai :chat -exmap omnisearch obcommand omnisearch:show-modal -map :omnisearch -exmap command-palette obcommand command-palette:open -map : :command-palette """ g-commands exmap tsource obcommand editor:toggle-source +exmap tpreview obcommand markdown:toggle-preview nnoremap gs :tsource +nnoremap gp :tpreview + +exmap wl obcommand editor:focus-left +exmap wr obcommand editor:focus-right +exmap wt obcommand editor:focus-top +exmap wb obcommand editor:focus-bottom + +map h :wl +map i :wr +map n :wb +map e :wt + +exmap FoldToggle obcommand editor:toggle-fold +exmap FoldLess obcommand editor:fold-less +exmap FoldMore obcommand editor:fold-more +exmap FoldAll obcommand editor:fold-all +exmap UnfoldAll obcommand editor:unfold-all +nnoremap za :FoldToggle +nnoremap zr :FoldLess +nnoremap zm :FoldMore +nnoremap zM :FoldAll +nnoremap zR :UnfoldAll + +exmap switchany obcommand darlal-switcher-plus:switcher-plus:open +exmap switchcmd obcommand darlal-switcher-plus:switcher-plus:open-commands +exmap switchrecent obcommand darlal-switcher-plus:switcher-plus:open-related-items +map :switchany +map : :switchcmd +map fr :switchrecent + +" b : +buffer +exmap bd obcommand +exmap DeleteOthers obcommand workspace:close-others +map bd :bd +map bX :DeleteOthers + +" m : +major/markdown +exmap addCallout obcommand editor:insert-callout +map mb :addbold +map mi :additalic +map mc :addcode +map md :adddel +map mh :addhighlight +map mp :tpreview +map mo :addCallout diff --git a/tools/vscode/keybindings.json b/tools/vscode/keybindings.json index 963648f..77fd805 100644 --- a/tools/vscode/keybindings.json +++ b/tools/vscode/keybindings.json @@ -1,487 +1,487 @@ // Place your key bindings in this file to override the defaultsauto[] [ - // #region quickOpen (Telescope) - { // Telescope emulator - "key": "space space", - "command": "workbench.action.quickOpen", - "when": "!editorFocus && !inputFocus" - }, - { - "key": "ctrl+p", - "command": "workbench.action.quickOpen" - }, - { - "key": "ctrl+e", - "command": "workbench.action.quickOpenNavigatePrevious", - "when": "inQuickOpen" - }, - { - "key": "ctrl+n", - "command": "workbench.action.quickOpenNavigateNext", - "when": "inQuickOpen" - }, - { - "key": "ctrl+[", - "command": "workbench.action.closeQuickOpen", - "when": "inQuickOpen" - }, - // #endregion - // #region plugin: code runner - { - "key": "ctrl+alt+n", - "command": "-code-runner.run" - }, - // #endregion - // #region Comment and semicolons - { - "key": "ctrl+oem_1", // ctrl+; - "command": "extension.insertSemicolon", - "when": "editorTextFocus" - }, - { // change to toggle comment - "key": "ctrl+oem_2", // ctrl+/; - "command": "-extension.insertSemicolon", - "when": "editorTextFocus" - }, - { - "key": "ctrl+shift+oem_1", - "command": "extension.insertSemicolonWithNewLine", - "when": "editorTextFocus" - }, - { - "key": "ctrl+shift+oem_2", - "command": "-extension.insertSemicolonWithNewLine", - "when": "editorTextFocus" - }, - { - "key": "ctrl+shift+oem_2", - "command": "github.copilot.acceptCursorPanelSolution", - "when": "github.copilot.activated && github.copilot.panelVisible" - }, - { - "key": "ctrl+oem_2", - "command": "-github.copilot.acceptCursorPanelSolution", - "when": "github.copilot.activated && github.copilot.panelVisible" - }, - // #endregion - { - "key": "f9", - "command": "csdevkit.debug.noDebugFileLaunch" - }, - { - "key": "ctrl+h", - "command": "-editor.action.startFindReplaceAction", - "when": "editorFocus || editorIsOpen" - }, - { - "key": "ctrl+h", - "command": "-extension.vim_ctrl+h", - "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl" - }, - { - "key": "ctrl+r", - "command": "-workbench.action.reloadWindow", - "when": "isDevelopment" - }, - { - "key": "ctrl+alt+r", - "command": "-workbench.action.terminal.runRecentCommand", - "when": "terminalFocus && terminalHasBeenCreated && !accessibilityModeEnabled || terminalFocus && terminalProcessSupported && !accessibilityModeEnabled" - }, - { - "key": "ctrl+r", - "command": "-workbench.action.terminal.runRecentCommand", - "when": "accessibilityModeEnabled && terminalFocus && terminalHasBeenCreated || accessibilityModeEnabled && terminalFocus && terminalProcessSupported || accessibilityModeEnabled && accessibleViewIsShown && terminalHasBeenCreated && accessibleViewCurrentProviderId == 'terminal' || accessibilityModeEnabled && accessibleViewIsShown && terminalProcessSupported && accessibleViewCurrentProviderId == 'terminal'" - }, - { - "key": "ctrl+shift+r", - "command": "-rerunSearchEditorSearch", - "when": "inSearchEditor" - }, - { - "key": "ctrl+shift+r", - "command": "-editor.action.refactor", - "when": "editorHasCodeActionsProvider && textInputFocus && !editorReadonly" - }, - { - "key": "ctrl+shift+r", - "command": "-workbench.action.quickOpenNavigatePreviousInRecentFilesPicker", - "when": "inQuickOpen && inRecentFilesPicker" - }, - { - "key": "ctrl+e", - "command": "cursorEnd", - "when": "textInputFocus" - }, - // #region Nvim-Tree like File Explorer - // n, e : move cursor up/down - // h : move cursor to parent folder - // i : open file or folder - { - "key": "e", - "command": "list.focusUp", - "when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused" - }, - { - "key": "k", - "command": "-list.focusUp", - "when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused" - }, - { - "key": "e", - "command": "list.focusUp", - "when": "listFocus && !inputFocus" - }, - { - "key": "k", - "command": "-list.focusUp", - "when": "listFocus && !inputFocus" - }, - { - "key": "f", - "command": "filesExplorer.findInWorkspace", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { - "key": "n", - "command": "list.focusDown", - "when": "listFocus && !inputFocus" - }, - { - "key": "j", - "command": "-list.focusDown", - "when": "listFocus && !inputFocus" - }, - { - "key": "i", - "command": "list.select", - "when": "listFocus && !inputFocus" - }, - { - "key": "l", - "command": "-list.select", - "when": "listFocus && !inputFocus" - }, - { // z: Close all folders - "key": "z", - "command": "workbench.files.action.collapseExplorerFolders", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // e: Close left sidebar if is in file explorer - "key": "space e", - "command": "workbench.action.toggleSidebarVisibility", - "when": "sideBarFocus && !inputFocus && !searchViewletVisible && filesExplorerFocus" - }, - { // e: Focus on file explorer if is on sidebar and not in file explorer - "key": "space e", - "command": "workbench.files.action.focusFilesExplorer", - "when": "sideBarFocus && !inputFocus && !searchViewletVisible && !filesExplorerFocus" - }, - { // g: Focus on file explorer if is on sidebar and not in file explorer - "key": "space g", - "command": "workbench.scm.focus", - "when": "sideBarFocus && !inputFocus && !searchViewletVisible && !scmViewletVisible" - }, - { // a: add - "key": "a", - "command": "explorer.newFile", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // p: paste - "key": "p", - "command": "filesExplorer.paste", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // x: cut - "key": "x", - "command": "filesExplorer.cut", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // d: delete - "key": "d", - "command": "deleteFile", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // r: rename - "key": "r", - "command": "renameFile", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // s: open in vertical split / to side - "key": "s", - "command": "explorer.openToSide", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // A: add folder - "key": "shift+a", - "command": "explorer.newFolder", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // C: Copy path - "key": "shift+c", - "command": "copyFilePath", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // E: Open in File Explorer - "key": "shift+e", - "command": "revealFileInOS", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // E: Open in File Explorer (WSL) - "key": "shift+e", - "command": "remote-wsl.revealInExplorer", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus && remoteName == 'wsl'" - }, - { // O: Open with System App - "key": "shift+o", - "command": "openInExternalApp.open", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // Y: Copy Relative Path - "key": "shift+y", - "command": "copyRelativeFilePath", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // R: Copy Relative Path - "key": "shift+r", - "command": "workbench.files.action.refreshFilesExplorer", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - { // T: Open in terminal - "key": "shift+t", - "command": "openInIntegratedTerminal", - "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" - }, - // #endregion - { - "key": "ctrl+p", - "command": "workbench.action.files.openFileFolder", - "when": "isMacNative && openFolderWorkspaceSupport" - }, - { - "key": "ctrl+o", - "command": "-workbench.action.files.openFileFolder", - "when": "isMacNative && openFolderWorkspaceSupport" - }, - { - "key": "ctrl+p", - "command": "-extension.vim_ctrl+p", - "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl || vim.active && vim.use && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use && !inDebugRepl && vim.mode == 'SearchInProgressMode'" - }, - { - "key": "ctrl+o", - "command": "-workbench.action.files.openFolderViaWorkspace", - "when": "!openFolderWorkspaceSupport && workbenchState == 'workspace'" - }, - // #region Vim-like Hover Browsing - { - "key": "h", - "command": "editor.action.scrollLeftHover", - "when": "editorHoverFocused" - }, - { - "key": "n", - "command": "editor.action.scrollDownHover", - "when": "editorHoverFocused" - }, - { - "key": "e", - "command": "editor.action.scrollUpHover", - "when": "editorHoverFocused" - }, - { - "key": "i", - "command": "editor.action.scrollRightHover", - "when": "editorHoverFocused" - }, - // #endregion - // #region Vim-like Jupyter Navigation - { - "key": "n", - "command": "notebook.focusNextEditor", - "when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'none' && notebookEditorCursorAtBoundary != 'top'" - }, - { - "key": "j", - "command": "-notebook.focusNextEditor", - "when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'none' && notebookEditorCursorAtBoundary != 'top'" - }, - { - "key": "e", - "command": "notebook.focusPreviousEditor", - "when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'bottom' && notebookEditorCursorAtBoundary != 'none'" - }, - { - "key": "k", - "command": "-notebook.focusPreviousEditor", - "when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'bottom' && notebookEditorCursorAtBoundary != 'none'" - }, - // #endregion - { - "key": "ctrl+shift+g c", - "command": "-gitlens.showQuickCommitFileDetails", - "when": "editorTextFocus && !gitlens:disabled && config.gitlens.keymap == 'chorded'" - }, - { - "key": "ctrl+shift+g s", - "command": "git.stageAll" - }, - { - "key": "ctrl+shift+g g", - "command": "workbench.view.scm", - "when": "workbench.scm.active" - }, - { - "key": "ctrl+shift+g", - "command": "-workbench.view.scm", - "when": "workbench.scm.active" - }, - { - "key": "ctrl+k ctrl+shift+b", - "command": "editor.action.goToSelectionAnchor" - }, - { - "key": "ctrl+k ctrl+shift+i", - "command": "workbench.action.selectProductIconTheme" - }, - { - "key": "ctrl+l p", - "command": "-extension.openPrGitProvider" - }, - { - "key": "ctrl+l g", - "command": "-extension.openInGitHub" - }, - { - "key": "ctrl+l c", - "command": "-extension.copyGitHubLinkToClipboard" - }, - // #region Use ^n ^e to navigate completions - { - "key": "ctrl+n", - "command": "workbench.action.files.newUntitledFile", - "when": "!suggestWidgetVisible && !inQuickOpen" - }, - { - "key": "ctrl+n", - "command": "-workbench.action.files.newUntitledFile" - }, - { - "key": "ctrl+n", - "command": "selectNextSuggestion", - "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion" - }, - { - "key": "ctrl+e", - "command": "selectPrevSuggestion", - "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion" - }, - // #endregion - // #region Terminal Control, use ^a as prefix / leader key - // tmux-like terminal control - { // prefix + x : kill terminal - "key": "ctrl+a x", - "command": "workbench.action.terminal.kill", - "when": "terminalFocus" - }, - { // prefix + c : create new terminal - "key": "ctrl+a c", - "command": "workbench.action.terminal.new", - "when": "terminalFocus" - }, - { // prefix + | : split terminal vertically - "key": "ctrl+a shift+\\", - "command": "workbench.action.terminal.split", - "when": "terminalFocus" - }, - { // prefix + \ : split terminal vertically - "key": "ctrl+a \\", - "command": "workbench.action.terminal.split", - "when": "terminalFocus" - }, - { // prefix + / : search - "key": "ctrl+a /", - "command": "workbench.action.terminal.focusFind", - "when": "terminalFocus" - }, - { // prefix + t : toggle terminal - "key": "ctrl+a t", - "command": "workbench.action.terminal.toggleTerminal", - "when": "terminalFocus" - }, - { // prefix + ^a: show information - "key": "ctrl+a ctrl+a", - "command": "workbench.action.terminal.focusHover", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" - }, - { - "key": "ctrl+k ctrl+i", - "command": "-workbench.action.terminal.focusHover", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" - }, - { // prefix + 1 : focus terminal 1 - "key": "ctrl+a 1", - "command": "workbench.action.terminal.focusAtIndex1", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" - }, - { // prefix + 2 : focus terminal 2 - "key": "ctrl+a 2", - "command": "workbench.action.terminal.focusAtIndex2", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" - }, - { // prefix + 3 : focus terminal 3 - "key": "ctrl+a 3", - "command": "workbench.action.terminal.focusAtIndex3", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" - }, - { // prefix + g : Go to recent directory - "key": "ctrl+a g", - "command": "workbench.action.terminal.goToRecentDirectory", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" - }, - { - "key": "ctrl+g", - "command": "-workbench.action.terminal.goToRecentDirectory", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" - }, - { // prefix + d : detach terminal - "key": "ctrl+a d", - "command": "workbench.action.terminal.detachSession", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" - }, - { // prefix + a : attach to session - "key": "ctrl+a a", - "command": "workbench.action.terminal.attachToSession", - "when": "terminalFocus" - }, - { - "key": "ctrl+a h", - "command": "workbench.action.terminal.focusPreviousPane", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" - }, - { - "key": "ctrl+a i", - "command": "workbench.action.terminal.focusNextPane", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" - }, - { - "key": "ctrl+a shift+H", - "command": "workbench.action.terminal.resizePaneLeft", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" - }, - { - "key": "ctrl+a shift+N", - "command": "workbench.action.terminal.resizePaneDown", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" - }, - { - "key": "ctrl+a shift+E", - "command": "workbench.action.terminal.resizePaneUp", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" - }, - { - "key": "ctrl+a shift+I", - "command": "workbench.action.terminal.resizePaneRight", - "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" - } -] + // #region quickOpen (Telescope) + { // Telescope emulator + "key": "space space", + "command": "workbench.action.quickOpen", + "when": "!editorFocus && !inputFocus" + }, + { + "key": "ctrl+p", + "command": "workbench.action.quickOpen" + }, + { + "key": "ctrl+e", + "command": "workbench.action.quickOpenNavigatePrevious", + "when": "inQuickOpen" + }, + { + "key": "ctrl+n", + "command": "workbench.action.quickOpenNavigateNext", + "when": "inQuickOpen" + }, + { + "key": "ctrl+[", + "command": "workbench.action.closeQuickOpen", + "when": "inQuickOpen" + }, + // #endregion + // #region plugin: code runner + { + "key": "ctrl+alt+n", + "command": "-code-runner.run" + }, + // #endregion + // #region Comment and semicolons + { + "key": "ctrl+oem_1", // ctrl+; + "command": "extension.insertSemicolon", + "when": "editorTextFocus" + }, + { // change to toggle comment + "key": "ctrl+oem_2", // ctrl+/; + "command": "-extension.insertSemicolon", + "when": "editorTextFocus" + }, + { + "key": "ctrl+shift+oem_1", + "command": "extension.insertSemicolonWithNewLine", + "when": "editorTextFocus" + }, + { + "key": "ctrl+shift+oem_2", + "command": "-extension.insertSemicolonWithNewLine", + "when": "editorTextFocus" + }, + { + "key": "ctrl+shift+oem_2", + "command": "github.copilot.acceptCursorPanelSolution", + "when": "github.copilot.activated && github.copilot.panelVisible" + }, + { + "key": "ctrl+oem_2", + "command": "-github.copilot.acceptCursorPanelSolution", + "when": "github.copilot.activated && github.copilot.panelVisible" + }, + // #endregion + { + "key": "f9", + "command": "csdevkit.debug.noDebugFileLaunch" + }, + { + "key": "ctrl+h", + "command": "-editor.action.startFindReplaceAction", + "when": "editorFocus || editorIsOpen" + }, + { + "key": "ctrl+h", + "command": "-extension.vim_ctrl+h", + "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl" + }, + { + "key": "ctrl+r", + "command": "-workbench.action.reloadWindow", + "when": "isDevelopment" + }, + { + "key": "ctrl+alt+r", + "command": "-workbench.action.terminal.runRecentCommand", + "when": "terminalFocus && terminalHasBeenCreated && !accessibilityModeEnabled || terminalFocus && terminalProcessSupported && !accessibilityModeEnabled" + }, + { + "key": "ctrl+r", + "command": "-workbench.action.terminal.runRecentCommand", + "when": "accessibilityModeEnabled && terminalFocus && terminalHasBeenCreated || accessibilityModeEnabled && terminalFocus && terminalProcessSupported || accessibilityModeEnabled && accessibleViewIsShown && terminalHasBeenCreated && accessibleViewCurrentProviderId == 'terminal' || accessibilityModeEnabled && accessibleViewIsShown && terminalProcessSupported && accessibleViewCurrentProviderId == 'terminal'" + }, + { + "key": "ctrl+shift+r", + "command": "-rerunSearchEditorSearch", + "when": "inSearchEditor" + }, + { + "key": "ctrl+shift+r", + "command": "-editor.action.refactor", + "when": "editorHasCodeActionsProvider && textInputFocus && !editorReadonly" + }, + { + "key": "ctrl+shift+r", + "command": "-workbench.action.quickOpenNavigatePreviousInRecentFilesPicker", + "when": "inQuickOpen && inRecentFilesPicker" + }, + { + "key": "ctrl+e", + "command": "cursorEnd", + "when": "textInputFocus" + }, + // #region Nvim-Tree like File Explorer + // n, e : move cursor up/down + // h : move cursor to parent folder + // i : open file or folder + { + "key": "e", + "command": "list.focusUp", + "when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused" + }, + { + "key": "k", + "command": "-list.focusUp", + "when": "notebookEditorFocused && !inputFocus && !notebookOutputInputFocused" + }, + { + "key": "e", + "command": "list.focusUp", + "when": "listFocus && !inputFocus" + }, + { + "key": "k", + "command": "-list.focusUp", + "when": "listFocus && !inputFocus" + }, + { + "key": "f", + "command": "filesExplorer.findInWorkspace", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { + "key": "n", + "command": "list.focusDown", + "when": "listFocus && !inputFocus" + }, + { + "key": "j", + "command": "-list.focusDown", + "when": "listFocus && !inputFocus" + }, + { + "key": "i", + "command": "list.select", + "when": "listFocus && !inputFocus" + }, + { + "key": "l", + "command": "-list.select", + "when": "listFocus && !inputFocus" + }, + { // z: Close all folders + "key": "z", + "command": "workbench.files.action.collapseExplorerFolders", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // e: Close left sidebar if is in file explorer + "key": "space e", + "command": "workbench.action.toggleSidebarVisibility", + "when": "sideBarFocus && !inputFocus && !searchViewletVisible && filesExplorerFocus" + }, + { // e: Focus on file explorer if is on sidebar and not in file explorer + "key": "space e", + "command": "workbench.files.action.focusFilesExplorer", + "when": "sideBarFocus && !inputFocus && !searchViewletVisible && !filesExplorerFocus" + }, + { // g: Focus on file explorer if is on sidebar and not in file explorer + "key": "space g", + "command": "workbench.scm.focus", + "when": "sideBarFocus && !inputFocus && !searchViewletVisible && !scmViewletVisible" + }, + { // a: add + "key": "a", + "command": "explorer.newFile", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // p: paste + "key": "p", + "command": "filesExplorer.paste", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // x: cut + "key": "x", + "command": "filesExplorer.cut", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // d: delete + "key": "d", + "command": "deleteFile", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // r: rename + "key": "r", + "command": "renameFile", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // s: open in vertical split / to side + "key": "s", + "command": "explorer.openToSide", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // A: add folder + "key": "shift+a", + "command": "explorer.newFolder", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // C: Copy path + "key": "shift+c", + "command": "copyFilePath", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // E: Open in File Explorer + "key": "shift+e", + "command": "revealFileInOS", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // E: Open in File Explorer (WSL) + "key": "shift+e", + "command": "remote-wsl.revealInExplorer", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus && remoteName == 'wsl'" + }, + { // O: Open with System App + "key": "shift+o", + "command": "openInExternalApp.open", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // Y: Copy Relative Path + "key": "shift+y", + "command": "copyRelativeFilePath", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // R: Copy Relative Path + "key": "shift+r", + "command": "workbench.files.action.refreshFilesExplorer", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + { // T: Open in terminal + "key": "shift+t", + "command": "openInIntegratedTerminal", + "when": "filesExplorerFocus && foldersViewVisible && !explorerResourceIsRoot && !explorerResourceReadonly && !inputFocus" + }, + // #endregion + { + "key": "ctrl+p", + "command": "workbench.action.files.openFileFolder", + "when": "isMacNative && openFolderWorkspaceSupport" + }, + { + "key": "ctrl+o", + "command": "-workbench.action.files.openFileFolder", + "when": "isMacNative && openFolderWorkspaceSupport" + }, + { + "key": "ctrl+p", + "command": "-extension.vim_ctrl+p", + "when": "editorTextFocus && vim.active && vim.use && !inDebugRepl || vim.active && vim.use && !inDebugRepl && vim.mode == 'CommandlineInProgress' || vim.active && vim.use && !inDebugRepl && vim.mode == 'SearchInProgressMode'" + }, + { + "key": "ctrl+o", + "command": "-workbench.action.files.openFolderViaWorkspace", + "when": "!openFolderWorkspaceSupport && workbenchState == 'workspace'" + }, + // #region Vim-like Hover Browsing + { + "key": "h", + "command": "editor.action.scrollLeftHover", + "when": "editorHoverFocused" + }, + { + "key": "n", + "command": "editor.action.scrollDownHover", + "when": "editorHoverFocused" + }, + { + "key": "e", + "command": "editor.action.scrollUpHover", + "when": "editorHoverFocused" + }, + { + "key": "i", + "command": "editor.action.scrollRightHover", + "when": "editorHoverFocused" + }, + // #endregion + // #region Vim-like Jupyter Navigation + { + "key": "n", + "command": "notebook.focusNextEditor", + "when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'none' && notebookEditorCursorAtBoundary != 'top'" + }, + { + "key": "j", + "command": "-notebook.focusNextEditor", + "when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'none' && notebookEditorCursorAtBoundary != 'top'" + }, + { + "key": "e", + "command": "notebook.focusPreviousEditor", + "when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'bottom' && notebookEditorCursorAtBoundary != 'none'" + }, + { + "key": "k", + "command": "-notebook.focusPreviousEditor", + "when": "editorTextFocus && inputFocus && notebookEditorFocused && vim.mode == 'Normal' && notebookEditorCursorAtBoundary != 'bottom' && notebookEditorCursorAtBoundary != 'none'" + }, + // #endregion + { + "key": "ctrl+shift+g c", + "command": "-gitlens.showQuickCommitFileDetails", + "when": "editorTextFocus && !gitlens:disabled && config.gitlens.keymap == 'chorded'" + }, + { + "key": "ctrl+shift+g s", + "command": "git.stageAll" + }, + { + "key": "ctrl+shift+g g", + "command": "workbench.view.scm", + "when": "workbench.scm.active" + }, + { + "key": "ctrl+shift+g", + "command": "-workbench.view.scm", + "when": "workbench.scm.active" + }, + { + "key": "ctrl+k ctrl+shift+b", + "command": "editor.action.goToSelectionAnchor" + }, + { + "key": "ctrl+k ctrl+shift+i", + "command": "workbench.action.selectProductIconTheme" + }, + { + "key": "ctrl+l p", + "command": "-extension.openPrGitProvider" + }, + { + "key": "ctrl+l g", + "command": "-extension.openInGitHub" + }, + { + "key": "ctrl+l c", + "command": "-extension.copyGitHubLinkToClipboard" + }, + // #region Use ^n ^e to navigate completions + { + "key": "ctrl+n", + "command": "workbench.action.files.newUntitledFile", + "when": "!suggestWidgetVisible && !inQuickOpen" + }, + { + "key": "ctrl+n", + "command": "-workbench.action.files.newUntitledFile" + }, + { + "key": "ctrl+n", + "command": "selectNextSuggestion", + "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion" + }, + { + "key": "ctrl+e", + "command": "selectPrevSuggestion", + "when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion" + }, + // #endregion + // #region Terminal Control, use ^a as prefix / leader key + // tmux-like terminal control + { // prefix + x : kill terminal + "key": "ctrl+a x", + "command": "workbench.action.terminal.kill", + "when": "terminalFocus" + }, + { // prefix + c : create new terminal + "key": "ctrl+a c", + "command": "workbench.action.terminal.new", + "when": "terminalFocus" + }, + { // prefix + | : split terminal vertically + "key": "ctrl+a shift+\\", + "command": "workbench.action.terminal.split", + "when": "terminalFocus" + }, + { // prefix + \ : split terminal vertically + "key": "ctrl+a \\", + "command": "workbench.action.terminal.split", + "when": "terminalFocus" + }, + { // prefix + / : search + "key": "ctrl+a /", + "command": "workbench.action.terminal.focusFind", + "when": "terminalFocus" + }, + { // prefix + t : toggle terminal + "key": "ctrl+a t", + "command": "workbench.action.terminal.toggleTerminal", + "when": "terminalFocus" + }, + { // prefix + ^a: show information + "key": "ctrl+a ctrl+a", + "command": "workbench.action.terminal.focusHover", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" + }, + { + "key": "ctrl+k ctrl+i", + "command": "-workbench.action.terminal.focusHover", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" + }, + { // prefix + 1 : focus terminal 1 + "key": "ctrl+a 1", + "command": "workbench.action.terminal.focusAtIndex1", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" + }, + { // prefix + 2 : focus terminal 2 + "key": "ctrl+a 2", + "command": "workbench.action.terminal.focusAtIndex2", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" + }, + { // prefix + 3 : focus terminal 3 + "key": "ctrl+a 3", + "command": "workbench.action.terminal.focusAtIndex3", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalIsOpen || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalTabsFocus || terminalIsOpen && terminalTabsFocus || terminalProcessSupported && terminalTabsFocus" + }, + { // prefix + g : Go to recent directory + "key": "ctrl+a g", + "command": "workbench.action.terminal.goToRecentDirectory", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + }, + { + "key": "ctrl+g", + "command": "-workbench.action.terminal.goToRecentDirectory", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + }, + { // prefix + d : detach terminal + "key": "ctrl+a d", + "command": "workbench.action.terminal.detachSession", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + }, + { // prefix + a : attach to session + "key": "ctrl+a a", + "command": "workbench.action.terminal.attachToSession", + "when": "terminalFocus" + }, + { + "key": "ctrl+a h", + "command": "workbench.action.terminal.focusPreviousPane", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + }, + { + "key": "ctrl+a i", + "command": "workbench.action.terminal.focusNextPane", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + }, + { + "key": "ctrl+a shift+H", + "command": "workbench.action.terminal.resizePaneLeft", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + }, + { + "key": "ctrl+a shift+N", + "command": "workbench.action.terminal.resizePaneDown", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + }, + { + "key": "ctrl+a shift+E", + "command": "workbench.action.terminal.resizePaneUp", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + }, + { + "key": "ctrl+a shift+I", + "command": "workbench.action.terminal.resizePaneRight", + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + } +] \ No newline at end of file diff --git a/tools/vscode/vscode.vimrc b/tools/vscode/vscode.vimrc index b7e7690..128e507 100644 --- a/tools/vscode/vscode.vimrc +++ b/tools/vscode/vscode.vimrc @@ -30,9 +30,11 @@ noremap J E noremap Y y$ " 分词版本的w和b,支持中文,需要插件 +" 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap` +" 由于 VSCode Vim 的限制,递归解析存在缺陷,目前这种情况,2w 符合预期,但 dw 不符合预期 " Comment if you don't use cjk or the plugin -noremap w cjkWordHandler.cursorWordEndRight -noremap b cjkWordHandler.cursorWordStartLeft +nmap w cjkWordHandler.cursorWordEndRight +nmap b cjkWordHandler.cursorWordStartLeft " keep selection after indent (define in settings.json) " voremap < workbench.action.quickOpen noremap : workbench.action.showCommands +noremap E workbench.view.explorer + " q : +quit noremap qq :quit noremap qQ :qall noremap Q :quit + " w : +write/window noremap ww :write noremap wa :wall @@ -66,6 +71,7 @@ noremap we workbench.action.focusAboveGroup noremap wE workbench.action.splitEditorUp noremap wi workbench.action.focusRightGroup noremap wI workbench.action.splitEditorRight + " f : +find/file noremap ff workbench.action.quickOpen noremap fF workbench.view.search @@ -77,6 +83,7 @@ noremap fR workbench.action.openRecent noremap fs workbench.action.search.toggleQueryDetails noremap ft workbench.action.terminal.toggleTerminal noremap fx workbench.view.extensions + " p : +project (requires Project Manager extension) noremap pp projectManager.listProjects noremap pP projectManager.listAnyProjects#sideBarAny @@ -87,12 +94,16 @@ noremap pF projectManager.filterProjectsByTag noremap pg projectManager.listGitProjects#sideBarGit noremap pr workbench.action.openRecent noremap ps projectManager.saveProject + " g : +git noremap gg workbench.view.scm noremap gS git.stageAll + " j : +jump noremap jj workbench.action.gotoLine + " l : +language (define in settings.json) + " u : +ui noremap ui workbench.action.selectTheme noremap uw editor.action.toggleWordWrap @@ -117,14 +128,18 @@ noremap tC testing.debugCurrentTest noremap tx testing.cancelTestRun " d : +debug " h : +help + " c : +code noremap cr coderunner.run noremap cf editor.action.formatDocument noremap c editor.action.trimTrailingWhitespace noremap cs workbench.action.gotoSymbol noremap cS workbench.action.showAllSymbols + " b : +buffer noremap bb workbench.action.showAllEditors noremap bd :bdelete noremap bh :bprevious noremap bi :bnext + +" 中文分词测试用例