PowerShell安装scoop和oh-my-posh

news/2024/7/8 7:16:01

一、安装PowerShell

1、Github下载地址

GitHub - PowerShell/PowerShell: PowerShell for every system!

 建议下载TLS或者stable版本

2、查看PowerShell版本

输入 $PSVersionTable.PSVersion 命令

PS C:\Program Files\PowerShell\7> $PSVersionTable.PSVersion

Major  Minor  Patch  PreReleaseLabel BuildLabel
-----  -----  -----  --------------- ----------
7      2      17

二、安装scoop

Windows命令行包管理工具 Scoop,类似linux的yum、apt

1、更改脚本执行策略(必须)

Set-ExecutionPolicy RemoteSigned -scope CurrentUser;

PS C:\Program Files\PowerShell\7> Set-ExecutionPolicy RemoteSigned -scope CurrentUser;

2、设置scoop环境变量

$env:SCOOP='D:\Scoop'
[Environment]::SetEnvironmentVariable('SCOOP',$env:SCOOP,'User')

# 全局安装
# $env:SCOOP_GLOBAL='D:\Scoop'
# [environment]::setEnvironmentVariable('SCOOP_GLOBAL',$env:SCOOP_GLOBAL,'Machine')

PS C:\Program Files\PowerShell\7> $env:SCOOP='D:\Scoop'

PS C:\Program Files\PowerShell\7>[Environment]::SetEnvironmentVariable('SCOOP',$env:SCOOP,'User')

PS C:\Program Files\PowerShell\7> $env:SCOOP_GLOBAL='D:\Scoop'

PS C:\Program Files\PowerShell\7>[environment]::setEnvironmentVariable('SCOOP_GLOBAL',$env:SCOOP_GLOBAL,'Machine')

3、安装命令scoop

iex "& {$(iwr -useb get.scoop.sh)} -RunAsAdmin"

PS C:\Users\Administrator> iex "& {$(iwr -useb get.scoop.sh)} -RunAsAdmin"
Initializing...
Downloading ...
fatal: unable to access 'https://github.com/ScoopInstaller/Main.git/': HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
WARNING: Cloning failed. Falling back to downloading zip files.
Extracting...
Creating shim...
Adding D:\scoop\shims to your path.
Scoop was installed successfully!
Type 'scoop help' for instructions.

三、安装oh-my-posh

1、安装oh-my-posh

scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json

PS C:\Users\Administrator> scoop install https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json
Installing 'oh-my-posh' (18.25.1) [64bit]
install-amd64.exe (6.2 MB) [=================================================================] 100%
Checking hash of install-amd64.exe ... ok.
Running installer... done.
Linking D:\scoop\apps\oh-my-posh\current => D:\scoop\apps\oh-my-posh\18.25.1
Running post_install script...
Thanks for installing Oh My Posh.
Have a look at https://ohmyposh.dev for detailed instructions for your shell.
'oh-my-posh' (18.25.1) was installed successfully!

2、安装vim编辑器

PS C:\Users\Administrator> scoop install vim
Installing '7zip' (23.01) [64bit] from main bucket
7z2301-x64.msi (1.8 MB) [==============================] 100%
Checking hash of 7z2301-x64.msi ... ok.
Extracting 7z2301-x64.msi ... done.
Linking D:\scoop\apps\7zip\current => D:\scoop\apps\7zip\23.01
Creating shim for '7z'. 
Creating shim for '7zFM'. 
Creating shim for '7zG'. 
Creating shortcut for 7-Zip (7zFM.exe)
Persisting Codecs
Persisting Formats
Running post_install script... 
'7zip' (23.01) was installed successfully!
Notes
-----
Add 7-Zip as a context menu option by running: "D:\scoop\apps\7zip\current\install-context.reg"
Installing 'vim' (9.0) [64bit] from main bucket
gvim90.exe (9.7 MB) [=================================================================] 100% 
Checking hash of gvim90.exe ... ok.
Extracting dl.7z ... done.
Running pre_install script..
Linking D:\scoop\apps\vim\current => D:\scoop\apps\vim\9.0
Creating shim for 'vim'.
Creating shim for 'vi'. 
Creating shim for 'ex'. 
Creating shim for 'view'.
Creating shim for 'rvim'.
Creating shim for 'rview'. 
Creating shim for 'vimdiff'. 
Creating shim for 'gvim'.
Creating shim for 'gview'. 
Creating shim for 'evim'. 
Creating shim for 'eview'. 
Creating shim for 'rgvim'. 
Creating shim for 'rgview'. 
Creating shim for 'gvimdiff'.
Creating shim for 'xxd'. 
Creating shortcut for gVim (gvim.exe) 
Running post_install script... 
'vim' (9.0) was installed successfully! 
Notes
-----
Add gVim as a context menu option by running: "D:\scoop\apps\vim\current\install-context.reg"
'vim' suggests installing 'vimtutor'. 

