Git Bash 配置 zsh

博客食用更佳 博客链接

安装 zsh

安装 Zsh

安装 Oh-my-zsh

github仓库

bash 复制代码
sh -c "$(curl -fsSL https://install.ohmyz.sh/)"

让 zsh 成为 git bash 默认终端

bash 复制代码
vi ~/.bashrc

写入:

.bashrc 复制代码
if [ -t 1 ]; then
  exec zsh
fi
bash 复制代码
source ~/.bashrc

再重启即可。

更换主题

主题选择

安装主题 powerlevel10k

bash 复制代码
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

打开配置文件

bash 复制代码
vi ~/.zshrc
.zshrc 复制代码
ZSH_THEME="powerlevel10k/powerlevel10k"

使得主题生效

bash 复制代码
source ~/.zshrc

如果想重新配置 powerlevel10k 界面

bash 复制代码
p10k configure

插件安装

高亮插件

zsh-syntax-highlighting

bash 复制代码
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

自动补全插件

zsh-autosuggestions

bash 复制代码
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

使插件生效

bash 复制代码
vi ~/.zshrc

插件生效

bash 复制代码
plugins=( git zsh-syntax-highlighting zsh-autosuggestions )
bash 复制代码
source ~/.zshrc

使用 lsd 配色

官方仓库

安装 lsd

可以使用 scoop 方式,其他方式见官方文档

bash 复制代码
scoop install lsd

$HOME/.config/lsd 下创建配置文件 config. yml

yml 复制代码
# == Classic ==
# This is a shorthand to override some of the options to be backwards compatible
# with `ls`. It affects the "color"->"when", "sorting"->"dir-grouping", "date"
# and "icons"->"when" options.
# Possible values: false, true
classic: false

# == Blocks ==
# This specifies the columns and their order when using the long and the tree
# layout.
# Possible values: permission, user, group, context, size, date, name, inode, links, git
blocks:
    - permission
    - user
    - group
    - size
    - date
    - name

# == Color ==
# This has various color options. (Will be expanded in the future.)
color:
    # When to colorize the output.
    # When "classic" is set, this is set to "never".
    # Possible values: never, auto, always
    when: auto
    # How to colorize the output.
    # When "classic" is set, this is set to "no-color".
    # Possible values: default, custom
    # When "custom" is set, lsd will look in the config directory for `colors.yaml`.
    theme: default

# == Date ==
# This specifies the date format for the date column. The freeform format
# accepts a strftime like string.
# When "classic" is set, this is set to "date".
# Possible values: date, locale, relative, '+<date_format>'
# `date_format` will be a `strftime` formatted value. e.g. `date: '+%d %b %y %X'` will give you a date like this: 17 Jun 21 20:14:55
date: date

# == Dereference ==
# Whether to dereference symbolic links.
# Possible values: false, true
dereference: false

# == Display ==
# What items to display. Do not specify this for the default behavior.
# Possible values: all, almost-all, directory-only
# display: all

# == Icons ==
icons:
    # When to use icons.
    # When "classic" is set, this is set to "never".
    # Possible values: always, auto, never
    when: auto
    # Which icon theme to use.
    # Possible values: fancy, unicode
    theme: fancy
    # Separator between icon and the name
    # Default to 1 space
    separator: " "

# == Ignore Globs ==
# A list of globs to ignore when listing.
# ignore-globs:
#   - .git

# == Indicators ==
# Whether to add indicator characters to certain listed files.
# Possible values: false, true
indicators: false

# == Layout ==
# Which layout to use. "oneline" might be a bit confusing here and should be
# called "one-per-line". It might be changed in the future.
# Possible values: grid, tree, oneline
layout: grid

# == Recursion ==
recursion:
    # Whether to enable recursion.
    # Possible values: false, true
    enabled: false
    # How deep the recursion should go. This has to be a positive integer. Leave
    # it unspecified for (virtually) infinite.
    # depth: 3

# == Size ==
# Specifies the format of the size column.
# Possible values: default, short, bytes
size: default

# == Permission ==
# Specify the format of the permission column
# Possible value: rwx, octal, attributes (windows only), disable
permission: rwx

# == Sorting ==
sorting:
    # Specify what to sort by.
    # Possible values: extension, name, time, size, version
    column: name
    # Whether to reverse the sorting.
    # Possible values: false, true
    reverse: false
    # Whether to group directories together and where.
    # When "classic" is set, this is set to "none".
    # Possible values: first, last, none
    dir-grouping: none

# == No Symlink ==
# Whether to omit showing symlink targets
# Possible values: false, true
no-symlink: false

# == Total size ==
# Whether to display the total size of directories.
# Possible values: false, true
total-size: false

# == Hyperlink ==
# Attach hyperlink to filenames
# Possible values: always, auto, never
hyperlink: never

# == Symlink arrow ==
# Specifies how the symlink arrow display, chars in both ascii and utf8
symlink-arrow: ⇒

# == Header ==
# Whether to display block headers.
# Possible values: false, true
header: true

# == Literal ==
# Whether to show quotes on filenames.
# Possible values: false, true
literal: false

# == Truncate owner ==
# How to truncate the username and group names for a file if they exceed a certain
# number of characters.
truncate-owner:
    # Number of characters to keep. By default, no truncation is done (empty value).
    after:
    # String to be appended to a name if truncated.
    marker: ""

要注意 permission,改成其他的可能会导致用户名和组别显示 ?

bash 复制代码
vi ~/.zshrc

添加别名

alias ls='lsd'
alias l='ls -l'
alias la='ls -a'
alias lla='ls -la'
alias lt='ls --tree'
相关推荐
gis收藏家3 分钟前
利用 SAM2 模型探测卫星图像中的农田边界
开发语言·python
齐雅彤13 分钟前
Bash语言的并发编程
开发语言·后端·golang
Ronin-Lotus16 分钟前
上位机知识篇---ROS2命令行命令&静态链接库&动态链接库
学习·程序人生·机器人·bash
AitTech22 分钟前
C#性能优化技巧:利用Lazy<T>实现集合元素的延迟加载
开发语言·windows·c#
翻晒时光22 分钟前
深入解析Java集合框架:春招面试要点
java·开发语言·面试
峰子201228 分钟前
B站评论系统的多级存储架构
开发语言·数据库·分布式·后端·golang·tidb
Channing Lewis1 小时前
python如何使得pdf加水印后的大小尽可能小
开发语言·python·pdf
_.Switch1 小时前
Python Web开发:使用FastAPI构建视频流媒体平台
开发语言·前端·python·微服务·架构·fastapi·媒体
yyytucj2 小时前
python--列表list切分(超详细)
linux·开发语言·python
可涵不会debug2 小时前
Git 分支管理与多人协作实战指南
git