Skip to main content

Command Palette

Search for a command to run...

window powershell 下使用 oh-my-zsh

Published
1 min read
window powershell 下使用 oh-my-zsh

下载powershell7

powershell7 download

安装一些特殊字体

# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install

cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

推荐字体库

nerdfonts (用于解决powershell 图标乱码问题) 我使用的是 Hank Nerd Font Mono

安装 oh-my-posh

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

vscode 打开每次启动powershell的配置项

code $profile

注入以下代码 并保存

Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme powerlevel10k
 #or 旧版本powershell
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme powerlevel10k

允许自定义撰写脚本

set-ExecutionPolicy RemoteSigned

windows terminal 展示效果

image.png

vscode 下使用 增加字体规则

{
    "terminal.integrated.fontFamily": "Hank Nerd Font Mono",
}

vscode terminal 展示效果

image.png

2023-01-09 新增

使用 PSReadLine 代码提示 ```plaintext

powershell 注入以下代码 安装

Install-Module PSReadLine -Force ```

安装完成后修改 $profile

code $profile
# 引入与设置终端主题
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme powerlevel10k 

# 2023-01-09 新增
# PSReadLine
Import-Module PSReadLine
# Enable Prediction History
Set-PSReadLineOption -PredictionSource History
# Advanced Autocompletion for arrow keys 方向键检索历史
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward 
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward

效果图(使用F2切换InlineViewListView 模式)

文献

microsoft powershell

ohmyposh

More from this blog

Object.freeze() vs Object.seal() vs Object.preventExtensions()

今日详解ES5相关知识,区分下这三者的关系 Object.freeze() 冻结一个对象。这实际上是使对象不可变的最严格的方法。它执行以下操作: 防止添加新属性 不允许删除现有属性 不允许更改的直接属性 可以修改子对象的属 Object.seal() 封闭对象,防止向对象添加新属性。它执行以下操作: 允许更改对象的现有属性 防止添加新属性 不允许删除现有属性 Object.preventExtensions() 防止向对象添加新属性(即防止将来扩展对象)。它执行以下操作: 允许更改...

May 7, 20221 min read87
Object.freeze() vs Object.seal() vs Object.preventExtensions()

解决Virmach Vps, 谷歌搜索频繁人机验证问题

virmach机器速度还可以,但谷歌搜索的时候频繁出现“reCAPTCHA”人机验证,实在无解.. 查得问题是 virmach大部分是 RN、CC机房 IP段可能处于Google黑名单...、 1. 申请IPV6隧道 virmach并不自带ipv6, 则使用IPv6 隧道。 申请 https://tunnelbroker.net [一个账号可以申请 5 个隧道] 注册登陆。 在左侧的 User Functions 中,点击 Create Regular Tunnel. IPv4 E...

Dec 9, 20211 min read287
解决Virmach Vps, 谷歌搜索频繁人机验证问题
L

lolis

12 posts