首页 > 系统相关 >搭建优雅的Windows终端 Windows terminal+scoop+starship

搭建优雅的Windows终端 Windows terminal+scoop+starship

时间:2022-10-20 21:44:11浏览次数:83  
标签:name Windows yellow terminal scoop cyan FFFFFF cursorColor

一、安装Windows terminal

Windows应用商店搜索下载Windows terminal
image

二、安装Powershell 7

打开PowerShell,搜索最新版本

winget search Microsoft.PowerShell

输出:

$ winget search Microsoft.PowerShell
名称               ID                           版本    源
---------------------------------------------------------------
PowerShell         Microsoft.PowerShell         7.2.6.0 winget
PowerShell Preview Microsoft.PowerShell.Preview 7.3.8.0 winget

通过ID安装对应的PowerShell

# 一般安装这个
winget install --id Microsoft.Powershell --source winget

# 或者安装预览版的Powershell
winget install --id Microsoft.Powershell.Preview --source winget

三、使用Scoop

3.1 安装Scoop

Part from 搭建优雅编程环境

步骤 1:在 PowerShell 中打开远程权限

Set-ExecutionPolicy RemoteSigned -scope CurrentUser;

步骤 2:自定义 Scoop 安装目录

$env:SCOOP='Your_Scoop_Path'
[Environment]::SetEnvironmentVariable('SCOOP', $env:SCOOP, 'User')

如果跳过该步骤, Scoop 将默认把所有用户安装的 App 和 Scoop 本身置于C:\Users\user_name\scoop
步骤 3:下载并安装 Scoop

iwr -useb get.scoop.sh | iex
scoop update

上面无法下载的话,可以采用下方的国内镜像

iwr -useb https://gitee.com/glsnames/scoop-installer/raw/master/bin/install.ps1 | iex
scoop config SCOOP_REPO 'https://gitee.com/glsnames/scoop-installer'
scoop update

3.2 添加Scoop库

  • Scoop使用本地socks5代理
function proxyscoop {scoop config proxy 127.0.0.1:10809}
function unproxyscoop {scoop config rm proxy}

注意把10809改成自己本地代理的端口

之后就可以使用proxyscoop命令启用Scoop代理,unproxyscoop命令取消Scoop代理。

  • 查看官方推荐仓库
$ scoop bucket known
main [默认]
extras [墙裂推荐]
versions
nightlies
nirsoft
php
nerd-fonts
nonportable
java
games
jetbrains
  • 分别下载git、extras、nerd-fonts等
# 添加额外库
scoop bucket add extras
scoop bucket add nerd-fonts
# 安装git
scoop install git
# scoop插件
scoop install scoop-completion
# 安装FiraCode-NF字体
scoop install FiraCode-NF
# 使用 Linux 命令行
scoop install gow
# 调用管理员权限
scoop install sudo

3.3 Scoop 的管理与配置

# 查看已安装程序
scoop list
# 查看更新
scoop status
# 删除旧版本
scoop cleanup
# 自身诊断
scoop checkup

四、Starship

4.1 安装启用starship

打开powershell,使用 Scoop 安装

scoop install starship

或者使用winget安装

winget install --id Starship.Starship

使用VScode打开配置文件

code $PROFILE

配置文件中添加:

Invoke-Expression (&starship init powershell)

安装oh-my-posh

scoop install oh-my-posh

4.2 Windows terminal配置

打开下拉菜单——设置——左下角齿轮图标,编辑json配置文件
image

全选删除,粘贴以下内容

