From be30fdf201179de2c8c0faf76dc25bf0403c6706 Mon Sep 17 00:00:00 2001 From: Akira Maruoka Date: Mon, 16 Oct 2023 00:57:42 +0900 Subject: [PATCH] refactored --- .tool-versions | 1 + .zshrc | 93 +++++++++++++------------------------------- install/sheldon.sh | 6 +-- sheldon/plugins.toml | 5 +++ 4 files changed, 35 insertions(+), 70 deletions(-) diff --git a/.tool-versions b/.tool-versions index 84470a3..ef1c9fe 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,3 +1,4 @@ +direnv latest golang latest nodejs lts python sub-0.1:latest diff --git a/.zshrc b/.zshrc index 61a4229..114fbf9 100644 --- a/.zshrc +++ b/.zshrc @@ -68,9 +68,11 @@ WORDCHARS='*?_-.[]~=&;!#$%^(){}<>' # XDG Base Directory # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html # +export XDG_BIN_HOME=$HOME/.local/bin export XDG_CACHE_HOME=$HOME/.cache export XDG_CONFIG_HOME=$HOME/.config export XDG_DATA_HOME=$HOME/.local/share +export XDG_LIB_HOME=$HOME/.local/lib export XDG_STATE_HOME=$HOME/.local/state @@ -88,30 +90,37 @@ if type "sheldon" > /dev/null 2>&1; then fi +# +# Complementarity +# It must be executed after zsh-completions +# +compctl -c man which +compctl -g '*.tex' platex jlatex +compctl -g '*.dvi' xdvi dvi2ps +compctl -g '*.ps' gv lpr idraw + + # # Plugins # +## powerlevel10l + [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + + ## fzf case $OSTYPE in linux*) - source $HOME/.config/fzf/fzf.zsh + fzf_zsh_path="${XDG_CONFIG_HOME}"/fzf/fzf.zsh + [ -f "${fzf_zsh_path}" ] && source "${fzf_zsh_path}" ;; esac +export FZF_TMUX=1 +export FZF_DEFAULT_OPTS='--height 40% --reverse --border' +#source $HOME/.zplug/repos/junegunn/fzf/shell/key-bindings.zsh - -# -# Complementarity -# -autoload -Uz compinit && compinit -compctl -c man which -compctl -g '*.tex' platex jlatex -compctl -g '*.dvi' xdvi dvi2ps -compctl -g '*.ps' gv lpr idraw - - -# enhanced +## enhanced export ENHANCD_HOOK_AFTER_CD=ls # @@ -177,42 +186,8 @@ esac # -# zplug +# fzf functions # -# export ZPLUG_HOME=$(brew --prefix)/opt/zplug -# source $ZPLUG_HOME/init.zsh -# # source $HOME/.zplug/init.zsh - -# # Plugins -# zplug 'romkatv/powerlevel10k', as:theme, depth:1 -# zplug 'zsh-users/zsh-autosuggestions' -# zplug 'zsh-users/zsh-completions' -# zplug "zsh-users/zsh-history-substring-search" -# zplug 'zsh-users/zsh-syntax-highlighting' -# zplug "junegunn/fzf-bin", as:command, from:gh-r, rename-to:fzf -# zplug "junegunn/fzf", as:command, use:bin/fzf-tmux -# zplug "b4b4r07/enhancd", use:init.sh -# zplug 'mafredri/zsh-async', from:github -# zplug "chrissicool/zsh-256color" -# zplug 'mollifier/anyframe' -# zplug 'felixr/docker-zsh-completion' - -# # Interactive Install Plugin -# if ! zplug check --verbose; then -# printf "Install? [y/N]: " -# if read -q; then -# echo; zplug install -# fi -# fi - -# # Load Plugins -# zplug load - -# fzf -export FZF_TMUX=1 -export FZF_DEFAULT_OPTS='--height 40% --reverse --border' -#source $HOME/.zplug/repos/junegunn/fzf/shell/key-bindings.zsh - fbr() { local branches branch branches=$(git branch -vv) && @@ -287,7 +262,9 @@ fshow() { {} FZF-EOF" } -eval "$(direnv hook bash)" +if type "direnv" > /dev/null 2>&1; then + eval "$(direnv hook bash)" +fi # frepo - ghq cd browser ghq-fzf() { @@ -299,29 +276,11 @@ ghq-fzf() { bindkey "^]" ghq-fzf -# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - # For llvm export PATH=/usr/local/opt/llvm/bin:$PATH - -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh - - -# For nodebrew -export PATH=$HOME/.nodebrew/current/bin:$PATH - -# For pyenv -export PYENV_ROOT="$HOME/.pyenv" -export PATH="$PYENV_ROOT/shims:$PATH" - # # Remove Duplicated Environments # typeset -gU PATH typeset -gU LD_LIBRARY_PATH - -# eval "$(/Users/maru/.local/share/rtx/bin/rtx activate zsh)" - -[ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh ] && source "${XDG_CONFIG_HOME:-$HOME/.config}"/fzf/fzf.zsh diff --git a/install/sheldon.sh b/install/sheldon.sh index 234e475..098f5e1 100755 --- a/install/sheldon.sh +++ b/install/sheldon.sh @@ -4,12 +4,12 @@ set -euox pipefail case $OSTYPE in linux*) curl --proto '=https' -fLsS https://rossmacarthur.github.io/install/crate.sh \ - | bash -s -- --repo rossmacarthur/sheldon --to ~/.local/bin + | bash -s -- --repo rossmacarthur/sheldon --to "${XDG_BIN_HOME}" ;; darwin*) # sheldon will be installed by brew type "sheldon" esac -mkdir -p $HOME/.config/sheldon -ln -sf ${DOT_PATH}/sheldon/plugins.toml $HOME/.config/sheldon/plugins.toml +mkdir -p "${XDG_CONFIG_HOME}"/sheldon +ln -sf "${DOT_PATH}"/sheldon/plugins.toml "${XDG_CONFIG_HOME}"/sheldon/plugins.toml diff --git a/sheldon/plugins.toml b/sheldon/plugins.toml index 7f86852..0c547ac 100644 --- a/sheldon/plugins.toml +++ b/sheldon/plugins.toml @@ -22,6 +22,9 @@ shell = "zsh" [plugins.zsh-defer] github = "romkatv/zsh-defer" +[plugins.compinit] +inline = 'autoload -Uz compinit && zsh-defer compinit' + [plugins.powerlevel10k] github = "romkatv/powerlevel10k" @@ -43,6 +46,8 @@ github = "zsh-users/zsh-history-substring-search" [plugins.enhancd] github = "b4b4r07/enhancd" +use = ["init.sh"] +apply = ['defer'] [templates] defer = "{% for file in files %}zsh-defer source \"{{ file }}\"\n{% endfor %}"