powershell美化

配置json, 这里采用的字体是Sarasa Term SC, github地址https://github.com/be5invis/Sarasa-Gothic

{
    "cursor_size":  "small",
    "font_face":  "Sarasa Term SC",
    "font_size":  "0x20",
    "popup_colors":  "cyan,white",
    "dark_gray":  "#666666",
    "screen_colors":  "white,black",
    "dark_green":  "#0dbc79",
    "command_history_no_duplication":  false,
    "window_size":  "120x30",
    "font_weight":  0,
    "screen_buffer_size":  "120x30000",
    "blue":  "#3b8eea",
    "command_history_length":  500,
    "font_true_type":  true,
    "dark_yellow":  "#e5e510",
    "quick_edit":  true,
    "red":  "#f14c4c",
    "insert_mode":  true,
    "magenta":  "#d670d6",
    "dark_red":  "#cd3131",
    "load_console_IME":  true,
    "yellow":  "#f5f543",
    "dark_magenta":  "#bc3fbc",
    "cyan":  "#29b8db",
    "green":  "#23d18b",
    "dark_blue":  "#2472c8",
    "gray":  "#e5e5e5",
    "white":  "#e5e5e5",
    "fullscreen":  false,
    "num_history_buffers":  4,
    "black":  "#1e1e1e",
    "dark_cyan":  "#11a8cd",
    "window_alpha":  255
}

安装相应的库

scoop install concfg
scoop install posh-git 
scoop install oh-my-posh

post-git显示git的状态,oh-my-post美化路径显示
导入前面的配置

concfg import myconfig.json

我的自定义配置,可以在powershell中看环境变量$profile

我的配置

chcp 65001
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Agnoster
try { $null = Get-Command concfg -ea stop; concfg tokencolor -n enable } catch { }

最后try行应该是concfg启用的关键字显示标识颜色。这里on-my-posh采用的主题是Sorin,

chcp更改控制台编码utf-8。

原文地址:https://www.cnblogs.com/xuzhen97/p/12288565.html