zsh
1 | sudo apt install zsh |
zimfw
Automatic installation
https://ghproxy.com/https://raw.githubusercontent.com/zimfw/install/master/install.zsh
1 | curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh |
) Using Zsh version 5.8
) ZIM_HOME not set, using the default one.
密码:
) Changed your default shell to /usr/bin/zsh
! You seem to be already calling compinit in /etc/zsh/zshrc. Please remove it, because Zim’s completion module will call compinit for you.
) Downloaded the Zim script to /home/cs/.zim/zimfw.zsh
) Prepended Zim template to /home/cs/.zimrc
) Prepended Zim template to /home/cs/.zshrc.
.
.
Manual installation
~/.zshrc
1 | ZIM_HOME=~/.zim |
$ cat
/.zshrc | grep zstyle‘
#zstyle ‘:zim:zmodule’ use ‘degit’
#zstyle ‘:zim:git’ aliases-prefix ‘g’
#zstyle ‘:zim:input’ double-dot-expand yes
#zstyle ‘:zim:termtitle’ format ‘%1
~/.zimrc
~/.zim/modules/
$ cat ~/.zimrc | grep zmodule
zmodule environment
zmodule git
zmodule input
zmodule termtitle
zmodule utility
zmodule duration-info
zmodule git-info
zmodule asciiship
zmodule zsh-users/zsh-completions –fpath src
zmodule completion
zmodule zsh-users/zsh-syntax-highlighting
zmodule zsh-users/zsh-history-substring-search
zmodule zsh-users/zsh-autosuggestions
Uninstalling
1 | #rm -rf ~/.zim ~/.zimrc |
$ ls -l ~/.z*
-rw——- 1 cs cs 1574 4月 8 18:54 /home/cs/.zimrc
-rw——- 1 cs cs 3587 4月 8 18:54 /home/cs/.zshrc/home/cs/.zim:
总用量 40
drwxr-xr-x 15 cs cs 4096 4月 8 19:23 modules
-rw-r–r– 1 cs cs 36117 4月 8 18:54 zimfw.zsh
modules
autojump
https://github.com/wting/autojump
1 | sudo apt install autojump |
/usr/share/doc/autojump/README.Debian
autojump 将只跳到先前 cd
命令到过的目录
j
1 | ❯ j k8s |
stat
选项可以查看访问过的目录权重
1 | ❯ j --stat |
fzf
https://github.com/junegunn/fzf#examples
1 | git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf |
Downloading bin/fzf …
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 –:–:– –:–:– –:–:– 0
100 1340k 100 1340k 0 0 5941 0 0:03:50 0:03:50 –:–:– 7241
- Checking fzf executable … 0.39.0
Do you want to enable fuzzy auto-completion? ([y]/n) y
Do you want to enable key bindings? ([y]/n) yGenerate /home/cs/.fzf.bash … OK
Generate /home/cs/.fzf.zsh … OKDo you want to update your shell configuration files? ([y]/n) y
Update /home/cs/.bashrc:
- [ -f ~/.fzf.bash ] && source ~/.fzf.bash
- Added
Update /home/cs/.zshrc:
- [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
- Added
Finished. Restart your shell or reload config file.
source ~/.bashrc # bash
source ~/.zshrc # zshUse uninstall script to remove fzf.
For more information, see: https://github.com/junegunn/fzf
fzf-tab
~/.zimrc
1 | git clone --depth 1 https://github.com/Aloxaf/fzf-tab.git /.zim/modules/fzf-tab |
1 | # disable sort when completing `git checkout` |
https://github.com/Aloxaf/fzf-tab/wiki/Configuration
powerlevel10k
doc https://github.com/romkatv/powerlevel10k#installation
1 | #add ~/.zimrc |
/home/cs/.zim/modules/powerlevel10k
p10k安装
1 | p10k configure |
New config: ~/.p10k.zsh.
Backup of ~/.zshrc: /tmp/.zshrc.JO4Ns3iulN.See ~/.zshrc changes:
diff /tmp/.zshrc.JO4Ns3iulN ~/.zshrc
File feature requests and bug reports at
https://github.com/romkatv/powerlevel10k/issues
font
https://www.nerdfonts.com/font-downloads
https://github.com/ryanoasis/nerd-fonts/releases/tag/v2.3.3
icons
https://www.nerdfonts.com/cheat-sheet
~/.p10k.zsh
1 | POWERLEVEL9K_BATTERY_CHARGING='yellow' |
exa
代替ls
https://github.com/ogham/exa/releases/tag/v0.10.1
1 | ❯ exa -lh -T --icons ./ |
- -T, –tree: 递归到树视图中的子目录
- –icons: 显示图标
1 | ❯ exa -lh -T --icons ./ -L 1 |
- -L, –level=(depth): 限制递归的深度
- -D, –only-dirs: 只列出目录
1 | debian# ln -s /home/cs/.zshrc /root/.zshrc |
lrwxrwxrwx 1 root root 15 4月 15 20:05 /root/.zimrc -> /home/cs/.zimrc
lrwxrwxrwx 1 root root 15 4月 15 20:05 /root/.zshrc -> /home/cs/.zshrclrwxrwxrwx 1 root root 18 4月 15 20:07 /root/.p10k.zsh -> /home/cs/.p10k.zsh
thefuck
https://github.com/nvbn/thefuck
1 | pip3 install thefuck --user |
❯ pip show thefuck
Name: thefuck
Version: 3.32
Summary: Magnificent app which corrects your previous console command
Home-page: https://github.com/nvbn/thefuck
Author: Vladimir Iakovlev
Author-email: nvbn.rm@gmail.com
License: MIT
Location: /home/cs/.local/lib/python3.9/site-packages
Requires: colorama, decorator, psutil, pyte, six
Required-by:❯ ls -l /home/cs/.local/bin | grep fuck
-rwxr-xr-x 1 cs cs 233 7月 16 23:28 fuck
-rwxr-xr-x 1 cs cs 223 7月 16 23:28 thefuck
1 | ❯ sudo ln -s /home/cs/.local/bin/thefuck /usr/local/bin/thefuck |
.zshrc
eval “$(/home/cs/.local/bin/thefuck –alias fuck)”
other
对于Zsh,这是一个语言级别的错误;对于Bash,这是一个外部命令执行的错误。这差别很重要,因为它意味着后者可以被轻易地catch,而前者不能。
zsh: no matches found:
find
命令
在~/.zshrc
中加入:setopt no_nomatch
带%
解决zsh不完全行会多%号的问题
unsetopt prompt_cr prompt_sp
zsh: 文件已存在:
默认情况下,Zsh不允许直接覆盖已存在的文件
1 | # >! 都行 |
>!
的作用是强制覆盖已存在的文件/tmp/output.txt