Skip to main content
Zsh

Zsh #

My notes on Unix/shell basics from ages ago (in Chinese): notes: bash

Set Language #

Set everything to English:

# In .zshrc
export LANG=en_US.UTF-8

…except git: (credit)

# In .zshrc
alias git='LANG="zh_CN.UTF-8" git'

Custom motd (message of the day) #

Blog post: macOS + zsh 上使用 Neofetch 作为欢迎语(MotD)

In shell:

brew install macchina
cd ~
touch motd.sh

In ~/motd.sh:

#! /usr/bin/env zsh
macchina --theme Helium

In ~/.zshrc:

# display motd
if [[ -e $HOME/motd.sh ]]; then source $HOME/motd.sh; fi
for i in {0..255}; do print -Pn "%K{$i}  %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done

# or

for i in {0..255}; do printf "\x1b[38;5;${i}mcolour${i}\x1b[0m\n"; done

Antigen #

Repository: zsh-users/antigen: The plugin manager for zsh.

Note: The antigen bundle <<EOBUNDLES EOBUNDLES thing does not work. Add each plugin line-by-line.