一款优秀的Linux终端Starship
admin
2024-03-26 06:51:18
0

简介

Starship是一款轻量、迅速、可无限定制的高颜值终端!

兼容性优先
Starship 可以在各种常见的操作系统和常见的 shell 上运行。

使用 Rust 编写
具有 Rust 独树一帜的速度与安全性,使你的提示符尽可能的快速可靠。

可自定义
每个小细节都可以按您喜欢的自定义,不论是最小化以求速度,还是最大化以获得最完善的功能。

安装

1.安装 starship 二进制文件:

安装最新版本

使用 Shell 命令:

curl -sS https://starship.rs/install.sh | sh    

自更新 Starship ,运行下面脚本 将会在不改动 Starship 配置文件的情况下升级版本

实际运行

[root@localhost ~]# curl -sS https://starship.rs/install.sh | shConfiguration
> Bin directory: /usr/local/bin
> Platform:      unknown-linux-musl
> Arch:          x86_64> Tarball URL: https://github.com/starship/starship/releases/latest/download/starship-x86_64-unknown-linux-musl.tar.gz
? Install Starship latest to /usr/local/bin? [y/N] y
> Installing Starship, please wait…
✓ Starship installed> Please follow the steps for your shell to complete the installation:bashAdd the following to the end of ~/.bashrc:eval "$(starship init bash)"zshAdd the following to the end of ~/.zshrc:eval "$(starship init zsh)"ionAdd the following to the end of ~/.config/ion/initrc:eval $(starship init ion)tcshAdd the following to the end of ~/.tcshrc:eval `starship init tcsh`xonshAdd the following to the end of ~/.xonshrc:execx($(starship init xonsh))fishAdd the following to the end of ~/.config/fish/config.fish:starship init fish | sourceelvishWarning Only elvish v0.17 or higher is supported.And add the following to the end of ~/.elvish/rc.elv:eval (starship init elvish)nushellWarning This will change in the future.Only Nushell v0.61 or higher is supported.Add the following to the end of your Nushell env file (find it by running $nu.env-path in Nushell): "mkdir ~/.cache/starship; starship init nu | save ~/.cache/starship/init.nu"And add the following to the end of your nu config file (find it by running $nu.config-path in Nushell):mkdir ~/.cache/starshipstarship init nu | save ~/.cache/starship/init.nusource ~/.cache/starship/init.nuPowerShellAdd the following to the end of Microsoft.PowerShell_profile.ps1:You can check the location of this file by querying the $PROFILE variable in PowerShell.Typically the path is ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 or ~/.config/powershell/Microsoft.PowerShell_profile.ps1 on -Nix.Invoke-Expression (&starship init powershell)CmdYou need to use Clink (v1.2.30+) with Cmd. Add the following to a file starship.lua and place this file in Clink scripts directory:load(io.popen('starship init cmd'):read("*a"))()[root@localhost ~]#

2.将初始化脚本添加到您的 shell 的配置文件:

Bash

~/.bashhrc 的最后,添加以下内容:

# ~/.bashrceval "$(starship init bash)"

实际操作

vim ~/.bashrc

# .bashrc# User specific aliases and functionsalias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'# Source global definitions
if [ -f /etc/bashrc ]; then. /etc/bashrc
fieval "$(starship init bash)"
~                                   

配置

https://starship.rs/zh-CN/config/#username

您需要创建配置文件 ~/.config/starship.toml 以供 Starship 使用。

mkdir -p ~/.config && touch ~/.config/starship.toml

Starship 的所有配置都在此 TOML 配置文件中完成:

# 设置配置范例,开启编辑器的自动补全
"$schema" = 'https://starship.rs/config-schema.json'# 在命令之间插入空行
add_newline = true# 将提示符的“❯”替换为“➜”
[character] # “character”是我们正在配置的组件
success_symbol = "[➜](bold green)" # 设置“success_symbol” 字段为绿色加粗的“➜”# 禁用 package 组件,完全隐藏它的提示符
[package]
disabled = true

您可以使用 STARSHIP_CONFIG 环境变量更改默认配置文件的位置:

export STARSHIP_CONFIG=~/example/non/default/path/starship.toml

其他模式:

# Use custom format
format = """
[┌───────────────────>](bold green)
[│](bold green)$directory$rust$package
[└─>](bold green) """# Wait 10 milliseconds for starship to check files under the current directory.
scan_timeout = 10# Disable the blank line at the start of the prompt
add_newline = false

效果

┌───────────────────>  localhost in  root in 
│/var/www/html 
└─>

日志

默认情况下,Starship 会将警告和错误日志记录到文件 ~/.cache/starship/session_${STARSHIP_SESSION_KEY}.log. 其中 session key 与您的终端实例相对应。 不过,这也可以使用 STARSHIP_CACHE 环境变量来修改:

export STARSHIP_CACHE=~/.starship/cache

安装字体nerd-fonts

https://www.nerdfonts.com/
https://github.com/ryanoasis/nerd-fonts/

在里面选择一个自己喜欢的字体,我选择下载了JetBrainsMono.zip 字体。

编写脚本安装字体

vim install.sh

