Sync from Windows

This commit is contained in:
js0ny 2025-01-20 09:33:07 +00:00
parent 61d3539d2a
commit ae8625f3a6
14 changed files with 9606 additions and 90 deletions

View file

@ -13,8 +13,11 @@ function Invoke-Completion {
}
'git' { Import-Module Posh-Git }
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
'just' { just --completions powershell | Out-String | Invoke-Expression }
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
'pixi' { pixi completion --shell powershell | Out-String | Invoke-Expression }
'rg' { rg --generate complete-powershell | Out-String | Invoke-Expression }
'rustup' { rustup completions powershell rustup | Out-String | Invoke-Expression }
'uv' { uv generate-shell-completion powershell | Out-String | Invoke-Expression }
'wezterm' { wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression }
'winget' {
@ -36,7 +39,12 @@ Set-Alias "icmp" "Invoke-Completion"
Register-ArgumentCompleter -CommandName Invoke-Completion -ParameterName 'command' -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
$cmds = @('docker', 'dotnet', 'git', 'hugo', 'pip', 'rg', 'uv', 'wezterm', 'winget')
$cmds = @('docker', 'dotnet', 'git', 'hugo', 'just', 'pip', 'pixi', 'rg', 'rustup', 'uv', 'wezterm', 'winget')
$cmds | Where-Object { $_ -like "$wordToComplete*" }
}
if ($isWindows) {
Invoke-Completion winget # Enable winget tab completion by default
}

View file

@ -26,6 +26,5 @@ Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory
Set-PSReadLineKeyHandler -Chord "Ctrl+p" -Function PreviousHistory
Set-PSReadLineKeyHandler -Chord "Ctrl+n" -Function NextHistory
## Use <Tab> to Invoke MenuComplete
Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete

View file

@ -7,3 +7,7 @@ if ($IsWindows) {
# WinGet
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
}
Import-Module -Name PSFzf
Set-PSReadLineKeyHandler -Chord "Ctrl-r" -ScriptBlock { Invoke-FuzzyHistory }

File diff suppressed because it is too large Load diff

View file

@ -52,6 +52,10 @@ noremap gpd editor.action.peekDefinition
noremap gt editor.action.goToTypeDefinition
noremap gpt editor.action.peekTypeDefinition
noremap gh editor.action.showDefinitionPreviewHover
noremap gr editor.action.goToReferences
noremap gpr editor.action.referenceSearch.trigger
noremap zR editor.foldAll
noremap <leader><leader> workbench.action.quickOpen
noremap <leader>/ workbench.action.quickTextSearch

View file

@ -4,6 +4,9 @@
" And go to vscode vim setting:
"vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc",
" For all available options see
" https://github.com/VSCodeVim/Vim/blob/d41e286e9238b004f02b425d082d3b4181d83368/src/configuration/vimrc.ts#L120-L407
" Use VSpaceCode instead of <leader>
noremap <space> vspacecode.space
@ -34,18 +37,8 @@ noremap J E
" Y to yank to end of line
noremap Y y$
" Define in settings.json, since this will remap <esc> under visual mode
" noremap <esc> :nohlsearch<CR>
nnoremap <esc> :nohlsearch<CR>
" 分词版本的w和b支持中文需要插件
" 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap`
" Comment if you don't use cjk or the plugin
nmap w cjkWordHandler.cursorWordEndRight
nmap b cjkWordHandler.cursorWordStartLeft
" keep selection after indent (define in settings.json)
" voremap < <gv
" voremap > >gv
" lsp
noremap gi editor.action.goToImplementation
@ -55,3 +48,17 @@ noremap gpd editor.action.peekDefinition
noremap gt editor.action.goToTypeDefinition
noremap gpt editor.action.peekTypeDefinition
noremap gh editor.action.showDefinitionPreviewHover
noremap gr editor.action.goToReferences
noremap gpr editor.action.referenceSearch.trigger
noremap zR editor.foldAll
" keep selection after indent (define in settings.json)
vnoremap < editor.action.outdentLines
vnoremap > editor.action.indentLines
" 分词版本的w和b支持中文需要插件
" 为了保证递归解析,而不是打断,使用 `nmap` 而不是 `nnoremap`
" Comment if you don't use cjk or the plugin
nmap w cjkWordHandler.cursorWordEndRight
nmap b cjkWordHandler.cursorWordStartLeft