Skip to content

Commit

Permalink
Merge pull request #17 from ik11235/feature/change_asdf_to_mise
Browse files Browse the repository at this point in the history
asdf -> mise移行
  • Loading branch information
ik11235 authored Feb 23, 2025
2 parents c12e6e8 + 47ec335 commit 6c09223
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 73 deletions.
2 changes: 1 addition & 1 deletion DOT_LINK_TARGET/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ tap "homebrew/services"
tap "ynqa/tap"
tap "yt-dlp/taps"
brew "aria2"
brew "asdf"
brew "aspell"
brew "autossh"
brew "awscli"
Expand All @@ -32,6 +31,7 @@ brew "jq"
brew "make"
brew "mas"
brew "minio-mc"
brew "mise"
brew "mozjpeg"
brew "mysql"
brew "nkf"
Expand Down
3 changes: 0 additions & 3 deletions DOT_LINK_TARGET/config/asdf-direnv/zshrc

This file was deleted.

40 changes: 3 additions & 37 deletions DOT_LINK_TARGET/config/fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ if test -d (brew --prefix)"/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/"
source (brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.fish.inc
end

# direnv
## https://github.com/direnv/direnv/blob/master/docs/hook.md#fish
direnv hook fish | source

## homebrew-command-not-found
set HB_CNF_HANDLER (brew --prefix)"/Library/Taps/homebrew/homebrew-command-not-found/handler.fish"
if test -f $HB_CNF_HANDLER
Expand All @@ -32,39 +28,6 @@ function save_history --on-event fish_preexec
history marge
end


# asdf
# ASDF configuration code
if test -z $ASDF_DATA_DIR
set _asdf_shims "$HOME/.asdf/shims"
else
set _asdf_shims "$ASDF_DATA_DIR/shims"
end

# Do not use fish_add_path (added in Fish 3.2) because it
# potentially changes the order of items in PATH
if not contains $_asdf_shims $PATH
set -gx --prepend PATH $_asdf_shims
end
set --erase _asdf_shims

. ~/.asdf/plugins/golang/set-env.fish

# anyenvのPATHをbrewの実行時の対象から除外する
## https://www.null-engineer.com/2019/02/08/anyenv%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E6%B8%88%E3%81%BF%E3%81%AEmac%E3%81%A7brew-doctor%E3%82%92%E5%AE%9F%E8%A1%8C%E3%81%97%E3%81%9F%E3%82%89warning%E3%81%8C%E5%87%BA%E3%82%8B/
## phpenv等でも出るらしいので、anyenv管理のものは一律除外
## https://qiita.com/takc923/items/45386905f70fde9af0e7

set NOT_ANYENV_PATH ""

for tmp_path in (string split : $PATH)
if ! string match '*/.asdf/*' $tmp_path >> /dev/null
set NOT_ANYENV_PATH $NOT_ANYENV_PATH $tmp_path
end
end

alias brew="env PATH=$NOT_ANYENV_PATH (which brew)"

## M1関係の設定
if test (uname -s) = "Darwin" && type arch > /dev/null
alias x64='exec arch -arch x86_64 "$SHELL"'
Expand Down Expand Up @@ -101,3 +64,6 @@ fzf --fish | source
### TODO: 常に出るの邪魔なので管理系のディレクトリに入ったときだけonにしたい
set -g theme_display_k8s_context yes
set -g theme_display_k8s_namespace yes

# mise
set -gx PATH ~/.local/share/mise/shims $PATH
3 changes: 0 additions & 3 deletions DOT_LINK_TARGET/zsh.d/zshrc_global
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ precmd () {
# バージョン管理されているディレクトリにいれば表示,そうでなければ非表示
RPROMPT="%1(v|%F{green}%1v%f|)[%d]"

# direnv
eval "$(asdf exec direnv hook zsh)"

export EDITOR="nano"

## ログイン時にtmux自動アタッチする関数
Expand Down
32 changes: 3 additions & 29 deletions DOT_LINK_TARGET/zsh.d/zshrc_mac
Original file line number Diff line number Diff line change
@@ -1,35 +1,6 @@
#brew 補完
##source /usr/local/Library/Contributions/brew_zsh_completion.zsh

# asdf
## source $(brew --prefix asdf)/libexec/asdf.sh
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"

## asdf系のファイルをbrew時のみ除外する設定
if [ -d ~/.asdf/shims ]; then
# brewコマンド実行の際のみ.asdf/shimsをPATHから外す
## https://www.task-notes.com/entry/20141223/1419324649
EXCLUSION_PATH=$(echo ~/.asdf/shims)
alias brew="env PATH=${PATH/$EXCLUSION_PATH:/} brew"
fi

## asdf-direnv
source "${XDG_CONFIG_HOME:-$HOME/.config}/asdf-direnv/zshrc"

## asdf-golang
. ~/.asdf/plugins/golang/set-env.zsh
### https://github.com/kennyp/asdf-golang#version-selection
export ASDF_GOLANG_MOD_VERSION_ENABLED=true

## asdf-java
if [ -e ~/.asdf/plugins/java/set-java-home.zsh ]; then
. ~/.asdf/plugins/java/set-java-home.zsh
fi

## asdfのupdate時にpathが変わるため、その対応にbrewのシンボリックリンクディレクトリを参照するように上書き
export ASDF_DIR="$(brew --prefix asdf)"
export asdf_cmd_dir="$(brew --prefix asdf)/bin"

#coreutils path
# export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
# export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"
Expand All @@ -53,6 +24,9 @@ fi
## pinentry-macをターミナルで使用する
export GPG_TTY="$(tty)"

# mise
eval "$(/opt/homebrew/bin/mise activate zsh)"

if [[ -o interactive ]] && [ -z "$INTELLIJ_ENVIRONMENT_READER" ] && [ -z "$WARP_IS_LOCAL_SHELL_SESSION" ]; then
exec fish
fi

0 comments on commit 6c09223

Please sign in to comment.