V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
proxytoworld
V2EX  ›  问与答

我台式机的 vscode 里面的 powershell 带了跟 zsh 一样的历史命令记忆功能,不知道咋开的,有了解的知道怎么主动开启吗

  •  1
     
  •   proxytoworld · 2023-01-31 12:27:25 +08:00 · 1081 次点击
    这是一个创建于 422 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如图,想在笔记本上也开启,不知道在哪设置

    13 条回复    2023-01-31 17:05:12 +08:00
    FanyFull
        1
    FanyFull  
       2023-01-31 12:33:12 +08:00 via Android
    PowerShell 升级到最新版即可。这个是刚加入的功能。
    sky96111
        2
    sky96111  
       2023-01-31 12:35:21 +08:00 via Android
    在$Profile 里写入
    ````
    Import-Module PSReadLine
    Set-PSReadLineOption -PredictionSource History
    ````
    ps 版本在 5.0 以上可以直接写,系统自带的低版本 ps 需要安装 PSReadLine
    SuperMild
        3
    SuperMild  
       2023-01-31 12:35:51 +08:00
    新版的功能,当时我也很惊喜,这功能实在太好用了
    proxytoworld
        4
    proxytoworld  
    OP
       2023-01-31 12:48:57 +08:00
    @FanyFull 为什么 win+r 启动 powershell 不会有这个记忆功能,难道 vscode 启动的 powershell 不一样嘛
    proxytoworld
        5
    proxytoworld  
    OP
       2023-01-31 12:55:38 +08:00
    @proxytoworld 知道原因了,vscode 启动的和系统启动的 powershell 不一样
    xuyang2
        6
    xuyang2  
       2023-01-31 14:06:24 +08:00
    Yukiteru
        7
    Yukiteru  
       2023-01-31 14:52:43 +08:00
    Powershell7 自带这个功能,windows 终端里默认启动的工具是老版本的 powershell ,在设置里改一下就行了。
    proxytoworld
        8
    proxytoworld  
    OP
       2023-01-31 15:51:37 +08:00
    @Yukiteru 安装 ps7 就 OK 了,也不用改(装了 powershell 拓展
    ShineyWang
        9
    ShineyWang  
       2023-01-31 16:19:14 +08:00
    借楼问个问题,这里面预览的命令使用什么键可以直接输入?
    一般这个时候我会按 tab,但 tab 是使用当前输入的字符搜索可用命令
    可能要按好几下才能出来预览的这个命令
    kamal
        10
    kamal  
       2023-01-31 16:24:32 +08:00
    同问,出现提示的时候,按哪个键,才能自动补全?
    proxytoworld
        11
    proxytoworld  
    OP
       2023-01-31 16:46:47 +08:00   ❤️ 1
    @kamal 方向右键
    proxytoworld
        12
    proxytoworld  
    OP
       2023-01-31 16:47:00 +08:00
    brucmao
        13
    brucmao  
       2023-01-31 17:05:12 +08:00
    Set-PSReadLineOption -PredictionViewStyle ListView
    https://s3.bmp.ovh/imgs/2023/01/31/cd87a58fa2034d8e.png
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5294 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 09:24 · PVG 17:24 · LAX 02:24 · JFK 05:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.