From 77a615737923cadd95e5945d8be69db155606096 Mon Sep 17 00:00:00 2001 From: takyshu98 Date: Mon, 8 Jan 2024 21:12:18 +0900 Subject: [PATCH] WIP --- .config/sheldon/plugins.toml | 7 +++++-- .config/zsh/.zshrc | 2 +- .gitignore | 2 -- .zshenv | 7 ++++++- README.md | 22 +++++----------------- scripts/symlink.sh | 9 +++++++++ 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/.config/sheldon/plugins.toml b/.config/sheldon/plugins.toml index 70c0742..19ef7e5 100644 --- a/.config/sheldon/plugins.toml +++ b/.config/sheldon/plugins.toml @@ -17,7 +17,7 @@ apply = ["defer"] # ref: https://sheldon.cli.rs/Examples.html#deferred-loading-of-plugins-in-zsh [templates] -defer = "{% for file in files %}zsh-defer source \"{{ file }}\"\n{% endfor %}" +defer = "{{ hooks?.pre | nl }}{% for file in files %}zsh-defer source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}" [plugins] @@ -31,7 +31,7 @@ github = "romkatv/zsh-defer" apply = ["source"] [plugins.compinit] -inline = 'autoload -Uz compinit && zsh-defer compinit' +inline = 'autoload -Uz compinit && zsh-defer compinit -d "${XDG_CACHE_HOME}/.zcompdump"' # ref: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh [plugins.brew-completion] @@ -54,6 +54,9 @@ apply = ["source"] [plugins.enhancd] github = "b4b4r07/enhancd" +[plugins.enhancd.hooks] +pre = 'export ENHANCD_DIR="${XDG_STATE_HOME}/.enhancd"' + # [plugins.asdf] # github = "asdf-vm/asdf" diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 3d5a4d1..41ce865 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -17,7 +17,7 @@ bindkey -e alias ls='ls -FG' # set history options -export HISTFILE="${ZDOTDIR}/.zsh_history" +export HISTFILE="${XDG_STATE_HOME}/.zsh_history" export HISTSIZE=3000 export SAVEHIST=3000 diff --git a/.gitignore b/.gitignore index 98ce208..f309002 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ .DS_Store -.config/zsh/.zcompdump -.config/zsh/.zsh_history Brewfile.lock.json \ No newline at end of file diff --git a/.zshenv b/.zshenv index 0751c94..e0540c8 100644 --- a/.zshenv +++ b/.zshenv @@ -16,6 +16,11 @@ elif [ "${arch_type}" = "arm64" ]; then eval "$(/opt/homebrew/bin/brew shellenv)" # for Apple silicon fi -# set zdotdir +# set xdg export XDG_CONFIG_HOME="${HOME}/.config" +export XDG_CACHE_HOME="${HOME}/.cache" +export XDG_DATA_HOME="${HOME}/.local/share" +export XDG_STATE_HOME="${HOME}/.local/state" + +# set zdotdir export ZDOTDIR="${XDG_CONFIG_HOME}/zsh" \ No newline at end of file diff --git a/README.md b/README.md index 3acd36d..d133f29 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,11 @@ ![dotfile workflow](https://github.com/takyshu98/dotfiles/actions/workflows/main.yml/badge.svg) -## ☑ Install Command Line Tools +## Installation ``` -xcode-select --install +$ xcode-select --install +$ bash -c "$(curl -L https://raw.githubusercontent.com/takyshu98/dotfiles/master/install.sh)" +$ mise install +$ sudo reboot ``` - -## ☑ Run install script -``` -bash -c "$(curl -L https://raw.githubusercontent.com/takyshu98/dotfiles/master/install.sh)" -``` - -## ☑ Setup Runtime -``` -rtx install -``` - -## ☑ Reboot Machine -``` -sudo reboot -``` \ No newline at end of file diff --git a/scripts/symlink.sh b/scripts/symlink.sh index 2f5b8b2..3a57269 100755 --- a/scripts/symlink.sh +++ b/scripts/symlink.sh @@ -24,6 +24,15 @@ done mkdir -p "${XDG_CONFIG_HOME}" find "${DOTPATH}/.config" -maxdepth 1 -exec ln -fvns {} "${XDG_CONFIG_HOME}" \; +[[ -z "${XDG_CACHE_HOME}" ]] && XDG_CACHE_HOME="${HOME}/.cache" +mkdir -p "${XDG_CACHE_HOME}" + +[[ -z "${XDG_DATA_HOME}" ]] && XDG_DATA_HOME="${HOME}/.local/share" +mkdir -p "${XDG_DATA_HOME}" + +[[ -z "${XDG_STATE_HOME}" ]] && XDG_STATE_HOME="${HOME}/.local/state" +mkdir -p "${XDG_STATE_HOME}" + # make directories with reference to Filesystem Hierarchy Standard mkdir -p ~/bin # for original commands find "${DOTPATH}/bin/" -type f -perm 0755 -exec ln -fvns {} ~/bin/ \;