# array中换成你要安装的字体的zip压缩包的名称
array=(JetBrainsMono DroidSansMono DejaVuSansMono UbuntuMono CodeNewRoman BitstreamVeraSansMono)
current_dir=`pwd`
for font in ${array[@]}
dosudo unzip ${font} -d /usr/share/fonts/${font}cd /usr/share/fonts/${font}sudo mkfontscale # 生成核心字体信息sudo mkfontdir # 生成字体文件夹sudo fc-cache -fv # 刷新系统字体缓存cd ${current_dir}
done

安装 fish

说明

Fish Shell是一个非常优秀的终端 Shell 工具,拥有许多开箱即用的功能,例如语法自动推荐补全、语法高亮显示或使用快捷键在最近访问的文件夹之间来回切换。

https://fishshell.com/
https://fishshell.com/docs/current/index.html#syntax-overview

yum install fish -y

实际安装

yum install  fish
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                | 7.9 kB  00:00:00     * base: mirrors.ustc.edu.cn* epel: mirrors.bfsu.edu.cn* extras: mirrors.ustc.edu.cn* updates: mirrors.ustc.edu.cn
atomic                                                                                                                                              | 3.0 kB  00:00:00     
base                                                                                                                                                | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                                    | 3.5 kB  00:00:00     
epel                                                                                                                                                | 4.7 kB  00:00:00     
extras                                                                                                                                              | 2.9 kB  00:00:00     
updates                                                                                                                                             | 2.9 kB  00:00:00     
webtatic                                                                                                                                            | 3.6 kB  00:00:00     
正在解决依赖关系
--> 正在检查事务
---> 软件包 fish.x86_64.0.2.3.1-2.el7 将被 安装
--> 解决依赖关系完成依赖关系解决=====================================================================================================Package                               架构                                    版本                                            源                                     大小
============================================================================================================
正在安装:fish                                  x86_64                                  2.3.1-2.el7                                     epel                                  1.5 M事务概要
=============================================================================================
安装  1 软件包总下载量:1.5 M
安装大小:7.4 M
Is this ok [y/d/N]: y
Downloading packages:
fish-2.3.1-2.el7.x86_64.rpm                                    | 1.5 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在安装    : fish-2.3.1-2.el7.x86_64                                                                                                                                1/1 验证中      : fish-2.3.1-2.el7.x86_64                                                                                                                                1/1 已安装:fish.x86_64 0:2.3.1-2.el7                                                                                                                                                完毕!

启动fish

fish

相关内容

热门资讯

linux入门---制作进度条 了解缓冲区 我们首先来看看下面的操作: 我们首先创建了一个文件并在这个文件里面添加了...
C++ 机房预约系统(六):学... 8、 学生模块 8.1 学生子菜单、登录和注销 实现步骤: 在Student.cpp的...
A.机器学习入门算法(三):基... 机器学习算法(三):K近邻(k-nearest neigh...
数字温湿度传感器DHT11模块... 模块实例https://blog.csdn.net/qq_38393591/article/deta...
有限元三角形单元的等效节点力 文章目录前言一、重新复习一下有限元三角形单元的理论1、三角形单元的形函数(Nÿ...
Redis 所有支持的数据结构... Redis 是一种开源的基于键值对存储的 NoSQL 数据库,支持多种数据结构。以下是...
win下pytorch安装—c... 安装目录一、cuda安装1.1、cuda版本选择1.2、下载安装二、cudnn安装三、pytorch...
MySQL基础-多表查询 文章目录MySQL基础-多表查询一、案例及引入1、基础概念2、笛卡尔积的理解二、多表查询的分类1、等...
keil调试专题篇 调试的前提是需要连接调试器比如STLINK。 然后点击菜单或者快捷图标均可进入调试模式。 如果前面...
MATLAB | 全网最详细网... 一篇超超超长,超超超全面网络图绘制教程,本篇基本能讲清楚所有绘制要点&#...
IHome主页 - 让你的浏览... 随着互联网的发展,人们越来越离不开浏览器了。每天上班、学习、娱乐,浏览器...
TCP 协议 一、TCP 协议概念 TCP即传输控制协议(Transmission Control ...
营业执照的经营范围有哪些 营业执照的经营范围有哪些 经营范围是指企业可以从事的生产经营与服务项目,是进行公司注册...
C++ 可变体(variant... 一、可变体(variant) 基础用法 Union的问题: 无法知道当前使用的类型是什...
血压计语音芯片,电子医疗设备声... 语音电子血压计是带有语音提示功能的电子血压计,测量前至测量结果全程语音播报࿰...
MySQL OCP888题解0... 文章目录1、原题1.1、英文原题1.2、答案2、题目解析2.1、题干解析2.2、选项解析3、知识点3...
【2023-Pytorch-检... (肆十二想说的一些话)Yolo这个系列我们已经更新了大概一年的时间,现在基本的流程也走走通了,包含数...
实战项目:保险行业用户分类 这里写目录标题1、项目介绍1.1 行业背景1.2 数据介绍2、代码实现导入数据探索数据处理列标签名异...
记录--我在前端干工地(thr... 这里给大家分享我在网上总结出来的一些知识,希望对大家有所帮助 前段时间接触了Th...
43 openEuler搭建A... 文章目录43 openEuler搭建Apache服务器-配置文件说明和管理模块43.1 配置文件说明...