英文:
How to partially autocomplete?
问题
我正在使用 PSReadLine 版本 2.2.6(与 PowerShell 7.3 一起使用),具有以下配置选项:
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -EditMode Windows
假设在我的历史记录中,我先前输入过:
remove-Item -Force -Recurse .\node_modules\
但现在我只想更改 .\node_modules\
。当我开始输入 remove
时,PSReadLine 会建议整个行,有没有一种方法可以验证建议命令的某些部分?
更明确地说,我想自动完成,直到(不包括)下图中第2部分,以便更改文件夹的名称:
在这个例子中,我可以直接到末尾并使用 Ctrl + Backspace,但有时命令参数(如 -Force 和 -Recurse)位于末尾,我想保留它们。
英文:
I'm using PSReadLine version 2.2.6 (with PowerShell 7.3.) with the following configuration options:
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -EditMode Windows
Imagine that in my history, I have previously typed:
remove-Item -Force -Recurse .\node_modules\
But now I just want to change .\node_modules\
When I start to type remove
, PSReadLine suggest me the whole line, is there a way to validate some parts of the suggested commands?
To be more clear, I want to autocomplete until (excluded) part 2 of the following picture to be able to change the folder's name:
In this example I could just go to the end and use Ctrl + Backspace but sometimes the command parameters (like -Force and -Recurse) are located at the end and I want to keep them.
答案1
得分: 1
这里讨论了一些关键绑定选项和一个示例 $profile:https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/
英文:
Some of the keybinding options and a sample $profile are discussed here: https://devblogs.microsoft.com/powershell/announcing-psreadline-2-1-with-predictive-intellisense/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论