3、选择oh-my-posh主题

从https://ohmyposh.dev/docs/themes下载对应的主题json文件

4、为powershell添加oh-my-posh使用:

vim $PROFILE

oh-my-posh init pwsh --config "C:\Users\Administrator\Documents\PowerShell\probua.minimal.omp.json" | Invoke-Expression

更换主题修改$PROFILE中对应的json主题文件即可

5、其他

# 添加国内镜像
scoop config SCOOP_REPO https://gitee.com/scoop-bucket/scoop

# 切回官方镜像
# scoop config SCOOP_REPO https://github.com/ScoopInstaller/Scoop

# 查看有哪些repo
scoop bucket known

# 添加bucklet
scoop bucket rm main
# scoop bucket add main

scoop bucket add main https://mirror.nju.edu.cn/git/scoop-main.git
scoop bucket add extras https://mirror.nju.edu.cn/git/scoop-extras.git
scoop bucket add dorado https://gitee.com/scoop-bucket/dorado.git

# 更新-每次添加完仓库记得更新
scoop update


http://lihuaxi.xjx100.cn/news/1803271.html

相关文章

Gdevops北京站 2023年全球敏捷运维峰会-核心PPT资料下载

一、峰会简介 2023 Gdevops全球敏捷运维峰会-北京站成功举办,一众产学研界技术大佬与新锐专家,以智能为主线,就数据库、运维、架构、金融科技等领域进行了前沿技术与实践经验交流,一同畅聊AIGC、云原生、数智化转型下的新机遇。 …

花 200 元测试 1300 个实时数据同步任务

背景 对于将数据作为重要生产资料的公司来说,超大规模的数据迁移同步系统( 1k、5k、10k 条同步任务)是刚需。 本文以此为出发点,介绍近期 CloudCanal 所做的一个容量测试:在单个 CloudCanal 集群上创建 1300 实时任务,验证系统是…

现有文章汇总

Cotent 项目开发FreeRTOS/ESP-IDFSTM32C/C 数据结构数据库Python基础Python实例PyQt5/Pyside2 上位机开发FlaskLinux运维树莓派4BCH552ESP32实例计算机网络Javaeclipsemicropython日常问题解决 项目开发 基于树莓派4B的车牌号识别 FreeRTOS/ESP-IDF Ubuntu下ESP-IDF的环境搭…

DAO和增删改查通用方法-BasicDao

文章目录 一、BasicDao是什么?二、BasicDao分析三、BasicDao实现(1)BasicDao(2)ActorDao(3)TestDao 四、总结 一、BasicDao是什么? BasicDao:基础的数据对象,可以完成通用…

【Linux】Alibaba Cloud Linux 3 安装 PHP8.1

一、系统安装 请参考 【Linux】Alibaba Cloud Linux 3 中第二硬盘、MySQL8.、MySQL7.、Redis、Nginx、Java 系统安装 二、安装源 rpm -ivh --nodeps https://rpms.remirepo.net/enterprise/remi-release-8.rpm sed -i s/PLATFORM_ID"platform:al8"/PLATFORM_ID&q…

RPC(远程过程调用)

RPC(远程过程调用)是一种用于不同计算机之间进行通信的协议和技术。它允许一个计算机程序调用远程计算机上的子程序或服务,就像调用本地计算机上的函数一样。 RPC出现的原因是为了解决多计算机环境下的分布式计算问题。在分布式系统中&#…

信息学奥赛一本通 1435:【例题3】曲线 | 洛谷 洛谷 P1883 函数

【题目链接】 ybt 1435:【例题3】曲线 洛谷 P1883 函数 【题目考点】 1. 三分 【解题思路】 每个 S i ( x ) S_i(x) Si​(x)是一个二次函数, F ( x ) m a x ( S i ( x ) ) F(x) max(S_i(x)) F(x)max(Si​(x)),即为所有二次函数当自变量…

NJU操作系统公开课笔记(1)

目录 一.计算机系统概述 二.计算机硬件系统 三.计算机软件系统 四.计算机操作技术的发展 五.计算机OS 1.资源管理的角度 2. 程序控制的角度 3.OS控制计算机的角度 4.人机交互的角度 5.程序接口的角度 6.系统结构的角度 单道批处理系统 多道批处理系统 分时系统 …