Set-PSReadLineKeyHandler -Chord Tab -ViMode Command -ScriptBlock {
$content = ""
$index = 0
[Microsoft.PowerShell.PSConsoleReadLine]::ViTabCompleteNext()
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref] $content, [ref] $index)
[Microsoft.PowerShell.PSConsoleReadLine]::RevertLine()
[Microsoft.PowerShell.PSConsoleReadLine]::Insert($content.Replace('\','/'))
[Microsoft.PowerShell.PSConsoleReadLine]::SetCursorPosition($index)
}
链接是这个: https://github.com/PowerShell/PSReadLine/issues/3205
cd 还有执行程序和.ps1 脚本都没啥问题,不过我也才用,可能会影响一些用到 cmd 工具的命令?