my personal dotfiles managed by dotbot, zinit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
6.4 KiB

4 years ago
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
5 years ago
fi
5 years ago
4 years ago
if [[ ! -f ~/.zinit/bin/zinit.zsh ]]; then
mkdir ~/.zinit
git clone https://github.com/zdharma-continuum/zinit.git ~/.zinit/bin
5 years ago
fi
7 years ago
4 years ago
# load zinit
source ~/.zinit/bin/zinit.zsh
# 快速目录跳转
zinit ice lucid wait='1'
# Turbo mode with "wait"
zinit light-mode lucid wait for \
is-snippet OMZ::lib/history.zsh \
MichaelAquilina/zsh-you-should-use \
zdharma-continuum/history-search-multi-word \
# atload"alias zi='zinit'"
# zinit ice wait"2" as"command" from"gh-r" lucid \
# mv"zoxide*/zoxide -> zoxide" \
# atclone"./zoxide init zsh > init.zsh" \
# atpull"%atclone" src"init.zsh" nocompile'!'
# zinit light ajeetdsouza/zoxide
4 years ago
# binary release, unpack provide fzf
zinit ice from"gh-r" as"program"
zinit light junegunn/fzf
# zinit ice from"gh-r" as"program" mv"docker* -> docker-compose" bpick"*linux*"
# zinit load docker/compose
3 years ago
zinit load agkozak/zsh-z
4 years ago
# Ref: zdharma/fast-syntax-highlighting
# Note: Use wait 1 second works for kubectl
zinit wait lucid for \
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
zdharma-continuum/fast-syntax-highlighting \
4 years ago
atload"zpcdreplay" wait"1" \
OMZP::kubectl \
blockf \
zsh-users/zsh-completions \
atload"!_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions \
as"completion" is-snippet \
https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker \
https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose
# 语法高亮
zinit ice lucid wait='0' atinit='zpcompinit'
zinit light zdharma-continuum/fast-syntax-highlighting
4 years ago
# 自动建议
zinit ice lucid wait="0" atload='_zsh_autosuggest_start'
zinit light zsh-users/zsh-autosuggestions
# 补全
zinit ice lucid wait='0'
zinit light zsh-users/zsh-completions
# 加载 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/git-flow/git-flow.plugin.zsh
zinit snippet OMZ::plugins/mvn/mvn.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 snippet OMZ::plugins/pip/pip.plugin.zsh
zinit ice lucid wait='1'
zinit snippet OMZ::plugins/git/git.plugin.zsh
# Gitignore plugin – commands gii and gi
zinit ice wait"2" lucid
zinit load voronkovich/gitignore.plugin.zsh
zinit load djui/alias-tips
4 years ago
export ASDF_DIR=$HOME/.asdf
4 years ago
# ASDF
if [ -d "$HOME/.asdf" ]; then
# zinit ice wait lucid
# zinit light asdf-vm/asdf
# OR
load_asdf() {
3 years ago
. $HOME/.asdf/asdf.sh
4 years ago
}
zinit light-mode wait lucid for \
atload'load_asdf' \
zdharma/null
fi
# zinit light denysdovhan/spaceship-prompt
zinit ice depth=1; zinit light romkatv/powerlevel10k
# zinit ice as"program" from"gh-r" mv"exa* -> exa" pick"exa/exa" lucid atload"alias ls='exa --icons'"
# zinit light ogham/exa
# OS specific plugins
case `uname` in
Darwin)
4 years ago
# zinit bundle kiurchv/asdf.plugin.zsh
;;
FreeBSD)
;;
esac
4 years ago
#if type brew &>/dev/null; then
# echo "brew completion"
# FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
# #fpath=$(brew --prefix)/share/zsh-completions:$fpath
# fpath=($HOME/.asdf/completions $fpath)
#fi
#. $(brew --prefix asdf)/asdf.sh
#. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash
# Compinit : After zinits, before cdreplay
# https://carlosbecker.com/posts/speeding-up-zsh/
4 years ago
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
autoload -Uz compinit
compinit
fi
fpath=(${ASDF_DIR}/completions $fpath)
4 years ago
autoload -Uz compinit
3 years ago
# if [ $(date +'%j') != $(stat -f '%Sm' -t '%j' ~/.zcompdump) ]; then
# compinit;
# else
# compinit -C;
# fi
# kitty + complete setup zsh | source /dev/stdin
7 years ago
# Load the theme.
4 years ago
# zinit theme agnoster
# workaround for https://github.com/zsh-users/zinit/issues/675
7 years ago
4 years ago
# Tell zinit that you're done.
# zinit apply
7 years ago
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# 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"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# 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`.
4 years ago
#transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
#tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }
5 years ago
source $HOME/dotfiles/zsh/common.zsh
source $HOME/dotfiles/zsh/keybindings.zsh
source $HOME/dotfiles/zsh/alias.zsh
source $HOME/dotfiles/zsh/env.zsh
source $HOME/dotfiles/zsh/fzf.zsh
4 years ago
case `uname` in
Darwin)
source $HOME/dotfiles/zsh/osx.zsh
;;
FreeBSD)
;;
esac
if [[ -f ~/.zshrc.local ]]; then
source $HOME/.zshrc.local
fi
ZSH_DISABLE_COMPFIX=true
4 years ago
# fpath=(~/.zsh/completions $fpath)
# space
SPACESHIP_DIR_SHOW="${SPACESHIP_DIR_SHOW=true}"
SPACESHIP_DIR_PREFIX="${SPACESHIP_DIR_PREFIX="in "}"
SPACESHIP_DIR_SUFFIX="${SPACESHIP_DIR_SUFFIX="$SPACESHIP_PROMPT_DEFAULT_SUFFIX"}"
SPACESHIP_DIR_TRUNC="0"
SPACESHIP_DIR_TRUNC_REPO="${SPACESHIP_DIR_TRUNC_REPO=true}"
SPACESHIP_DIR_COLOR="${SPACESHIP_DIR_COLOR="cyan"}"
5 years ago
# alias
# adb related
# usage adb-screencap > screen.png
alias adbcap="adb shell screencap -p"
4 years ago
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
3 years ago
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
3 years ago