From 8d53fa2c93dca2e54097053068feebb61aeecb9a Mon Sep 17 00:00:00 2001 From: H Date: Fri, 27 Aug 2021 11:13:50 +0800 Subject: [PATCH 1/2] zsh --- tmux_config/install_tmux.sh | 2 +- zsh_config/README.md | 0 zsh_config/zsh_install.sh | 16 +++ zsh_config/zshrc | 236 ++++++++++++++++++++++++++++++++++++ 4 files changed, 253 insertions(+), 1 deletion(-) create mode 100644 zsh_config/README.md create mode 100755 zsh_config/zsh_install.sh create mode 100644 zsh_config/zshrc diff --git a/tmux_config/install_tmux.sh b/tmux_config/install_tmux.sh index ff223fd..93a9f12 100755 --- a/tmux_config/install_tmux.sh +++ b/tmux_config/install_tmux.sh @@ -38,7 +38,7 @@ fi cp -vf "$HOME/.tmux.conf" "$HOME/.tmux.conf.bak" 2>/dev/null || true cp -av ./* ~/.tmux/ -ln -sf -v ./tmux.conf ~/.tmux/tmux.conf +ln -sf -v ~/.tmux/tmux.conf ~/.tmux.conf # Install TPM plugins. # TPM requires running tmux server, as soon as `tmux start-server` does not work diff --git a/zsh_config/README.md b/zsh_config/README.md new file mode 100644 index 0000000..e69de29 diff --git a/zsh_config/zsh_install.sh b/zsh_config/zsh_install.sh new file mode 100755 index 0000000..4af212f --- /dev/null +++ b/zsh_config/zsh_install.sh @@ -0,0 +1,16 @@ +if [ -d ~/.oh-my-zsh ];then + echo "you have installed oh_my_zsh" +else + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" +fi + +sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)" + +if [-f ~/.zshrc.old];then + echo "you have zshrc.old" +else + mv ~/.zshrc ~/.zshrc.old + cp ./zshrc ~/.zshrc +fi +source ~/.zshrc +zinit update diff --git a/zsh_config/zshrc b/zsh_config/zshrc new file mode 100644 index 0000000..8d8b354 --- /dev/null +++ b/zsh_config/zshrc @@ -0,0 +1,236 @@ +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +# ZSH的环境变量 +export ZSH="/home/h/.oh-my-zsh" +export PATH="$HOME/.emacs.d/bin:$PATH" +##export PATH="$HOME/.local/bin:$PATH" +eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + +#fpath+=$HOME/.zsh/pure + + +#autoload -U promptinit; promptinit +#prompt pure +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +# 主题设置 +# 主题列表在 ~/.oh-my-zsh/themes/ +# 如果设置为 "random", 每次开启都会是不同的主题 +# ZSH_THEME="robbyrussell" +# "fino-time" "pygmalion-virtualenv" "dst" "crunch" "agnoster" + +ZSH_THEME="ys" +#ZSH_THEME="fino-time" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# 如果想要大小写敏感,可以取消注释下面的一行 +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# 如果想要连接符不敏感,可以取消注释下面的一行。_ 和 - 将可以互换 +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# 如果不想要自动更新,可以取消注释下面的一行 +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + +# Uncomment the following line to change how often to auto-update (in days). +# 自动更新的时间间隔,单位是天,这里设置 15 天更新一次 +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# 如果不想要 ls 命令输出带颜色,可以取消注释下面的一行 +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# 是否禁止更改终端标题,不要禁止,不然所有终端tab只显示zsh了,而不随着目录的改变而改变显示 +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# 自动纠正命令,不启用,不怎么好用 +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# 按tab键补全命令的时候,如果没什么可补全的就会出现三个红点,更人性化显示,这里我们启用 +COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# 历史命令日期显示格式 +# 有三种方式: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +#plugins=(git +# ) + +# zsh-autosuggestions zsh-syntax-highlighting git-open +#zplug "supercrabtree/k" + + + +#提示安装软件 +source /etc/zsh_command_not_found + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + + +# thefuck +eval $(thefuck --alias) + +#source /home/h/zsh_extensions/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + +export TERM=xterm-256color + +alias git1='git config --add oh-my-zsh.hide-dirty 1' +alias git0='git config --add oh-my-zsh.hide-dirty 0' + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$('/home/h/SoftWare/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "/home/h/SoftWare/anaconda3/etc/profile.d/conda.sh" ]; then + . "/home/h/SoftWare/anaconda3/etc/profile.d/conda.sh" + else + export PATH="/home/h/SoftWare/anaconda3/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< + +export CLICOLOR=1 +export LSCOLORS=ExFxBxDxCxegedabagacad + +alias googler='googler --proxy 127.0.0.1:8889' + +#autoload -U +X bashcompinit && bashcompinit +#complete -o nospace -C /usr/local/bin/bit bit + +eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)" + +### Added by Zinit's installer +if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then + print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f" + command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit" + command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \ + print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \ + print -P "%F{160}▓▒░ The clone has failed.%f%b" +fi + +source "$HOME/.zinit/bin/zinit.zsh" +autoload -Uz _zinit +(( ${+_comps} )) && _comps[zinit]=_zinit +### End of Zinit's installer chunk + +#### zinit package +## 自动建议 +zinit ice lucid wait="0" atload='_zsh_autosuggest_start' +zinit light zsh-users/zsh-autosuggestions + +## 语法高亮 +zinit ice lucid wait='0' atinit='zpcompinit' +zinit light zdharma/fast-syntax-highlighting + +## 补全 +zinit ice lucid wait='0' +zinit light zsh-users/zsh-completions + +## z.lua +zinit ice lucid wait='1' +zinit light skywind3000/z.lua + +## git open +#zinit ice lucid wait='2' +#zinit light paulirish/git-open + + +## OMZ +zinit snippet OMZ::lib/completion.zsh +zinit snippet OMZ::lib/history.zsh +zinit snippet OMZ::lib/key-bindings.zsh +#zinit snippet OMZ::lib/theme-and-appearance.zsh +zinit snippet OMZ::plugins/colored-man-pages/colored-man-pages.plugin.zsh +zinit snippet OMZ::plugins/sudo/sudo.plugin.zsh +zinit snippet OMZ::plugins/tmux/tmux.plugin.zsh +zinit snippet OMZ::plugins/tmuxinator/tmuxinator.plugin.zsh +zinit snippet OMZ::plugins/command-not-found/command-not-found.plugin.zsh + +#zinit ice lucid wait='1' +#zinit ice svn;zinit snippet OMZ::plugins/z + +#zinit ice lucid wait='2' +#zinit snippet OMZ::lib/git.zsh + +zinit ice lucid wait='1' +zinit snippet OMZ::lib/clipboard.zsh + +zinit ice lucid wait='1' +zinit ice svn;zinit snippet OMZ::plugins/extract + +zinit ice lucid wait='2' +zinit snippet OMZ::plugins/git/git.plugin.zsh + +zinit ice lucid wait='3' +zinit snippet OMZ::plugins/pip/pip.plugin.zsh +#### end zinit package -- 2.49.1 From ade2eaee162e5e6aa284c4e4701a2347755e8039 Mon Sep 17 00:00:00 2001 From: H Date: Sat, 28 Aug 2021 03:58:36 +0800 Subject: [PATCH 2/2] zsh --- zsh_config/README.md | 4 ++++ zsh_config/zsh_install.sh | 20 ++++++++++++++++++-- zsh_config/zshrc | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/zsh_config/README.md b/zsh_config/README.md index e69de29..3930f1a 100644 --- a/zsh_config/README.md +++ b/zsh_config/README.md @@ -0,0 +1,4 @@ +zsh config + + +安装zsh、 oh-my-zsh、zinit和zsh配置文件中的 brew 、fuck等 diff --git a/zsh_config/zsh_install.sh b/zsh_config/zsh_install.sh index 4af212f..4d2c512 100755 --- a/zsh_config/zsh_install.sh +++ b/zsh_config/zsh_install.sh @@ -1,16 +1,32 @@ + +## oh_my_zsh install if [ -d ~/.oh-my-zsh ];then echo "you have installed oh_my_zsh" else sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" fi -sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)" -if [-f ~/.zshrc.old];then +## zinit install +if [ -d ~/.zinit ];then + echo "you have install zinit" +else + sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)" +fi + +## backup old zshrc +if [ -f ~/.zshrc.old ];then echo "you have zshrc.old" else mv ~/.zshrc ~/.zshrc.old cp ./zshrc ~/.zshrc fi + +if [ -d /home/linuxbrew/ ];then + echo "you have install brew" +else + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +fi + source ~/.zshrc zinit update diff --git a/zsh_config/zshrc b/zsh_config/zshrc index 8d8b354..26045d0 100644 --- a/zsh_config/zshrc +++ b/zsh_config/zshrc @@ -167,7 +167,7 @@ alias googler='googler --proxy 127.0.0.1:8889' #autoload -U +X bashcompinit && bashcompinit #complete -o nospace -C /usr/local/bin/bit bit -eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)" +#eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)" ### Added by Zinit's installer if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then -- 2.49.1