跳到主要内容

nushell startship 命令行工具配置

安装nushell startship

nushell github地址 https://github.com/nushell/nushell startship github地址 https://github.com/starship/starship 官网 https://starship.rs/zh-cn/

安装配置

rust方式安装

cargo install nu cargo install starship --locked startip 能适配多种shell,这里是接合nushell来配置 先cmd打开cmd窗口输入nu进入nushell窗口

这里输入图片描述

初始化配置 mkdir ~/.cache/starship starship init nu | save ~/.cache/starship/init.nu

winodws用户会在C:\Users\用户名\.cache下生成配置文件

这里输入图片描述

输入$nu.config-path 可查看配置文件路径 C:\Users\little_y\AppData\Roaming\nushell\config.nu

在config.nu配置最下面添加如下配置

starship init nu | save ~/.cache/starship/init.nu
source ~/.cache/starship/init.nu

这里输入图片描述

手动安装

直接下载nushell startship的release二进制文件 https://github.com/nushell/nushell/releases

这里输入图片描述

https://github.com/starship/starship/releases

这里输入图片描述 配置好环境变量path就可以了

vscode 配置nushell

在vsocde Setting 中将nushell设置默认terminal

  "terminal.integrated.profiles.windows":{
"Nushell":{
//指向nu.exe
"path": "C:\\Users\\little_y\\.cargo\\bin\\nu.exe",
"args":[]
}
},
"terminal.integrated.defaultProfile.windows": "Nushell",

这里输入图片描述 每次打开vscode terminal就会现示nushell的命令窗口

这里输入图片描述

startship powershell配置

将以下内容添加到您 PowerShell 配置文件的末尾(通过运行 $PROFILE 来获取配置文件的路径)

Invoke-Expression (&starship init powershell)

这里输入图片描述

这里输入图片描述

如有如下报错 这里输入图片描述

这是Windows10自身为了安全,默认设置了执行策略,执行策略可帮助你防止执行不信任的脚本。 解决 1.以管理员运行powershell 2.

 Get-ExecutionPolicy -List

这里输入图片描述

set-executionpolicy remotesigned 

输入Y,回车即可 这里输入图片描述

作者邮箱githubgiteercsdn
littley1628466962@qq.comhttps://github.com/litttleyhttps://gitee.com/yylittlehttps://blog.csdn.net/m0_37696990