诚城的成长 诚城的成长
首页
  • 高数基础
  • 数一

    • 高等数学
    • 线性代数
    • 概率论与数理统计
  • 820

    • 数据结构
    • 计算机操作系统
  • 英一

    • 单词
    • 语法
    • 阅读理解
    • 作文
  • 政治

    • 马克思主义基本原理
    • 毛泽东
    • 近代史
    • 思修
    • 时事
  • openpose
  • html5
  • css3
  • UI

    • Tailwind Css
    • Element-Plus
    • UniApp
  • 框架

    • Vue3
  • 拓展包

    • 包管理工具
    • 包开发
  • 开发语言

    • C语言
    • PHP
    • Phyton
  • 框架

    • Laravel
  • 会计

    • 初级经济法基础
    • 初级会计实务
  • 软考

    • 信息系统项目管理师
  • 博客

    • vitepress
    • vuepress
  • manim
  • git
  • vsCode
  • latex
  • docker
  • axios
  • vim
  • mac
  • Jetbrains

    • phpstorm
    • clion
突发奇想
GitHub (opens new window)

诚城

我有N个梦想……
首页
  • 高数基础
  • 数一

    • 高等数学
    • 线性代数
    • 概率论与数理统计
  • 820

    • 数据结构
    • 计算机操作系统
  • 英一

    • 单词
    • 语法
    • 阅读理解
    • 作文
  • 政治

    • 马克思主义基本原理
    • 毛泽东
    • 近代史
    • 思修
    • 时事
  • openpose
  • html5
  • css3
  • UI

    • Tailwind Css
    • Element-Plus
    • UniApp
  • 框架

    • Vue3
  • 拓展包

    • 包管理工具
    • 包开发
  • 开发语言

    • C语言
    • PHP
    • Phyton
  • 框架

    • Laravel
  • 会计

    • 初级经济法基础
    • 初级会计实务
  • 软考

    • 信息系统项目管理师
  • 博客

    • vitepress
    • vuepress
  • manim
  • git
  • vsCode
  • latex
  • docker
  • axios
  • vim
  • mac
  • Jetbrains

    • phpstorm
    • clion
突发奇想
GitHub (opens new window)
  • brew
  • item2
  • zsh
    • install
    • 修改配置
    • 插件
      • zsh-syntax-highlighting
      • zsh-autosuggestions
    • 字体
    • alias
    • 主题
    • 卸载
    • 显示系统配置
      • 设置打开终端自启动
      • oh-my-zsh
      • Update/更新
    • 报错
  • bash
  • stats
  • Rectangle
  • soft
  • 基本操作
  • mac
诚城
2022-06-13
目录

zsh原创

github (opens new window)

# install

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

国内无法安装这个的。使用

wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh

然后给 install.sh 添加权限:

chmod +x install.sh

然后执行 install.sh :

./install.sh

如果发现很慢,可以修改为 gitee :

vim install.sh

进入编辑状态:
找到以下部分:

# Default settings
ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master}

然后将中间两行改为:

REPO=${REPO:-mirrors/oh-my-zsh}
REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}

# 修改配置

vim ~/.zshrc

# 插件

先进插件目录

cd ~/.oh-my-zsh/custom/plugins/

# zsh-syntax-highlighting

高亮提示。

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

# zsh-autosuggestions

会给出建议的命令(灰色部分)按键盘 → 补全。

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# 字体

某些主题需要 Powerline fonts 字体依赖

# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
./uninstall.sh
rm -rf fonts

# alias

git (opens new window)
常用 alias :

alias command effect
g git
grv git remote -v
gra git remote add
gst git status 查看状态
gl git pull 拉取
gp git push 推送
gpf! git push --force 强制推送
gm git merge 先切换master分支,然后把xxx分支导入到master分支。
gcmsg git commit -m
ga git add
gaa git add --all
gb git branch 不加后续名称时查看分支情况;后续名称时,创建分支
gco git checkout 切换分支
git checkout -b 创建分支并进行切换
gbd git branch -d 删除分支
glg git log --stat 查看提交日志
git revert 取消 commit ,传入 HEAD,log中还能看到信息
git reset 删除commit ,传入 HEAD,log中不能看到信息

# 主题

Oh My Zsh 默认自带了一些默认主题,存放在 ~/.oh-my-zsh/themes 目录中。

我们可以命令 cd ~/.oh-my-zsh/themes && ls 查看这些主题。

推荐使用 powerlevel10k 主题。

powerlevel10k 安装:

git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

配置powerlevel10k

p10k configure

必须下载对应的字体 (opens new window),使用 brew 安装!!!

brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font

同时需要设置 terminal -> 文本 -> 字体,为 Hack Nerd Font

# 卸载

cd .oh-my-zsh/tools 
chmod +x uninstall.sh 
./uninstall.sh 
rm -rif .zshrc

# 显示系统配置

archey (opens new window)
黑果小兵 archey (opens new window),我用的是这个。

$ git clone https://github.com/athlonreg/archey-osx 
$ sudo mv archey-osx/ /usr/local/ 
$ sudo ln -s /usr/local/archey-osx/bin/archey /usr/local/bin/archey #中文版 软连接
$ sudo ln -s /usr/local/archey-osx/bin/archey-en /usr/local/bin/archey-en #英文版 软连接

# 设置打开终端自启动

$ echo archey >> ~/.bashrc #中文版
$ echo archey-en >> ~/.bashrc #英文版
$ echo "[[ -s ~/.bashrc ]] && source ~/.bashrc" >> ~/.bash_profile 
$ source ~/.bashrc && source ~/.bash_profile 

# oh-my-zsh

$ echo archey >> ~/.zshrc #中文版
$ echo archey-en >> ~/.zshrc #英文版
$ source ~/.zshrc 

# Update/更新

cd /usr/local/archey-osx/ && git pull 

# 报错

[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxr-x  3 carveybunt  admin   96  8 15 00:18 /usr/local/share/zsh
drwxrwxr-x  4 carveybunt  admin  128  8 15 00:31 /usr/local/share/zsh/site-functions

[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.

修改 ~/.zshrc 添加:

ZSH_DISABLE_COMPFIX="true"
上次更新: 2022/08/23, 18:12:45
item2
bash

← item2 bash→

Theme by Vdoing | Copyright © 2022-2022 carveybunt | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式
×
×

特别申明:

本站所有内容均为个人理解或转载,如有不当之处,敬请大佬指导!