Skip to content

Commit

Permalink
更新README & 将部分个人配置移入private.zsh中
Browse files Browse the repository at this point in the history
  • Loading branch information
yaocccc committed Oct 24, 2022
1 parent 317e04a commit ae8d6c4
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ log/
**/.DS_Store
**/catch
cache/
config/private.zsh
config/private*.zsh
71 changes: 48 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,71 @@
# ZSH

个人zsh配置 主要基于ohz精简 启动速度稳定在0.1s内
zsh配置 基于ohz精简 启动速度稳定在0.1s内

## USAGE

```shell
cd ~/.config
git clone https://github.com/yaocccc/zsh
echo 'source ~/.config/zsh/init.zsh' >> ~/.zshrc
```

## REQUIRES

以下依赖请自行安装

- zsh
- fzf
- bat
- fd

## 插件列表(只保留最精简实用):

1. z
> `z keyword`
> 按使用频率跳转到keyword关联目录
> 例如 `z zsh` 可快速跳转到 `~/.config/zsh` 目录
2. extract
> `extract xxx`
> extract一个压缩文件
> 可根据不同压缩文件类型进行解压 无需记忆长解压指令
3. zsh-autosuggestions
> 输入命令时从history中找到最符合的命令
> \<right> 使用该 suggestion
4. zsh-syntax-highlighting
> 高亮输入命令
5. fzf-tab
> tab时使用fzf进行候选选择
## 配置目录结构

```plaintext
.
├── cache/ -- 部分需要缓存的配置
├── config/
│   ├── private.zsh -- !!!私有配置 注意此文件不会跟着git版本变更!!!
│   ├── base.zsh -- 基础配置
│   ├── private.zsh -- !!!私有配置 注意此文件不会跟着git版本变更 若个人有需要的特定配置可写入该文件!!!
│   ├── fzf.zsh -- fzf 及 fzf-tab配置
│   ├── git.zsh -- git相关配置
│   ├── node.zsh -- nodejs配置 如果不使用nodejs的话 不需要该配置
│   └── zsh.zsh -- zsh基础配置
├── plugins/ -- 插件
├── themes/ -- 主题
├── file_preview.sh -- 文件预览脚本 for fzf-tab
├── init.zshrc -- 配置入口
├── init.zsh -- 配置入口
├── README.md -- README
└── omz.sh -- 精简后的omz
```
## 插件列表

1. extract 智能解压缩命令 可使用 extract 解压任意压缩格式文件
2. fzf-tab 使用fzf面板替换普通tab后的结果
3. z 使用z dir命令 跳到常去目录
4. zsh-autosuggestions 猜测输入的命令 大幅度提升输入长命令的速度
5. zsh-syntax-highlighting 高亮命令

## USAGE

```shell
# clone 配置目录
cd ~/.config
git clone https://github.com/yaocccc/zsh
## 主题

# 向zshrc中加入配置目录的source
echo 'source ~/.config/zsh/init.zsh' >> ~/.zshrc

# 需要自己手动安装fzf!!! 详情见 https://github.com/junegunn/fzf
```plaintext
可自定义内容:
可在环境变量中自定义PCNAME变量
主题将展示 {PCNAMAE}{pwd}[gitstatus]
以此来区分不同的使用环境
```
## 展示

![avatar](./screenshots/show.gif)
25 changes: 0 additions & 25 deletions config/base.zsh

This file was deleted.

10 changes: 0 additions & 10 deletions config/git.zsh
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# git相关的快捷键设置
export GIT_TERMINAL_PROMPT=1

alias git='git --no-pager'
alias gco='git checkout'
alias ginit='git init && echo "[user]\n email = [email protected]" >> .git/config && cp ~/.gitignore .'
alias gadd='echo "[user]\n email = [email protected]" >> .git/config'
alias gpo='git push origin $(git symbolic-ref --short -q HEAD)'
alias gpl='git pull origin $(git symbolic-ref --short -q HEAD) --ff-only'
alias gd='git diff'
Expand All @@ -19,10 +16,3 @@ gitlog() {
}
gll() { gitlog "%h %s" $1 }
glll() { gitlog "%h %cd %cn: %s" $1 }

# git tag
# git show V1.2
# git push origin --tags
# git tag -d V1.2
# git push origin :refs/tags/V1.2
# git fetch origin tag V1.2
2 changes: 0 additions & 2 deletions init.zsh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
export ZSH=~/.config/zsh
source $ZSH/config/base.zsh
source $ZSH/config/git.zsh
source $ZSH/config/zsh.zsh
source $ZSH/config/fzf.zsh

# 隐私配置 可将非通用的配置写入 config/private.zsh 注意此文件不会随git管理
[ -f $ZSH/config/private.zsh ] && source $ZSH/config/private.zsh
2 changes: 1 addition & 1 deletion themes/simple.zsh-theme
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROMPT="%{$fg[yellow]%}$PCENV%(!.%{$fg[green]%}.%{$fg[green]%})%~%{$fg_bold[yellow]%}"'$(git_prompt_info)%{$reset_color%} '
PROMPT="%{$fg[yellow]%}$PCNAME%(!.%{$fg[green]%}.%{$fg[green]%})%~%{$fg_bold[yellow]%}"'$(git_prompt_info)%{$reset_color%} '

ZSH_THEME_GIT_PROMPT_PREFIX="["
ZSH_THEME_GIT_PROMPT_SUFFIX="]"
Expand Down

0 comments on commit ae8d6c4

Please sign in to comment.