reconstruct dir
This commit is contained in:
24
zsh/functions/brew.sh
Normal file
24
zsh/functions/brew.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Homebrew Tsinghua mirror for macOS
|
||||||
|
if [[ $OS != "Darwin" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
function brewthu() {
|
||||||
|
if [[ $HOMEBREW_BOTTLE_DOMAIN = "" ]]; then
|
||||||
|
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
|
||||||
|
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
|
||||||
|
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
|
||||||
|
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
|
||||||
|
export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"
|
||||||
|
# Bottles
|
||||||
|
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
|
||||||
|
else
|
||||||
|
unset HOMEBREW_API_DOMAIN
|
||||||
|
unset HOMEBREW_BOTTLE_DOMAIN
|
||||||
|
unset HOMEBREW_BREW_GIT_REMOTE
|
||||||
|
unset HOMEBREW_CORE_GIT_REMOTE
|
||||||
|
unset HOMEBREW_PIP_INDEX_URL
|
||||||
|
# Bottles
|
||||||
|
unset HOMEBREW_BOTTLE_DOMAIN
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -1,36 +1,86 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# check for git
|
function check_zsh_polyjuice() {
|
||||||
if ! command -v git >/dev/null 2>&1; then
|
# check for zsh-autosuggestions
|
||||||
echo "Git is not installed."
|
if [[ ! -f $ZSH_PLUGINS_PATH/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then
|
||||||
fi
|
echo "zsh-autosuggestions is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
# check for python
|
# check for zsh-syntax-highlighting
|
||||||
if ! command -v python >/dev/null 2>&1; then
|
if [[ ! -f $ZSH_PLUGINS_PATH/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then
|
||||||
echo "Python is not installed."
|
echo "zsh-syntax-highlighting is not installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for rust
|
# check for zsh-autocomplete
|
||||||
if ! command -v cargo >/dev/null 2>&1; then
|
if [[ ! -f $ZSH_PLUGINS_PATH/zsh-autocomplete/zsh-autocomplete.plugin.zsh ]]; then
|
||||||
echo "Rust is not installed."
|
echo "zsh-autocomplete is not installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for verilator
|
# check for fzf-tab
|
||||||
if ! command -v verilator >/dev/null 2>&1; then
|
if [[ ! -f $ZSH_PLUGINS_PATH/fzf-tab/fzf-tab.zsh ]]; then
|
||||||
echo "Verilator is not installed."
|
echo "fzf-tab is not installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for iverilog
|
# check for oh-my-zsh
|
||||||
if ! command -v iverilog >/dev/null 2>&1; then
|
if [[ ! -d $ZSH_PLUGINS_PATH/ohmyzsh ]]; then
|
||||||
echo "iverilog is not installed."
|
echo "oh-my-zsh is not installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for OpenJDK
|
# check for zoxide
|
||||||
if ! command -v javac >/dev/null 2>&1; then
|
if (( ! $+commands[zoxide] )); then
|
||||||
echo "OpenJDK is not installed."
|
echo "zoxide is not installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check for sbt
|
# check for fzf
|
||||||
if ! command -v sbt >/dev/null 2>&1; then
|
if (( ! $+commands[fzf] )); then
|
||||||
echo "sbt is not installed."
|
echo "fzf is not installed."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check for starship
|
||||||
|
if (( ! $+commands[starship] )); then
|
||||||
|
echo "starship is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for python
|
||||||
|
if (( ! $+commands[python3] )); then
|
||||||
|
echo "python3 is not installed."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function check_tools() {
|
||||||
|
# check for git
|
||||||
|
if ! command -v git >/dev/null 2>&1; then
|
||||||
|
echo "Git is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for python
|
||||||
|
if ! command -v python >/dev/null 2>&1; then
|
||||||
|
echo "Python is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for rust
|
||||||
|
if ! command -v cargo >/dev/null 2>&1; then
|
||||||
|
echo "Rust is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for verilator
|
||||||
|
if ! command -v verilator >/dev/null 2>&1; then
|
||||||
|
echo "Verilator is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for iverilog
|
||||||
|
if ! command -v iverilog >/dev/null 2>&1; then
|
||||||
|
echo "iverilog is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for OpenJDK
|
||||||
|
if ! command -v javac >/dev/null 2>&1; then
|
||||||
|
echo "OpenJDK is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check for sbt
|
||||||
|
if ! command -v sbt >/dev/null 2>&1; then
|
||||||
|
echo "sbt is not installed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,118 +1,91 @@
|
|||||||
#! /bin/bash
|
function install_plugins() {
|
||||||
|
if ! command -v git >/dev/null 2>&1; then
|
||||||
echo "$SHELL" | grep -q zsh
|
echo "Git is not installed."
|
||||||
if [ $? -ne 0 ]; then
|
return
|
||||||
echo "Please run this script in zsh shell."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# git, fzf, zoxide are required
|
|
||||||
if ! command -v git >/dev/null 2>&1; then
|
|
||||||
echo "Git is not installed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v fzf >/dev/null 2>&1; then
|
|
||||||
echo "FZF is not installed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v zoxide >/dev/null 2>&1; then
|
|
||||||
echo "Zoxide is not installed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v python >/dev/null 2>&1; then
|
|
||||||
if ! command -v python3 >/dev/null 2>&1; then
|
|
||||||
echo "Python is not installed."
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v starship >/dev/null 2>&1; then
|
if [ ! -n "${ZSH_PLUGINS_PATH}" ]; then
|
||||||
echo "Starship is not installed."
|
echo "ZSH_PLUGINS_PATH is not set. Please set it and try again."
|
||||||
exit 1
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ZSH_POLYJUICE_PATH="$HOME/.TerminalPolyjuice"
|
# git clone zsh-autosuggestions
|
||||||
PLUGINS_PATH="$ZSH_POLYJUICE_PATH/zsh/plugins"
|
if [ ! -d "$ZSH_PLUGINS_PATH"/zsh-autosuggestions ]; then
|
||||||
|
echo "Zsh Autosuggestions is not downloaded. Downloading..."
|
||||||
# git clone zsh-autosuggestions
|
# git clone https://github.com/zsh-users/zsh-autosuggestions.git "$ZSH_PLUGINS_PATH"/zsh-autosuggestions
|
||||||
if [ ! -d "$PLUGINS_PATH"/zsh-autosuggestions ]; then
|
git clone https://gitee.com/mirrors/zsh-autosuggestions.git "$ZSH_PLUGINS_PATH"/zsh-autosuggestions
|
||||||
echo "Zsh Autosuggestions is not downloaded. Downloading..."
|
|
||||||
# git clone https://github.com/zsh-users/zsh-autosuggestions.git "$PLUGINS_PATH"/zsh-autosuggestions
|
|
||||||
git clone https://gitee.com/mirrors/zsh-autosuggestions.git "$PLUGINS_PATH"/zsh-autosuggestions
|
|
||||||
else
|
|
||||||
cd "$PLUGINS_PATH"/zsh-autosuggestions || exit 1
|
|
||||||
if [ ! -d .git ]; then
|
|
||||||
echo "Zsh Autosuggestions is not a git repository. Please remove $PLUGINS_PATH/zsh-autosuggestions and try again."
|
|
||||||
exit 1
|
|
||||||
else
|
else
|
||||||
echo "Zsh Autosuggestions is already exist. Updating..."
|
cd "$ZSH_PLUGINS_PATH"/zsh-autosuggestions || return
|
||||||
git pull
|
if [ ! -d .git ]; then
|
||||||
|
echo "Zsh Autosuggestions is not a git repository. Please remove $ZSH_PLUGINS_PATH/zsh-autosuggestions and try again."
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo "Zsh Autosuggestions is already exist. Updating..."
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# git clone zsh-syntax-highlighting
|
# git clone zsh-syntax-highlighting
|
||||||
if [ ! -d "$PLUGINS_PATH"/zsh-syntax-highlighting ]; then
|
if [ ! -d "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting ]; then
|
||||||
echo "Zsh Syntax Highlighting is not downloaded. Downloading..."
|
echo "Zsh Syntax Highlighting is not downloaded. Downloading..."
|
||||||
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$PLUGINS_PATH"/zsh-syntax-highlighting
|
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting
|
||||||
git clone https://gitee.com/mirrors/zsh-syntax-highlighting.git "$PLUGINS_PATH"/zsh-syntax-highlighting
|
git clone https://gitee.com/mirrors/zsh-syntax-highlighting.git "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting
|
||||||
else
|
|
||||||
cd "$PLUGINS_PATH"/zsh-syntax-highlighting || exit 1
|
|
||||||
if [ ! -d .git ]; then
|
|
||||||
echo "Zsh Syntax Highlighting is not a git repository. Please remove $PLUGINS_PATH/zsh-syntax-highlighting and try again."
|
|
||||||
exit 1
|
|
||||||
else
|
else
|
||||||
echo "Zsh Syntax Highlighting is already exist. Updating..."
|
cd "$ZSH_PLUGINS_PATH"/zsh-syntax-highlighting || return
|
||||||
git pull
|
if [ ! -d .git ]; then
|
||||||
|
echo "Zsh Syntax Highlighting is not a git repository. Please remove $ZSH_PLUGINS_PATH/zsh-syntax-highlighting and try again."
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo "Zsh Syntax Highlighting is already exist. Updating..."
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# git clone zsh-autocomplete
|
# git clone zsh-autocomplete
|
||||||
if [ ! -d "$PLUGINS_PATH"/zsh-autocomplete ]; then
|
if [ ! -d "$ZSH_PLUGINS_PATH"/zsh-autocomplete ]; then
|
||||||
echo "Zsh Autocomplete is not downloaded. Downloading..."
|
echo "Zsh Autocomplete is not downloaded. Downloading..."
|
||||||
# git clone https://github.com/marlonrichert/zsh-autocomplete.git "$PLUGINS_PATH"/zsh-autocomplete
|
# git clone https://github.com/marlonrichert/zsh-autocomplete.git "$ZSH_PLUGINS_PATH"/zsh-autocomplete
|
||||||
git clone https://gitee.com/mirrors/zsh-autocomplete.git "$PLUGINS_PATH"/zsh-autocomplete
|
git clone https://gitee.com/mirrors/zsh-autocomplete.git "$ZSH_PLUGINS_PATH"/zsh-autocomplete
|
||||||
|
|
||||||
else
|
|
||||||
cd "$PLUGINS_PATH"/zsh-autocomplete || exit 1
|
|
||||||
if [ ! -d .git ]; then
|
|
||||||
echo "Zsh Autocomplete is not a git repository. Please remove $PLUGINS_PATH/zsh-autocomplete and try again."
|
|
||||||
exit 1
|
|
||||||
else
|
else
|
||||||
echo "Zsh Autocomplete is already exist. Updating..."
|
cd "$ZSH_PLUGINS_PATH"/zsh-autocomplete || return
|
||||||
git pull
|
if [ ! -d .git ]; then
|
||||||
|
echo "Zsh Autocomplete is not a git repository. Please remove $ZSH_PLUGINS_PATH/zsh-autocomplete and try again."
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo "Zsh Autocomplete is already exist. Updating..."
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# git clone powerlevel10k
|
# git clone powerlevel10k
|
||||||
if [ ! -d "$PLUGINS_PATH"/fzf-tab ]; then
|
if [ ! -d "$ZSH_PLUGINS_PATH"/fzf-tab ]; then
|
||||||
echo "fzf-tab is not downloaded. Downloading..."
|
echo "fzf-tab is not downloaded. Downloading..."
|
||||||
git clone https://github.com/Aloxaf/fzf-tab.git "$PLUGINS_PATH"/fzf-tab
|
git clone https://github.com/Aloxaf/fzf-tab.git "$ZSH_PLUGINS_PATH"/fzf-tab
|
||||||
else
|
|
||||||
cd "$PLUGINS_PATH"/fzf-tab || exit 1
|
|
||||||
if [ ! -d .git ]; then
|
|
||||||
echo "fzf-tab is not a git repository. Please remove $PLUGINS_PATH/fzf-tab and try again."
|
|
||||||
exit 1
|
|
||||||
else
|
else
|
||||||
echo "fzf-tab is already exist. Updating..."
|
cd "$ZSH_PLUGINS_PATH"/fzf-tab || return
|
||||||
git pull
|
if [ ! -d .git ]; then
|
||||||
|
echo "fzf-tab is not a git repository. Please remove $ZSH_PLUGINS_PATH/fzf-tab and try again."
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo "fzf-tab is already exist. Updating..."
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# git clone oh-my-zsh
|
# git clone oh-my-zsh
|
||||||
if [ ! -d "$PLUGINS_PATH"/ohmyzsh ]; then
|
if [ ! -d "$ZSH_PLUGINS_PATH"/ohmyzsh ]; then
|
||||||
echo "Oh My Zsh is not downloaded. Downloading..."
|
echo "Oh My Zsh is not downloaded. Downloading..."
|
||||||
# git clone https://github.com/ohmyzsh/ohmyzsh.git "$PATH_OHMYZSH"
|
# git clone https://github.com/ohmyzsh/ohmyzsh.git "$PATH_OHMYZSH"
|
||||||
git clone https://gitee.com/mirrors/ohmyzsh.git "$PLUGINS_PATH"/ohmyzsh
|
git clone https://gitee.com/mirrors/ohmyzsh.git "$ZSH_PLUGINS_PATH"/ohmyzsh
|
||||||
else
|
|
||||||
cd "$PLUGINS_PATH"/ohmyzsh || exit 2
|
|
||||||
if [ ! -d .git ]; then
|
|
||||||
echo "Oh My Zsh is not a git repository. Please remove $PLUGINS_PATH/ohmyzsh and try again."
|
|
||||||
exit 1
|
|
||||||
else
|
else
|
||||||
echo "Oh My Zsh is already exist. Updating..."
|
cd "$ZSH_PLUGINS_PATH"/ohmyzsh || return
|
||||||
git pull
|
if [ ! -d .git ]; then
|
||||||
|
echo "Oh My Zsh is not a git repository. Please remove $ZSH_PLUGINS_PATH/ohmyzsh and try again."
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo "Oh My Zsh is already exist. Updating..."
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
}
|
||||||
|
|||||||
20
zsh/settings/command_history.sh
Normal file
20
zsh/settings/command_history.sh
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Command History related settings
|
||||||
|
HISTFILE=$HOME/.zsh_history
|
||||||
|
HISTSIZE=50000
|
||||||
|
SAVEHIST=10000
|
||||||
|
setopt extended_history # record timestamp of command in HISTFILE
|
||||||
|
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||||
|
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||||
|
setopt hist_ignore_space # ignore commands that start with space
|
||||||
|
setopt hist_verify # show command with history expansion to user before running it
|
||||||
|
setopt share_history # share command history data
|
||||||
|
# setopt append_history # 退出时追加到历史文件
|
||||||
|
# setopt inc_append_history # 命令执行后立即写入历史文件
|
||||||
|
# setopt share_history # 在多个终端间共享历史
|
||||||
|
# setopt hist_ignore_dups # 忽略重复的命令
|
||||||
|
# setopt hist_reduce_blanks # 合并连续的空命令
|
||||||
|
# setopt hist_verify # 通过 fc 编辑历史命令后再执行
|
||||||
|
# setopt extended_history # 记录时间戳
|
||||||
|
# setopt hist_expire_dups_first # 先删除重复的命令再根据大小删除
|
||||||
|
# setopt hist_find_no_dups # 搜索历史时忽略重复项
|
||||||
|
# setopt hist_save_no_dups # 保存历史时忽略重复项
|
||||||
3
zsh/settings/language_evnironment.sh
Normal file
3
zsh/settings/language_evnironment.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Language Environment
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
21
zsh/settings/useful_exports.sh
Normal file
21
zsh/settings/useful_exports.sh
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Preferred editor for local and remote sessions
|
||||||
|
if [[ -n $SSH_CONNECTION ]]; then
|
||||||
|
if (( $+commands[helix] )); then
|
||||||
|
export EDITOR='helix'
|
||||||
|
elif (( $+commands[nvim] )); then
|
||||||
|
export EDITOR='nvim'
|
||||||
|
else
|
||||||
|
export EDITOR='vim'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if (( $+commands[helix] )); then
|
||||||
|
export EDITOR='helix'
|
||||||
|
elif (( $+commands[nvim] )); then
|
||||||
|
export EDITOR='nvim'
|
||||||
|
else
|
||||||
|
export EDITOR='vim'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# operating system
|
||||||
|
export OS=$(uname -s)
|
||||||
109
zsh/zshrc
109
zsh/zshrc
@@ -1,76 +1,55 @@
|
|||||||
# Path to zsh-polyjuice installation
|
#!/bin/zsh
|
||||||
export ZSH_POLYJUICE_PATH="$HOME/.TerminalPolyjuice"
|
|
||||||
export ZSH_PLUGIN_PATH="$ZSH_POLYJUICE_PATH/zsh/plugins"
|
|
||||||
export ZSH_ALIAS_PATH="$ZSH_POLYJUICE_PATH/zsh/alias"
|
|
||||||
|
|
||||||
# Command History related settings
|
# path -> settings -> alias -> functions -> plugins -> prompt
|
||||||
HISTFILE=$HOME/.zsh_history
|
|
||||||
HISTSIZE=10000
|
|
||||||
SAVEHIST=10000
|
|
||||||
setopt append_history # 退出时追加到历史文件
|
|
||||||
setopt inc_append_history # 命令执行后立即写入历史文件
|
|
||||||
setopt share_history # 在多个终端间共享历史
|
|
||||||
setopt hist_ignore_dups # 忽略重复的命令
|
|
||||||
setopt hist_reduce_blanks # 合并连续的空命令
|
|
||||||
# setopt hist_verify # 通过 fc 编辑历史命令后再执行
|
|
||||||
# setopt extended_history # 记录时间戳
|
|
||||||
# setopt hist_expire_dups_first # 先删除重复的命令再根据大小删除
|
|
||||||
# setopt hist_find_no_dups # 搜索历史时忽略重复项
|
|
||||||
# setopt hist_save_no_dups # 保存历史时忽略重复项
|
|
||||||
|
|
||||||
# Load Aliases
|
if [ -n "${ZSH_VERSION}" ]; then
|
||||||
source $ZSH_ALIAS_PATH/alias.sh
|
_source="${(%):-%x}"
|
||||||
|
_path=$(dirname "$(realpath "$_source")")
|
||||||
|
unset _source
|
||||||
|
else
|
||||||
|
echo "Unsupported shell"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set basic path to zsh-polyjuice installation
|
||||||
|
export ZSH_POLYJUICE_PATH="$_path"
|
||||||
|
unset _path
|
||||||
|
export ZSH_PLUGINS_PATH="$ZSH_POLYJUICE_PATH/plugins"
|
||||||
|
export ZSH_ALIAS_PATH="$ZSH_POLYJUICE_PATH/alias"
|
||||||
|
export ZSH_SETTINGS_PATH="$ZSH_POLYJUICE_PATH/settings"
|
||||||
|
export ZSH_FUNCTIONS_PATH="$ZSH_POLYJUICE_PATH/functions"
|
||||||
|
export STARSHIP_CONFIG_FILE="$ZSH_POLYJUICE_PATH/../starship/starship.toml"
|
||||||
|
|
||||||
|
# Load basic settings `zsh/settings`
|
||||||
|
for _file in "$ZSH_SETTINGS_PATH"/*.sh; do
|
||||||
|
source "$_file"
|
||||||
|
done
|
||||||
|
unset _file
|
||||||
|
|
||||||
|
# Load Aliases `zsh/alias`
|
||||||
|
for _file in "$ZSH_ALIAS_PATH"/*.sh; do
|
||||||
|
source "$_file"
|
||||||
|
done
|
||||||
|
unset _file
|
||||||
|
|
||||||
|
# Load self-defined functions
|
||||||
|
for _file in "$ZSH_FUNCTIONS_PATH"/*.sh; do
|
||||||
|
source "$_file"
|
||||||
|
done
|
||||||
|
unset _file
|
||||||
|
|
||||||
# Load Plugins
|
# Load Plugins
|
||||||
source $ZSH_PLUGIN_PATH/zsh-autosuggestions/zsh-autosuggestions.zsh
|
source $ZSH_PLUGINS_PATH/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
|
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
|
||||||
bindkey '^[l' autosuggest-accept # alt-L to accept autosuggestion
|
bindkey '^[l' autosuggest-accept # alt-L to accept autosuggestion
|
||||||
source $ZSH_PLUGIN_PATH/zsh-autocomplete/zsh-autocomplete.plugin.zsh
|
source $ZSH_PLUGINS_PATH/zsh-autocomplete/zsh-autocomplete.plugin.zsh
|
||||||
source $ZSH_PLUGIN_PATH/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
source $ZSH_PLUGINS_PATH/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
source $ZSH_PLUGIN_PATH/fzf-tab/fzf-tab.plugin.zsh
|
source $ZSH_PLUGINS_PATH/fzf-tab/fzf-tab.plugin.zsh
|
||||||
|
source $ZSH_PLUGINS_PATH/ohmyzsh/plugins/fzf/fzf.plugin.zsh
|
||||||
|
source $ZSH_PLUGINS_PATH/ohmyzsh/plugins/zoxide/zoxide.plugin.zsh
|
||||||
|
source $ZSH_PLUGINS_PATH/ohmyzsh/plugins/python/python.plugin.zsh
|
||||||
|
|
||||||
source $ZSH_PLUGIN_PATH/ohmyzsh/plugins/fzf/fzf.plugin.zsh
|
|
||||||
source $ZSH_PLUGIN_PATH/ohmyzsh/plugins/python/python.plugin.zsh
|
|
||||||
|
|
||||||
# zoxide
|
|
||||||
if (( $+commands[zoxide] )); then
|
|
||||||
eval "$(zoxide init --cmd ${ZOXIDE_CMD_OVERRIDE:-z} zsh)"
|
|
||||||
else
|
|
||||||
echo '[zoxide] not found, please install it from https://github.com/ajeetdsouza/zoxide'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# You may need to manually set your language environment
|
|
||||||
export LANG=en_US.UTF-8
|
|
||||||
export LC_ALL=C.UTF-8
|
|
||||||
|
|
||||||
# Preferred editor for local and remote sessions
|
|
||||||
# if [[ -n $SSH_CONNECTION ]]; then
|
|
||||||
# export EDITOR='vim'
|
|
||||||
# else
|
|
||||||
# export EDITOR='nvim'
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# Homebrew Tsinghua mirror for macOS
|
|
||||||
function brewthu() {
|
|
||||||
if [[ $HOMEBREW_BOTTLE_DOMAIN = "" ]]; then
|
|
||||||
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
|
|
||||||
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
|
|
||||||
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
|
|
||||||
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
|
|
||||||
export HOMEBREW_PIP_INDEX_URL="https://pypi.tuna.tsinghua.edu.cn/simple"
|
|
||||||
# Bottles
|
|
||||||
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
|
|
||||||
else
|
|
||||||
unset HOMEBREW_API_DOMAIN
|
|
||||||
unset HOMEBREW_BOTTLE_DOMAIN
|
|
||||||
unset HOMEBREW_BREW_GIT_REMOTE
|
|
||||||
unset HOMEBREW_CORE_GIT_REMOTE
|
|
||||||
unset HOMEBREW_PIP_INDEX_URL
|
|
||||||
# Bottles
|
|
||||||
unset HOMEBREW_BOTTLE_DOMAIN
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function cdi() {
|
function cdi() {
|
||||||
cd $(find . -type d | fzf)
|
cd $(find . -type d | fzf)
|
||||||
|
|||||||
Reference in New Issue
Block a user