Skip to content

add *.configsymlink convention for ~/.config/ dotfiles#408

Open
drewwells wants to merge 1 commit intoholman:masterfrom
drewwells:config-dotfiles
Open

add *.configsymlink convention for ~/.config/ dotfiles#408
drewwells wants to merge 1 commit intoholman:masterfrom
drewwells:config-dotfiles

Conversation

@drewwells
Copy link
Copy Markdown

Introduces install_config_dotfiles() which mirrors the existing *.symlink -> $HOME behavior, but links *.configsymlink files into $HOME/.config/ for tools that follow XDG config conventions.

Introduces install_config_dotfiles() which mirrors the existing
*.symlink -> $HOME behavior, but links *.configsymlink files into
$HOME/.config/ for tools that follow XDG config conventions.
@matthiasseghers
Copy link
Copy Markdown

I did a similar approach, but instead of using a *.configsymlink filename convention, I match any file under topic/config/ and symlink each file individually into ~/.config//, preserving subdirectory structure. This means nested configs like nvim/config/lua/plugins.lua → ~/.config/nvim/lua/plugins.lua work automatically with no extra convention needed.

install_config_files () {
  info 'installing ~/.config files'

  while IFS= read -r src; do
    # Derive topic from the first path component after DOTFILES_ROOT
    local rel="${src#"$DOTFILES_ROOT"/}"
    local topic="${rel%%/*}"
    # Derive path within config/ (strip <topic>/config/)
    local subpath="${rel#"$topic"/config/}"
    local dst="$HOME/.config/$topic/$subpath"
    mkdir -p "$(dirname "$dst")"
    link_file "$src" "$dst"
  done < <(find -H "$DOTFILES_ROOT" -mindepth 3 -type f -path '*/config/*' -not -path '*.git*' -not -name '*.symlink')
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants