Shell配置

Shell配置

注意
本文最后更新于 2023-09-24,文中内容可能已过时。

Shell 配置

Shell 框架

跟随 README 过一遍即可

只需要在 ~/.zimrc ​中编辑即可,例如:zmodule xxx

插件仓库:unixorn/awesome-zsh-plugins: A collection of ZSH frameworks, plugins, themes and tutorials

  • zimfw install ​安装新插件
  • zimfw update​ 更新插件
  • zimfw uninstall​ 删除插件

懒人推荐 romkatv/powerlevel10k

安装后通过 p10k configure ​配置即可

https://raw.githubusercontent.com/0RAJA/img/main/202309241306227.png

~/.zimfw

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
# Start configuration added by Zim install {{{

#

# This is not sourced during shell startup, and it's only used to configure the

# zimfw plugin manager

#

#

# Modules

#

# Sets sane Zsh built-in environment options

zmodule environment

# Provides handy git aliases and functions

zmodule git

# Applies correct bindkeys for input events

zmodule input

# Sets a custom terminal title

zmodule termtitle

# Utility aliases and functions. Adds colour to ls, grep and less

zmodule utility

#

# Prompt

#

# Exposes to prompts how long the last command took to execute, used by asciiship

zmodule duration-info

# Exposes git repository status information to prompts, used by asciiship

zmodule git-info

# A heavily reduced, ASCII-only version of the Spaceship and Starship prompts

zmodule asciiship

#

# Completion

#

# Additional completion definitions for Zsh

zmodule zsh-users/zsh-completions --fpath src

# Enables and configures smart and extensive tab completion

# completion must be sourced after all modules that add completion definitions

zmodule completion

#

# Modules that must be initialized last

#

zmodule DarrinTisdale/zsh-aliases-exa # 添加多个 alias, 使用 exa 代替 ls,要求有安装 exa
zmodule romkatv/powerlevel10k --use degit # p10k themes
zmodule none9632/zsh-sudo # 双击ESC->sudo
zmodule ael-code/zsh-colored-man-pages # 对 man 的输出进行着色
zmodule wookayin/fzf-fasd # 集成 fzf 和 fasd --- tab 补全与 fzf 的模糊搜索
zmodule zsh-users/zaw
zmodule zsh-users/zsh-syntax-highlighting # 指令高亮

# Fish-like syntax highlighting for Zsh

# zsh-users/zsh-syntax-highlighting must be sourced after completion

zmodule zsh-users/zsh-syntax-highlighting

# Fish-like history search (up arrow) for Zsh

# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting

zmodule zsh-users/zsh-history-substring-search # 通过指令的一部分查询历史记录

# Fish-like autosuggestions for Zsh

zmodule zsh-users/zsh-autosuggestions

# }}} End configuration added by Zim install

使用 zimfw 作为 zsh 配置框架 :: HP goes FE (hikerpig.cn)

zimfw/zimfw: Zim: Modular, customizable, and blazing fast Zsh framework (github.com)

07 - Zim - Zsh 配置框架與它的插件 - iT 邦幫忙::一起幫忙解決難題,拯救 IT 人的一天 (ithome.com.tw)

Shell 工具

soimort/translate-shell: 💬 Command-line translatort

推荐配置 ~/.zshrc

1
2
3
# trans
alias tzh="trans :zh -b"
alias ten="trans :en -show-languages=n -show-prompt-message=n -show-alternatives=n"

https://raw.githubusercontent.com/0RAJA/img/main/202309241305175.png