点击查看代码
{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": 
            {
                "action": "copy",
                "singleLine": false
            },
            "keys": "ctrl+c"
        },
        {
            "command": "paste",
            "keys": "ctrl+v"
        },
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        {
            "command": 
            {
                "action": "splitPane",
                "split": "auto",
                "splitMode": "duplicate"
            },
            "keys": "alt+shift+d"
        }
    ],
    "copyFormatting": "none",
    "copyOnSelect": true,
    "defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
    "profiles": 
    {
        "defaults": 
        {
            "opacity": 40,
            "useAcrylic": true
        },
        "list": 
        [
            {
                "backgroundImageOpacity": 0.25,
                "closeOnExit": "graceful",
                "colorScheme": "Aurora",
                "cursorColor": "#FFFFFF",
                "cursorShape": "filledBox",
                "font": 
                {
                    "face": "DejaVuSansMono Nerd Font",
                    "size": 12
                },
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "historySize": 8001,
                "name": "Windows PowerShell",
                "opacity": 75,
                "padding": "0, 0, 0, 0",
                "snapOnInput": true,
                "startingDirectory": "%USERPROFILE%",
                "useAcrylic": true
            },
            {
                "colorScheme": "Afterglow",
                "font": 
                {
                    "face": "CodeNewRoman Nerd Font"
                },
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "hidden": false,
                "name": "\u547d\u4ee4\u63d0\u793a\u7b26"
            },
            {
                "colorScheme": "AdventureTime",
                "font": 
                {
                    "face": "CodeNewRoman Nerd Font"
                },
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": false,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            },
            {
                "colorScheme": "One Half Dark",
                "font": 
                {
                    "face": "DejaVuSansMono Nerd Font"
                },
                "guid": "{2ece5bfe-50ed-5f3a-ab87-5cd4baafed2b}",
                "hidden": false,
                "name": "Git Bash",
                "source": "Git"
            },
            {
                "closeOnExit": "graceful",
                "colorScheme": "Homebrew",
                "commandline": "C:/Program Files/PowerShell/7/pwsh.exe -nologo",
                "cursorColor": "#FFFFFF",
                "cursorShape": "bar",
                "font": 
                {
                    "face": "FiraCode Nerd Font",
                    "size": 11
                },
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "historySize": 9001,
                "name": "PowerShell Core 7",
                "opacity": 50,
                "padding": "5, 5, 20, 25",
                "snapOnInput": true,
                "source": "Windows.Terminal.PowershellCore",
                "startingDirectory": ".",
                "useAcrylic": false
            }
        ]
    },
    "schemes": 
    [
        {
            "background": "#1F1D45",
            "black": "#050404",
            "blue": "#0F4AC6",
            "brightBlack": "#4E7CBF",
            "brightBlue": "#1997C6",
            "brightCyan": "#C8FAF4",
            "brightGreen": "#9EFF6E",
            "brightPurple": "#9B5953",
            "brightRed": "#FC5F5A",
            "brightWhite": "#F6F5FB",
            "brightYellow": "#EFC11A",
            "cursorColor": "#FFFFFF",
            "cyan": "#70A598",
            "foreground": "#F8DCC0",
            "green": "#4AB118",
            "name": "AdventureTime",
            "purple": "#665993",
            "red": "#BD0013",
            "selectionBackground": "#FFFFFF",
            "white": "#F8DCC0",
            "yellow": "#E7741E"
        },
        {
            "background": "#212121",
            "black": "#151515",
            "blue": "#6C99BB",
            "brightBlack": "#505050",
            "brightBlue": "#6C99BB",
            "brightCyan": "#7DD6CF",
            "brightGreen": "#7E8E50",
            "brightPurple": "#9F4E85",
            "brightRed": "#AC4142",
            "brightWhite": "#F5F5F5",
            "brightYellow": "#E5B567",
            "cursorColor": "#D0D0D0",
            "cyan": "#7DD6CF",
            "foreground": "#D0D0D0",
            "green": "#7E8E50",
            "name": "Afterglow",
            "purple": "#9F4E85",
            "red": "#AC4142",
            "selectionBackground": "#303030",
            "white": "#D0D0D0",
            "yellow": "#E5B567"
        },
        {
            "background": "#23262E",
            "black": "#23262E",
            "blue": "#0321D7",
            "brightBlack": "#4E7CBF",
            "brightBlue": "#03D6B8",
            "brightCyan": "#03D6B8",
            "brightGreen": "#8FD46D",
            "brightPurple": "#EE5D43",
            "brightRed": "#F92672",
            "brightWhite": "#C74DED",
            "brightYellow": "#FFE66D",
            "cursorColor": "#EE5D43",
            "cyan": "#03D6B8",
            "foreground": "#FFCA28",
            "green": "#8FD46D",
            "name": "Aurora",
            "purple": "#EE5D43",
            "red": "#F0266F",
            "selectionBackground": "#292E38",
            "white": "#C74DED",
            "yellow": "#FFE66D"
        },
        {
            "background": "#1F2430",
            "black": "#191E2A",
            "blue": "#6DCBFA",
            "brightBlack": "#686868",
            "brightBlue": "#73D0FF",
            "brightCyan": "#95E6CB",
            "brightGreen": "#BAE67E",
            "brightPurple": "#D4BFFF",
            "brightRed": "#F28779",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFD580",
            "cursorColor": "#FFCC66",
            "cyan": "#90E1C6",
            "foreground": "#CBCCC6",
            "green": "#A6CC70",
            "name": "Ayu Mirage",
            "purple": "#CFBAFA",
            "red": "#ED8274",
            "selectionBackground": "#33415E",
            "white": "#C7C7C7",
            "yellow": "#FAD07B"
        },
        {
            "background": "#0C0C0C",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#012456",
            "black": "#0C0C0C",
            "blue": "#0037DA",
            "brightBlack": "#767676",
            "brightBlue": "#3B78FF",
            "brightCyan": "#61D6D6",
            "brightGreen": "#16C60C",
            "brightPurple": "#B4009E",
            "brightRed": "#E74856",
            "brightWhite": "#F2F2F2",
            "brightYellow": "#F9F1A5",
            "cursorColor": "#FFFFFF",
            "cyan": "#3A96DD",
            "foreground": "#CCCCCC",
            "green": "#13A10E",
            "name": "Campbell Powershell",
            "purple": "#881798",
            "red": "#C50F1F",
            "selectionBackground": "#FFFFFF",
            "white": "#CCCCCC",
            "yellow": "#C19C00"
        },
        {
            "background": "#283033",
            "black": "#000000",
            "blue": "#6666E9",
            "brightBlack": "#D8E3F4",
            "brightBlue": "#0000FF",
            "brightCyan": "#00E5E5",
            "brightGreen": "#00D900",
            "brightPurple": "#E500E5",
            "brightRed": "#E50000",
            "brightWhite": "#E5E5E5",
            "brightYellow": "#E5E500",
            "cursorColor": "#FFFFFF",
            "cyan": "#00A6B2",
            "foreground": "#C7C7C7",
            "green": "#00A600",
            "name": "Homebrew",
            "purple": "#B200B2",
            "red": "#FC5275",
            "selectionBackground": "#FFFFFF",
            "white": "#BFBFBF",
            "yellow": "#999900"
        },
        {
            "background": "#282C34",
            "black": "#282C34",
            "blue": "#61AFEF",
            "brightBlack": "#5A6374",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B6C2",
            "brightGreen": "#98C379",
            "brightPurple": "#C678DD",
            "brightRed": "#E06C75",
            "brightWhite": "#DCDFE4",
            "brightYellow": "#E5C07B",
            "cursorColor": "#FFFFFF",
            "cyan": "#56B6C2",
            "foreground": "#DCDFE4",
            "green": "#98C379",
            "name": "One Half Dark",
            "purple": "#C678DD",
            "red": "#E06C75",
            "selectionBackground": "#FFFFFF",
            "white": "#DCDFE4",
            "yellow": "#E5C07B"
        },
        {
            "background": "#FAFAFA",
            "black": "#383A42",
            "blue": "#0184BC",
            "brightBlack": "#4F525D",
            "brightBlue": "#61AFEF",
            "brightCyan": "#56B5C1",
            "brightGreen": "#98C379",
            "brightPurple": "#C577DD",
            "brightRed": "#DF6C75",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#E4C07A",
            "cursorColor": "#4F525D",
            "cyan": "#0997B3",
            "foreground": "#383A42",
            "green": "#50A14F",
            "name": "One Half Light",
            "purple": "#A626A4",
            "red": "#E45649",
            "selectionBackground": "#FFFFFF",
            "white": "#FAFAFA",
            "yellow": "#C18301"
        },
        {
            "background": "#002B36",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#FFFFFF",
            "cyan": "#2AA198",
            "foreground": "#839496",
            "green": "#859900",
            "name": "Solarized Dark",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#FDF6E3",
            "black": "#002B36",
            "blue": "#268BD2",
            "brightBlack": "#073642",
            "brightBlue": "#839496",
            "brightCyan": "#93A1A1",
            "brightGreen": "#586E75",
            "brightPurple": "#6C71C4",
            "brightRed": "#CB4B16",
            "brightWhite": "#FDF6E3",
            "brightYellow": "#657B83",
            "cursorColor": "#002B36",
            "cyan": "#2AA198",
            "foreground": "#657B83",
            "green": "#859900",
            "name": "Solarized Light",
            "purple": "#D33682",
            "red": "#DC322F",
            "selectionBackground": "#FFFFFF",
            "white": "#EEE8D5",
            "yellow": "#B58900"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#D3D7CF",
            "green": "#4E9A06",
            "name": "Tango Dark",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#FFFFFF",
            "black": "#000000",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#000000",
            "cyan": "#06989A",
            "foreground": "#555753",
            "green": "#4E9A06",
            "name": "Tango Light",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#300A24",
            "black": "#2E3436",
            "blue": "#3465A4",
            "brightBlack": "#555753",
            "brightBlue": "#729FCF",
            "brightCyan": "#34E2E2",
            "brightGreen": "#8AE234",
            "brightPurple": "#AD7FA8",
            "brightRed": "#EF2929",
            "brightWhite": "#EEEEEC",
            "brightYellow": "#FCE94F",
            "cursorColor": "#FFFFFF",
            "cyan": "#06989A",
            "foreground": "#EEEEEC",
            "green": "#4E9A06",
            "name": "Ubuntu",
            "purple": "#75507B",
            "red": "#CC0000",
            "selectionBackground": "#FFFFFF",
            "white": "#D3D7CF",
            "yellow": "#C4A000"
        },
        {
            "background": "#000000",
            "black": "#000000",
            "blue": "#000080",
            "brightBlack": "#808080",
            "brightBlue": "#0000FF",
            "brightCyan": "#00FFFF",
            "brightGreen": "#00FF00",
            "brightPurple": "#FF00FF",
            "brightRed": "#FF0000",
            "brightWhite": "#FFFFFF",
            "brightYellow": "#FFFF00",
            "cursorColor": "#FFFFFF",
            "cyan": "#008080",
            "foreground": "#C0C0C0",
            "green": "#008000",
            "name": "Vintage",
            "purple": "#800080",
            "red": "#800000",
            "selectionBackground": "#FFFFFF",
            "white": "#C0C0C0",
            "yellow": "#808000"
        }
    ]
}
保存文件,退出。

