共计 621 个字符,预计需要花费 2 分钟才能阅读完成。
最近从 linux 换会 windows, 感觉 powershell 里面反斜杠有点不爽,后面查了一下 pwsh 是支持顺斜杠的,不过 tab 补全是反斜杠,然后在 github 上面也找到了将 tab 补全改成斜杠的设置
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 工具的命令?
正文完