diff --git a/.editorconfig b/.editorconfig index 7a14577..b0f87fd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -20,3 +20,8 @@ indent_size = 2 [*.{json,toml,js,lua,yaml,yml}] indent_size = 2 indent_style = space + +[*.{bat}] +# Empty ruleset to skip global settings +# charset = gbk # Not available +# end_of_line = crlf diff --git a/.gitattributes b/.gitattributes index 008de29..d07910b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,3 +2,9 @@ # Date: 2024-11-30 # Author: contact@js0ny.net skhdrc linguist-language=Shell +yabairc linguist-language=Shell +sketchybarrc linguist-language=Shell +*.vimrc linguist-language=VimL +vsvimrc linguist-language=VimL +vimrc linguist-language=VimL +ideavimrc linguist-language=VimL diff --git a/.gitignore b/.gitignore index 8090e0e..29e966f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ tools/nushell/ .DS_Store .venv/ + +platforms/win/komorebi/applications.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 24eb11a..7972763 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "material-icon-theme.files.associations": { "ideavimrc": "vim", + "vsvimrc": "vim", "vimrc": "vim", "haskeline": "haskell", "inputrc": "console", diff --git a/bootstrap/Windows.ps1 b/bootstrap/Windows.ps1 index 03fcf50..2c1046d 100644 --- a/bootstrap/Windows.ps1 +++ b/bootstrap/Windows.ps1 @@ -82,7 +82,8 @@ New-Item -ItemType Directory -Path "$Env:AppData\less" -Force New-Item -ItemType Directory -Path "$Env:XDG_STATE_HOME\node" -Force [System.Environment]::SetEnvironmentVariable("NODE_REPL_HISTORY", "$Env:XDG_STATE_HOME\node\repl_history", "User") # ~\.ts_node_repl_history -> %LocalAppData%\state\node\ts_node_repl_history :: Node.js -[System.Environment]::SetEnvironmentVariable("TS_NODE_REPL_HISTORY", "$Env:XDG_STATE_HOME\node\ts_node_repl_history", "User") +# NOTE: ts-node doesn't support this yet +# [System.Environment]::SetEnvironmentVariable("TS_NODE_REPL_HISTORY", "$Env:XDG_STATE_HOME\node\ts_node_repl_history", "User") # ~\.nuget\packages -> %LocalAppData%\cache\NuGet\packages :: NuGet [System.Environment]::SetEnvironmentVariable("NUGET_PACKAGES", "$Env:XDG_CACHE_HOME\NuGet\packages", "User") # ~\.omnisharp -> %AppData%\OmniSharp :: OmniSharp @@ -96,6 +97,7 @@ New-Item -ItemType Directory -Path "$Env:XDG_STATE_HOME\python" -Force # ~\.vimrc -> %AppData%\Vim\_vimrc :: Vim New-Item -ItemType Directory -Path "$Env:AppData\Vim" -Force [System.Environment]::SetEnvironmentVariable("VIM", "$Env:AppData\Vim", "User") +[System.Environment]::SetEnvironmentVariable("KOMOREBI_CONFIG_HOME", "$Env:AppData\komorebi", "User") # ~\.vuerc -> %AppData%\vue\.vuerc :: Vue CLI # Currently, Vue CLI doesn't support file path configuration:https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/confifile # [System.Environment]::SetEnvironmentVariable("VUE_CLI_CONFIG_PATH", "$Env:AppData\vue\.vuerc", "User") diff --git a/bootstrap/set_symlink_win.ps1 b/bootstrap/set_symlink_win.ps1 index fe3116e..e709cb0 100644 --- a/bootstrap/set_symlink_win.ps1 +++ b/bootstrap/set_symlink_win.ps1 @@ -9,21 +9,23 @@ $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\neovide.toml" = "$Env:AppData\neovide\config.toml" - "$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\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\vim.noxdg.vimrc" = "$env:Vim\_vimrc" + "$BASE_TOOLS\ipython" = "$env:IPYTHONDIR" + "$BASE_TOOLS\nvim" = "$env:XDG_CONFIG_HOME\nvim" } # TODO: Auto create directories diff --git a/common/gitconfig b/common/gitconfig index 8e7df7e..6b98b60 100644 --- a/common/gitconfig +++ b/common/gitconfig @@ -8,6 +8,7 @@ [core] editor = nvim pager = delta + autocrlf = input [interactive] diffFilter = delta --color-only [delta] diff --git a/common/ideavimrc b/common/ideavimrc index 1d8116a..e61739b 100644 --- a/common/ideavimrc +++ b/common/ideavimrc @@ -5,9 +5,8 @@ let mapleader = " " " set to """ Colemak """ -" Word wrap -noremap n gj -noremap e gk +noremap n j +noremap e k noremap i l " Similar position to i diff --git a/platforms/win/ahk/main.ahk b/platforms/win/ahk/main.ahk new file mode 100644 index 0000000..519a77d --- /dev/null +++ b/platforms/win/ahk/main.ahk @@ -0,0 +1,33 @@ +#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 + +#n:: +Send '{Down}' +return + +#e:: +Send '{Up}' +return + +#i:: +Send '{Right}' +return diff --git a/platforms/win/cmd/dark-mode.bat b/platforms/win/cmd/dark-mode.bat new file mode 100644 index 0000000..a8948ae --- /dev/null +++ b/platforms/win/cmd/dark-mode.bat @@ -0,0 +1,13 @@ +@REM Not working +@REM encoding: GBK +@echo off +set regPath="HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" +for /f "usebackq tokens=2*" %%a in (`reg query %regPath% /v AppsUseLightTheme ^| find "REG_DWORD"`) do set currentMode=%%b + +if "%currentMode%"=="0x1" ( + reg add %regPath% /v AppsUseLightTheme /t REG_DWORD /d 0 /f >nul + echo ���л�����ɫģʽ +) else ( + reg add %regPath% /v AppsUseLightTheme /t REG_DWORD /d 1 /f >nul + echo ���л���dzɫģʽ +) diff --git a/platforms/win/komorebi/komorebi.ahk b/platforms/win/komorebi/komorebi.ahk new file mode 100644 index 0000000..8bc1263 --- /dev/null +++ b/platforms/win/komorebi/komorebi.ahk @@ -0,0 +1,72 @@ +; Use %KOMOREBI_CONFIG_HOME% Environment Variable to set the path to the config file +#Requires AutoHotkey v2.0.2 +#SingleInstance Force + +Komorebic(cmd) { + RunWait(format("komorebic.exe {}", cmd), , "Hide") +} + +!q:: Komorebic("close") +!m:: Komorebic("minimize") + +; Focus windows +#+h:: Komorebic("focus left") +#+n:: Komorebic("focus down") +#+e:: Komorebic("focus up") +#+i:: Komorebic("focus right") + +!+[:: Komorebic("cycle-focus previous") +!+]:: Komorebic("cycle-focus next") + +; Move windows +!+h:: Komorebic("move left") +!+j:: Komorebic("move down") +!+k:: Komorebic("move up") +!+l:: Komorebic("move right") + +; Stack windows +!Left:: Komorebic("stack left") +!Down:: Komorebic("stack down") +!Up:: Komorebic("stack up") +!Right:: Komorebic("stack right") +!;:: Komorebic("unstack") +![:: Komorebic("cycle-stack previous") +!]:: Komorebic("cycle-stack next") + +; Resize +!=:: Komorebic("resize-axis horizontal increase") +!-:: Komorebic("resize-axis horizontal decrease") +!+=:: Komorebic("resize-axis vertical increase") +!+_:: Komorebic("resize-axis vertical decrease") + +; Manipulate windows +!t:: Komorebic("toggle-float") +!f:: Komorebic("toggle-monocle") + +; Window manager options +!+r:: Komorebic("retile") +!p:: Komorebic("toggle-pause") + +; Layouts +!x:: Komorebic("flip-layout horizontal") +!y:: Komorebic("flip-layout vertical") + +; Workspaces +!1:: Komorebic("focus-workspace 0") +!2:: Komorebic("focus-workspace 1") +!3:: Komorebic("focus-workspace 2") +!4:: Komorebic("focus-workspace 3") +!5:: Komorebic("focus-workspace 4") +!6:: Komorebic("focus-workspace 5") +!7:: Komorebic("focus-workspace 6") +!8:: Komorebic("focus-workspace 7") + +; Move windows across workspaces +!+1:: Komorebic("move-to-workspace 0") +!+2:: Komorebic("move-to-workspace 1") +!+3:: Komorebic("move-to-workspace 2") +!+4:: Komorebic("move-to-workspace 3") +!+5:: Komorebic("move-to-workspace 4") +!+6:: Komorebic("move-to-workspace 5") +!+7:: Komorebic("move-to-workspace 6") +!+8:: Komorebic("move-to-workspace 7") diff --git a/platforms/win/komorebi/komorebi.bar.json b/platforms/win/komorebi/komorebi.bar.json new file mode 100644 index 0000000..39a1147 --- /dev/null +++ b/platforms/win/komorebi/komorebi.bar.json @@ -0,0 +1,76 @@ +{ + "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.30/schema.bar.json", + "monitor": { + "index": 0, + "work_area_offset": { + "left": 0, + "top": 40, + "right": 0, + "bottom": 40 + } + }, + "font_family": "JetBrains Mono", + "theme": { + "palette": "Base16", + "name": "Ashes", + "accent": "Base0D" + }, + "left_widgets": [ + { + "Komorebi": { + "workspaces": { + "enable": true, + "hide_empty_workspaces": false + }, + "layout": { + "enable": true + }, + "focused_window": { + "enable": true, + "show_icon": true + } + } + } + ], + "right_widgets": [ + { + "Media": { + "enable": true + } + }, + { + "Storage": { + "enable": true + } + }, + { + "Memory": { + "enable": true + } + }, + { + "Network": { + "enable": true, + "show_total_data_transmitted": true, + "show_network_activity": true + } + }, + { + "Date": { + "enable": true, + "format": "DayDateMonthYear" + } + }, + { + "Time": { + "enable": true, + "format": "TwentyFourHour" + } + }, + { + "Battery": { + "enable": true + } + } + ] +} \ No newline at end of file diff --git a/platforms/win/komorebi/komorebi.json b/platforms/win/komorebi/komorebi.json new file mode 100644 index 0000000..ec8ec47 --- /dev/null +++ b/platforms/win/komorebi/komorebi.json @@ -0,0 +1,58 @@ +{ + "$schema": "https://raw.githubusercontent.com/LGUG2Z/komorebi/v0.1.30/schema.json", + "app_specific_configuration_path": "$Env:USERPROFILE/applications.json", + "window_hiding_behaviour": "Cloak", + "cross_monitor_move_behaviour": "Insert", + "default_workspace_padding": 20, + "default_container_padding": 20, + "border": true, + "border_width": 8, + "border_offset": -1, + "theme": { + "palette": "Base16", + "name": "Ashes", + "unfocused_border": "Base03", + "bar_accent": "Base0D" + }, + "stackbar": { + "height": 40, + "mode": "OnStack", + "tabs": { + "width": 300 + } + }, + "monitors": [ + { + "workspaces": [ + { + "name": "I", + "layout": "BSP" + }, + { + "name": "II", + "layout": "VerticalStack" + }, + { + "name": "III", + "layout": "HorizontalStack" + }, + { + "name": "IV", + "layout": "UltrawideVerticalStack" + }, + { + "name": "V", + "layout": "Rows" + }, + { + "name": "VI", + "layout": "Grid" + }, + { + "name": "VII", + "layout": "RightMainVerticalStack" + } + ] + } + ] +} diff --git a/platforms/win/neovide.toml b/platforms/win/neovide.toml index 2dbf494..4acac1f 100644 --- a/platforms/win/neovide.toml +++ b/platforms/win/neovide.toml @@ -11,5 +11,5 @@ vsync = false wsl = true [font] -normal = ["CaskaydiaCove Nerd Font"] # Will use the bundled Fira Code Nerd Font by default +normal = ["CaskaydiaCove Nerd Font", "霞鹜文楷等宽"] # Will use the bundled Fira Code Nerd Font by default size = 14.0 diff --git a/platforms/win/vsvimrc b/platforms/win/vsvimrc new file mode 100644 index 0000000..ceb2de8 --- /dev/null +++ b/platforms/win/vsvimrc @@ -0,0 +1,41 @@ +" This is the `vimrc` config for VSVim (Visual Studio Vim Emulator) +" Put it in %Vim%\.vsvimrc + +" Colemak Keys + +" Arrow remap +noremap n j +noremap e k +noremap i l +noremap H 0 +noremap N 5j +noremap E 5k +noremap I $ + +" Similar position to i +noremap l i +noremap L I +" ne[k]st +noremap k n +noremap K N +" [j]ump +noremap j e +noremap J E + +" Normal minimal setup + +noremap Y y$ +set expandtab +set tabstop=4 +set shiftwidth=4 +set autoindent +set smartindent +set wrap +set scrolloff=3 +set hlsearch +set incsearch +set ignorecase +set smartcase + +set number +set relativenumber diff --git a/readme.md b/readme.md index 139c5fb..ca9a7d6 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,3 @@ # .dotfiles -Moving to *Colemak* - -This branch is WIP. +Moving to _Colemak_ diff --git a/tools/fastfetch/win.jsonc b/tools/fastfetch/win.jsonc new file mode 100644 index 0000000..2b5c2e6 --- /dev/null +++ b/tools/fastfetch/win.jsonc @@ -0,0 +1,62 @@ +// ~\.config\fastfetch\config.jsonc +{ + "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", + "logo": { + // "type": "auto", + "source": "Windows 7", + "padding": { + "top": 2, + "left": 1, + "right": 2 + } + }, + "general": { + "multithreading": true + }, + "display": { + "separator": " ", + "key": { + "width": 10, + "paddingLeft": 2, + "type": "icon" + } + }, + "modules": [ + { + "type": "title", + "format": "{#1}───────────── {#}{user-name-colored}@{host-name-colored}" + }, + { + "type": "colors", + "symbol": "diamond", + "paddingLeft": 15 + }, + "os", + "host", + "kernel", + "uptime", + { + "type": "packages" + }, + "shell", + "display", + "de", + "wm", + "wmtheme", + "theme", + "icons", + "font", + "cursor", + "terminal", + "terminalfont", + "cpu", + "gpu", + "memory", + "swap", + "disk", + "localip", + "battery", + "poweradapter", + "locale" + ] +} diff --git a/tools/powershell/Config.ps1 b/tools/powershell/Config.ps1 index b095745..e7cb656 100644 --- a/tools/powershell/Config.ps1 +++ b/tools/powershell/Config.ps1 @@ -4,4 +4,4 @@ ${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args} # yarn v1 -${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args} \ No newline at end of file +${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args} diff --git a/tools/powershell/Keymap.ps1 b/tools/powershell/Keymap.ps1 index f765339..ca110f3 100644 --- a/tools/powershell/Keymap.ps1 +++ b/tools/powershell/Keymap.ps1 @@ -6,7 +6,7 @@ Set-PSReadLineOption -PredictionSource HistoryAndPlugin # Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > " # Use Starship instead # PSReadLineKeyHandlers ## Colemak hnei -Set-PSReadLineKeyHandler -Chord "n" -Function NextHistory -ViMode Command +Set-PSReadLineKeyHandler -Chord "n" -Function NextHistory -ViMode Command Set-PSReadLineKeyHandler -Chord "e" -Function PreviousHistory -ViMode Command Set-PSReadLineKeyHandler -Chord "i" -Function ViForwardChar -ViMode Command ## Similar position to [i] in QWERTY @@ -22,4 +22,7 @@ Set-PSReadLineKeyHandler -Chord "J" -Function ViEndOfGlob -ViMode Command Set-PSReadLineKeyHandler -Chord "N" -Function ViJoinLines -ViMode Command Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine -Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine \ No newline at end of file +Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine + +## Use to Invoke MenuComplete +Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete diff --git a/tools/powershell/Modules.ps1 b/tools/powershell/Modules.ps1 index a0825a6..0137d59 100644 --- a/tools/powershell/Modules.ps1 +++ b/tools/powershell/Modules.ps1 @@ -6,4 +6,4 @@ if ($IsWindows) { if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" } # WinGet Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58 -} \ No newline at end of file +} diff --git a/tools/powershell/readme.md b/tools/powershell/readme.md index 2b31694..7cd9a86 100644 --- a/tools/powershell/readme.md +++ b/tools/powershell/readme.md @@ -4,9 +4,9 @@ This is the cross-platform PowerShell profile for PowerShell Core ```text . -├── Aliases.ps1 +├── Aliases.ps1 ├── Keymap.ps1 # keymaps, optimize for Vi-Mode and Colemak -├── Modules.ps1 +├── Modules.ps1 ├── Navigation.ps1 ├── Prompt.ps1 ├── readme.md @@ -15,9 +15,8 @@ This is the cross-platform PowerShell profile for PowerShell Core 1 directory, 7 files ``` -| Keymap | Action | Mode | -| --- | --- | --- | -| `^a` | To Beginning of Line | All | -| `^e` | To End of Line | All | -| `^[` | To Normal Mode | Insert | - +| Keymap | Action | Mode | +| ------ | -------------------- | ------ | +| `^a` | To Beginning of Line | All | +| `^e` | To End of Line | All | +| `^[` | To Normal Mode | Insert | diff --git a/tools/vscode/hsnips/readme.md b/tools/vscode/hsnips/readme.md deleted file mode 100644 index 7418e27..0000000 --- a/tools/vscode/hsnips/readme.md +++ /dev/null @@ -1,8 +0,0 @@ -# VSCode HyperSnips Snippets - -## Navigator - -- [C](./c.hsnips) -- [$\LaTeX$](./latex.hsnips) -- [Markdown](./markdown.hsnips) -- [Typst](./typst.hsnips) \ No newline at end of file diff --git a/tools/vscode/keybindings.json b/tools/vscode/keybindings.json new file mode 100644 index 0000000..de4390b --- /dev/null +++ b/tools/vscode/keybindings.json @@ -0,0 +1,485 @@ +// 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 + { + "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" + }, + { + "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 + // l : open file or folder + { // 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": "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" + }, + { + "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 59ede03..b7e7690 100644 --- a/tools/vscode/vscode.vimrc +++ b/tools/vscode/vscode.vimrc @@ -9,15 +9,122 @@ noremap n j noremap e k noremap i l +" Switch between tabs +noremap H :bprevious +noremap I :bnext + +noremap N 5j +noremap E 5k + " Similar position to i noremap l i noremap L I " ne[k]st noremap k n noremap K N -" [j]ump +" [j]ump noremap j e noremap J E " Y to yank to end of line -noremap Y y$ \ No newline at end of file +noremap Y y$ + +" 分词版本的w和b,支持中文,需要插件 +" Comment if you don't use cjk or the plugin +noremap w cjkWordHandler.cursorWordEndRight +noremap b cjkWordHandler.cursorWordStartLeft + +" keep selection after indent (define in settings.json) +" voremap < >gv + +" lsp +noremap gi editor.action.goToImplementation +noremap gpi editor.action.peekImplementation +noremap gd editor.action.goToDefinition +noremap gpd editor.action.peekDefinition +noremap gt editor.action.goToTypeDefinition +noremap gpt editor.action.peekTypeDefinition +noremap gh editor.action.showDefinitionPreviewHover + +noremap workbench.action.quickOpen +noremap : workbench.action.showCommands +" q : +quit +noremap qq :quit +noremap qQ :qall +noremap Q :quit +" w : +write/window +noremap ww :write +noremap wa :wall +noremap wq :wq +noremap W :write +noremap wh workbench.action.focusLeftGroup +noremap wH workbench.action.splitEditorLeft +noremap wn workbench.action.focusBelowGroup +noremap wN workbench.action.splitEditorDown +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 +noremap fc workbench.action.openSettings +noremap fC workbench.action.openFolderSettingsFile +noremap fe workbench.view.explorer +noremap fr workbench.action.showAllEditorsByMostRecentlyUsed +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 +noremap pc projectManager.openSettings#sideBarAny +noremap pe projectManager.editProjects +noremap pf projectManager.addToFavorites +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 +noremap uz workbench.action.toggleZenMode +" a : +ai/action +noremap aa inlineChat.start +noremap aA workbench.panel.chat +noremap ae workbench.action.chat.openEditSession +" r : +refactor +" s : +search +" t : +test +noremap tt testing.runAll +noremap tT testing.debugAll +noremap ta testing.runAll +noremap tA testing.debugAll +noremap tf testing.reRunFailedTests +noremap tF testing.debugFailedTests +noremap tl testing.reRunLastRun +noremap tL testing.debugLastRun +noremap tc testing.runCurrentTest +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