惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
Microsoft Azure Blog
Microsoft Azure Blog
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
阮一峰的网络日志
阮一峰的网络日志
D
Docker
Jina AI
Jina AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Register - Security
The Register - Security
J
Java Code Geeks
S
SegmentFault 最新的问题
月光博客
月光博客
G
Google Developers Blog
美团技术团队
Last Week in AI
Last Week in AI
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
T
The Blog of Author Tim Ferriss
腾讯CDC
Recent Announcements
Recent Announcements
Recorded Future
Recorded Future
The Cloudflare Blog
有赞技术团队
有赞技术团队
博客园_首页
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
B
Blog
I
InfoQ
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
F
Fortinet All Blogs
B
Blog RSS Feed
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
MongoDB | Blog
MongoDB | Blog
爱范儿
爱范儿
D
DataBreaches.Net
F
Full Disclosure
M
MIT News - Artificial intelligence
博客园 - 司徒正美
H
Help Net Security

PowerShell

求助在 Windows 桌面运行某个程序的多个实例并在整个穿够屏幕布满的 powershell 脚本, GPT 生成的也无法平铺位置随机的。 - V2EX 是我孤陋寡闻了吗? powershell 里面其实支持顺斜杠, tab 补全也能改成顺斜杠 - V2EX 求助:如何阻止 Powershell 生成 tmp 文件 请教 win11 powershell 设置别名的问题 - V2EX 如何确定 powershell 在终端输出的信息是 stdout 还是 stderr? - V2EX ps1 文件如何双击以管理员身份运行 - V2EX V2EX ps 无法显示 bash 命令的完整参数,是 bug 吗? - V2EX powershell setx 变量后无法自身得到变量值 - V2EX 请教, powershell 脚本中使用中文,脚本文本存储的是 utf-8,运行后中文就是乱码。 - V2EX oh-my-posh 导致 powershell 启动缓慢 - V2EX powershell 管道问题 - V2EX 如何在打开 powershell 脚本的时候, cd 到脚本所在目录 - V2EX 如何让 powershell 输出的 txt 日志为 unix lf 格式 - V2EX 这个 powershell "比对”命令能优化吗? - V2EX powershell 运行 ps 文件的时候,如何支持带空格的路径 - V2EX cmd 输出日志的时候,如何不写入重复日志 - V2EX 请教-关于 PowerShell 的使用场景问题——竞赛,编程挑战,运维需求在哪里找 - V2EX Windows 运行 ffmpeg 批量脚本的时候,如何在不中断的情况下限制 CPU 使用率 - V2EX cmd 控制台显示输出日志过滤 - V2EX powershell7, 执行速度和自动补全速度都慢的令我抓狂 - V2EX 请教一下.ps1 运行时如何让 powerShell 同时显示所运行命令的内容 - V2EX 有什么不错的 powershell 书籍吗? - V2EX PowerShell 是否可以实现类似 expect 的功能? - V2EX PowerShell 启动慢 - V2EX 现在 PowerShell 是不是没有什么用? - V2EX PowerShell 竟然强悍如斯! - V2EX 请问如何使用 powershell 禁用/启用设备? - V2EX 逐浪 CMSv8.2 发布-集成 Node 与 Vue 脚手架和 PowerShell 支持的新一代网站管理系统 Powershell 的管道兼容性 powershell 的独门秘技之气运“丹田” powershell 的 tab 参数补全的,两个不同方式详解。 - V2EX 在 PowerShell 中好好说话 在 PowerShell 中使用 fish-style 自动补全提示 - V2EX 怎么把一个脚本方法注册为系统的环境变量? - V2EX !微软又放鸽子了! - V2EX 分享 powershell ssh to Linux 脚本。 PowerShell Core 7.0 RC 已经发布 powershell 一个很诡异的问题 - V2EX powershell 的 ntp 校时脚本,光棍节秒杀专用! PowerShell 如何强行覆盖一个文件 - V2EX 如何使用命令行或 PowerShell 删除一个已经安装好的证书 PowerShell 如何导入已有的 SSL 证书 - V2EX PowerShell 如何定义文件夹的权限 - V2EX 推荐一个 github 上的 PowerShell 项目 - V2EX Out-GridView 在 PowerShell Core 中回归了 - V2EX powershell 6, 7 的新特性。 - V2EX 新出炉的 ssh-copy-id6.ps1,是新版 vscode 的最佳拍档 - V2EX 把那 5000 多万条企业数据放到 SQLite 数据库里
PowerShell 与 Windows Terminal 增强配置 - V2EX
raawaa · 2020-03-01 · via PowerShell

双系统切换来切换去还是挺麻烦的。加上 Windows Terminal + PowerShell 的体验越来越好于是去年年底把 Arch Linux 彻底卸掉了。本身不是专业的,在终端里最多就是批处理一下文件,PowerShell 开箱即用虽然挺糟糕,但是调教一下还是够用了。

PSReadLine

PSReadLine 是 PowerShell 的官方模块,为 PowerShell 提供了缺失的交互特性。例如像 zsh/fish 那样的交互式的补全、语法高亮、emacs 按键模式等等。有了 PSReadLIne 之后的 PowerShell 才终于像点样了。

安装(详见官方项目 README):

Install-Module PSReadLine

安装之后,PSReadLine 的一些特性并不会自动启用,可以在 PowerShell 的 profile 配置文件里自己按需配置。但是自己从头搞毕竟很烦,直接白嫖官方提供的配置样例就可以,已经非常好用了。

posh-git 与 oh-my-posh

posh-git 可以为 PowerShell 提供 git 命令补全。oh-my-posh 可以美化 prompt,提供各种主题。直接把两个一起安上:

Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser

在 profile 配置文件中启用模块并选择 prompt 样式主题:

Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Powerlevel10k-Lean

主要是配置字体和配色方案。配色方案可以在 iTerm2-Color-Schemes 这个项目中挑选。个人比较喜欢 Gruvbox Dark 配色。

Gruvbox Dark 配色预览

在 Windows Terminal 配置文件中加入 Gruvbox Dark 配色方案。

"schemes": [
    {
        "name": "Gruvbox Dark",
        "black": "#1e1e1e",
        "red": "#be0f17",
        "green": "#868715",
        "yellow": "#cc881a",
        "blue": "#377375",
        "purple": "#a04b73",
        "cyan": "#578e57",
        "white": "#978771",
        "brightBlack": "#7f7061",
        "brightRed": "#f73028",
        "brightGreen": "#aab01e",
        "brightYellow": "#f7b125",
        "brightBlue": "#719586",
        "brightPurple": "#c77089",
        "brightCyan": "#7db669",
        "brightWhite": "#e6d4a3",
        "background": "#1e1e1e",
        "foreground": "#e6d4a3"
   }
]

在 PowerShell 的 profile 部分选择 Gruvbox Dark 作为配色方案。同时做一些其他调整(因为 Windows Terminal 支持字体 ligature,所以选择了 Fira Code 字体):

{
    // Make changes here to the powershell.exe profile
    "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    "name": "Windows PowerShell",
    "commandline": "powershell.exe",
    "hidden": false,
    "fontFace": "Fira Code",  
    "fontSize": 11,
    "colorScheme": "Gruvbox Dark",
    "cursorShape": "vintage"
}

最终效果