4.3 PSReadLine

  • 安装
    打开Windows terminal,输入以下命令:
Install-Module PowerShellGet -scope CurrentUser -Force -AllowClobber
Install-Module PSReadLine -scope CurrentUser -Force
  • 配置
    打开配置文件
code $PROFILE

添加以下配置

Import-Module PSReadLine

Set-PSReadlineKeyHandler -Key Tab -Function Complete
Set-PSReadLineKeyHandler -Key "Ctrl+d" -Function MenuComplete
Set-PSReadLineKeyHandler -Key "Ctrl+z" -Function Undo
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward

image

4.4 整合Scoop

打开Windows terminal,输入以下命令:

Import-Module "$($(Get-Item $(Get-Command scoop).Path).Directory.Parent.FullName)\modules\scoop-completion"
Import-Module "$($(Get-Item $(Get-Command scoop).Path).Directory.Parent.FullName)\modules\scoop-completion" -ErrorAction SilentlyContinue

标签:name,Windows,yellow,terminal,scoop,cyan,FFFFFF,cursorColor
From: https://www.cnblogs.com/leebri/p/16811406.html

相关文章

  • VS2022创建Windows服务程序的方法步骤
    创建一个Windows服务程序可以创建Windows服务程序打开VS2022,新建项目。创建成功后的目录结构如左侧所示,至此项目构建完成。配置相关信息添加安装程序重新生......
  • windows10安装MYSQL服务端
    一、下载安装包1.下载地址:点击mysql安装包下载链接:https://dev.mysql.com/downloads/mysql/,选择window版本,点击下载按钮2.解压缩到无中文字符的路径:二、配置环境变量1.......
  • 8-jenkins windows环境下配置自动构建启动项目(springboot,gitlab,maven)
    由于远程办公原因,所以我们的服务必须在一个内网,所以就想到使用jenkins来实现提交后自动构建项目启动,不需要再登录到内网操作。jenkins的安装很简单,网上一大片,然后gitlab......
  • Windows活动目录_票据——敬请期待!
    票据:域控&域机子之间的信任密钥【缺省40天更换一次】域用户登录过程域用户的账户密码(用信任密钥加密的)传递至域控;域控验证账户密码成功后,构造域用户SID和组SID(用信任......
  • Navicat for MySQL 批量执行多个 SQL 文件---Windows-Type命令
    1.背景描述有个同事给发了一个数据库初始化sql文件夹,里面是有99个.sql文件,而我本地的数据库客户端是NavicatforMySQL,不论是在数据库上右键运行SQL文件还是在查询界面的......
  • Windows活动目录_初识
    计算机组织形式工作组(用户本地登录时构造SID进行权限分配);域(统一身份验证与管理)域注意事项实体:域控、域用户、加入域的机子。  依赖的服务:netlogon服务强制刷新组策......
  • windows端ping 工具带时间戳保存ping记录到本地
    新建txt文件,复制代码保存到新建文件后,修改文件后缀为.bat文件后。双击运行后会在本地脚本相同路径生成日志记录文件@echooffset/phost=host:setlogfile=ping_%host......
  • UTM 4.0 发布:在 macOS 上优雅的使用 QEMU 虚拟化 Windows、Linux 和 macOS
    UTM4底层基于QEMU,在Mac上安全的运行Windows、Linux和macOS,同时支持Intel处理器和Apple芯片,并且是开源免费的。WindowsLinux来到Apple芯片上UTM采用Ap......
  • 病毒&windows,linux机制
    前言以病毒流氓软件为引,了解windows,linux机制流氓软件p2p软件园360全家桶等等彻底删除文件,程序程序不要用系统带的卸载找到他本身程序的卸载exe,推荐用geek会自......
  • windows常用命令
    进程相关查看进程netstat-anto有端口号,pid等tasklist:有进程名字终结进程taskkill/f/t/pid数字tskill进程名称查询进程netstat|findstr名称taklist|find......