Windows Terminal配置 美化

安装PowerShell7

安装

  • 在powerShell 开启远程权限

    Set-ExecutionPolicy RemoteSigned -scope CurrentUser
    
  • scoop

    • 执行 iwr -useb https://gitee.com/glsnames/scoop-installer/raw/master/bin/install.ps1 | iex

      • 如果报错提示:Running the installer as administrator is disabled by default, see https://github.com/ScoopInstaller/Install#for-admin for details.
      • 取消 “默认情况下禁用以管理员身份运行安装程序” iex "& {$(irm get.scoop.sh)} -RunAsAdmin"
    • 设置国内镜像

      scoop config SCOOP_REPO 'https://gitee.com/glsnames/scoop-installer'
      
    • 更新

配置文件

  • 安装插件

    1. 安装 PSReadline 插件,可以查看历史命令,类似 zsh的incr插件

    Install-Module -Name PSReadLine -Scope CurrentUser -Force -SkipPublisherCheck

    1. 安装 posh-git 插件,Posh-git 将 Git 状态摘要添加到 Windows 终端提示中,其中包含 Git 命令、参数、远程和分支名称的信息和选项卡完成。

    Install-Module posh-git -Scope CurrentUser

    1. 安装 oh-my-posh 插件,这个插件能够使用全彩色集来定义和呈现您的终端提示,包括使用内置主题或创建您自己的自定义主题的能力。
    Install-Module oh-my-posh
    
    1. ls 显示彩色目录

      dircolors 是 Linux 下的命令,可以设置 ls 指令在显示目录或文件时的色彩,同样的,如果也想让 PowerShell 显示彩色目录,可用插件 DirColors 实现。

      Install-Module DirColors
      

    若是有提示输入A

  • 安装oh-my-post

    winget install JanDeDobbeleer.OhMyPosh -s winget

  • 打开配置文件

     notepad $PROFILE
    
#插件导入
Import-Module posh-git
 
Import-Module oh-my-posh
 
Import-Module PSReadLine
 
Import-Module DirColors

#快捷键设置

# 设置主题
Set-PoshPrompt Agnoster 
# 设置预测文本来源为历史记录
Set-PSReadLineOption -PredictionSource History
 
# 每次回溯输入历史,光标定位于输入内容末尾
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
 
# 设置 Tab 为菜单补全和 Intellisense
Set-PSReadLineKeyHandler -Key "Tab" -Function MenuComplete
 
# 设置 Ctrl+d 为退出 PowerShell
Set-PSReadlineKeyHandler -Key "Ctrl+d" -Function ViExit
 
# 设置 Ctrl+z 为撤销
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo
 
# 设置向上键为后向搜索历史记录
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
 
# 设置向下键为前向搜索历史纪录
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
 
# 设置主题
oh-my-posh init pwsh --config ~/jandedobbeleer.omp.json | Invoke-Expression

function proxy{
    $env:all_proxy="http://127.0.0.1:7890"
}

function noproxy{
    $env:unsetproxy=""
}

settings.json

  • 打开json文件

    在这里插入图片描述

  • 添加毛玻璃效果

    profiles->defaults下添加

    // 开启毛玻璃效果
    "useAcrylic":true,
    // 毛玻璃透明度
    "acrylicOpacity":0.5,
    
  • 27
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值