ohmyzsh相关
ohmyzsh官网
github-ohmyzsh
安装命令: sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
问题:
如果有如下报错
[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxrwx 7 admin 224 4 24 10:51 /usr/local/share/zsh
[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.
[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
1.vi .zshrc
2.在文件第一行添加
ZSH_DISABLE_COMPFIX=true
3.source .zshrc
一.主题
用的比较多的:默认主题, ys, 随机主题
网上有网站评选投票,最受欢迎的主题是Powerlevel10k
What's the best theme for Oh My Zsh?
安装Powerlevel10k:
github-powerlevel10k
1.下载并安装这些字体:
meslo-nerd-font
然后在终端-设置-描述文件-字体更改中,所有字体-选择MesloLGS NF字体
2.git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
3.ZSH_THEME="powerlevel10k/powerlevel10k"
4.source ~/.zshrc
5.重启终端,并执行p10k configure
,按引导配置即可
二.常用插件
1.zsh-syntax-highlighting
插件作用: 代码高亮,提示是否输错了命令
zsh-syntax-highlighting
1.git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
2.plugins=( [plugins...] zsh-syntax-highlighting)
3.source ~/.zshrc
2.zsh-autosuggestions
插件作用: 自动补全命令
zsh-autosuggestions
1.git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
2.plugins=( # other plugins... zsh-autosuggestions )
3.source ~/.zshrc
问题
如果导致环境变量失效,将source ~/.bash_profile
添加到 ~/.zshrc 即可