如何让自己的Linux/macOS终端更好用

0X00 视频在这里 下面是配置文件

这篇博客要配合发在bilibili的视频来看,这个文件是在~/.zshrc的。大家有问题直接在视频下面留言或者直接给我私信好了~

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
# system env
export ZSH="/Users/shawn/.oh-my-zsh"
export LANGUAGE=en_US
export LANG=en_US.UTF-8
# ZSH_THEME="agnoster"
ZSH_THEME="powerlevel10k/powerlevel10k"
EDITOR=/usr/bin/vim
PATH=$PATH:$HOME/Library/Python/3.7/bin
PATH=$PATH:$HOME/Library/Python/2.7/bin


HIST_STAMPS="yyyy-mm-dd"
HISTFILESIZE=100000
HISTFILE=~/.zsh_history

# zsh plugin
plugins=(
z
git
docker
fabric
extract
thefuck
fzf-zsh
git-open
colored-man-pages
zsh-autosuggestions
zsh-syntax-highlighting
)

# alias for simple command
alias py2='/Users/shawn/Library/Python/2.7/bin/ipython2'
alias py='/Users/shawn/Library/Python/3.7/bin/ipython3'
alias cat='/usr/local/bin/bat'
alias down='aria2c -x16 -j4'
alias me="cd $HOME/Workstadion/ && ls"

# alias to source command
alias _cat='/bin/cat'

# ctrl + n autosuggest
bindkey '^n' autosuggest-accept

source $ZSH/oh-my-zsh.sh

# docker
attach() {
docker exec -it `docker ps | grep $* | awk -F ' ' '{print $1}'` bash
}

attach_django() {
docker exec -it `docker ps | grep $* | awk -F ' ' '{print $1}'` python manage.py shell
}

git_set_proxy() {
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
}

git_unset_proxy() {
git config --global --unset http.proxy
git config --global --unset https.proxy
}

json() {
# echo `xclip -o` | jq # Linux
echo `pbpaste` | jq # macOS
}

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh