目前只用过zsh,搭配oh-my-zsh,体验很好。我的wsl,macos和服务器都安装了oh-my-zsh,记录一下配置。

安装

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

主题

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="主题名称"

eastwood

jnora

re5et

tjkirch

ys

cloud

字体

中文一律用的霞鹜文楷等宽。英文字体需要Nerd字体才能正常显示图标,Nerd Fonts - 标志性字体聚合器、字形/图标集合和字体修补程序 --- Nerd Fonts - Iconic font aggregator, glyphs/icons collection, & fonts patcher

  1. 0xproto Nerd Font

    这个有些花枝招展,但是爱看。

  2. FiraCode Nerd Font

    挺耐看的,而且有非常好看的连字符。

  3. Hack Nerd Font

    黑客,名字很霸气,也好看,感觉很舒展。

  1. Iosevka Nerd Font

    比较窄的类型的,我个人用的比较少。

  2. Ubuntu Nerd Font

    Ubuntu的系统字体,很经典。

插件

plugins=(git zsh-autosuggestions zsh-syntax-highlighting copyfile copypath sudo)
  1. zsh-autosuggestions
    用于补全,还算智能。

    git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
  2. zsh-syntax-highlighting
    用于终端高亮。

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  3. copyfile && copypath

    Ohmyzsh自带插件,在配置中起用即可。一个复制文件内容,一个复制当前路径。

  4. sudo
    也是一个自带插件,在忘记输入sudo时,按一下ESC即可快速补上。

别名(alias)

alias c="code ."
alias ..="cd ../"
alias ..l="cd ../ && ls -a"
alias ..ll="cd ../ && ls -al"

alias ...='cd ../../..'
alias ....='cd ../../../..'
alias .....='cd ../../../..'
alias .2='cd ../..'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'

alias zshrc='nvim ~/.zshrc'
alias update="source ~/.zshrc"
alias cls="clear"
alias vim="nvim"
alias n="nvim"
alias n.="nvim ."
alias nc="n ~/.config/nvim/"
alias h='history'

alias df="duf"
alias md="mkdir"

# 连接上次会话
alias ta="tmux a"
# 新会话
alias tn="tmux"
# 列出所有会话
alias tls="tmux ls"
# 删除tmux会话
alias td0="tmux kill-session -t 0"
alias td1="tmux kill-session -t 1"
alias td2="tmux kill-session -t 2"
alias td3="tmux kill-session -t 3"
alias td4="tmux kill-session -t 4"
alias td5="tmux kill-session -t 5"

# 临时开关代理
alias offclash='unset http_proxy && unset https_proxy all_proxy'
alias onclash='export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890'

# lsd
alias bls="/bin/ls"
alias ls="lsd"
alias lsa="lsd -a"
alias lt="lsd --tree"
alias lta="lsd -a --tree"

# lazygit
alias lg="lazygit"
# dotfiles
alias dt="cd ~/dotfiles && lsa"

# lsd
alias bll="/bin/ls -al"
alias ll='lsd -l'
alias lla='lsd -al'

欢迎语

加在.zshrc的末尾。

  1. 可以打印一个3d艺术字。
figlet -c Hello Ubuntu!

  1. 可以调用neofetch
  2. 可以使用pokemansay和fortune。