Does anyone have experience using GNU Stow for managing dot files? I’m especially interested in using it to build a git repo to include my .vimrc file so I can sync it between hosts.

I know I’ve seen other methods, such as making your home directory a bare git repo, so you can check-in your config files without moving them. There is also the chezmoi golang project.

How do others sync .vimrc between hosts?

  • @bhagwan
    link
    91 year ago

    I’m especially interested in using it to build a git repo to include my .vimrc

    I have tried many different ways to manage my dotfiles across different systems, IMHO the best way is using a “git bare” repository, it takes a few minutes to wrap your head around how it works (your entire home being a “selective git repo”) but thankfully yadm makes this super easy and once you have it setup properly it’s life changing.

    What I like the most about it is the fact that there’s no more manual trigger commands to copy/symlink the files, you work on the file directly and then commit directly (as your homefolder is essentially the git repo) and here’s the best thing any command that works on git works with the yadm bare repo, so you can branch, rebase, revert commits, bisect, etc.

    In my dot files I have a simple alias to yadm as follows: dot='/home/bhagwan/dots/yadm/yadm --yadm-repo /home/bhagwan/dots/yadm-repo-priv -C /home/bhagwan' and I use it as git command replacement for the yadm repo, say I want to see diff or status I would execute dot status (or dot diff respectively) and even have zsh command completeion for it with tab.

    If nothing else, use yadm just for this quote (from their homepage): When you are away from your own configurations, you are an orphaned refugee in unfamiliar and hostile surroundings :-)

    If this peaked your interest, you can also checkout the bootstrap script for the yadm repo from my dotfiles.

    • @Elw
      link
      21 year ago

      This is really interesting! I’ve kept a selective repo of my config files for many years and maintained a bootstrap script inside of it that sounds similar, but distinctly different in a couple of ways, from this approach.

      My approach has always been to have the actual files in a git directory in my home directory and the bootstrap script builds the symlinks around my system but the actual files still live in the directory. It never occurred to me to make my whole home directory a fit repo, though, and manage the files selectively that way…. Might try that out on this Arch system I just got up and running since the home dir isn’t too big yet

  • @glad_cat
    link
    51 year ago

    I’ve been using Chezmoi for 2 weeks and it’s fine so far. I guess most of those tools have the same features and IMHO it’s a waste of time to compare every little detail. Use one for a month (stow in your case) and see if it’s good for you.

    • umbraklatOP
      link
      11 year ago

      Do you use any of the encrypted secrets features? That’s one of the big differences between chezmoi and the other options.

      • @glad_cat
        link
        11 year ago

        I don’t use such a feature. I only keep basic configurations that I don’t want to reproduce everywhere like my emacs configuration. I suspect it’s mostly used by developers who need to store SSH keys, server configs, or other weird stuff. I’m a developer for backend or regular applications and I don’t need this kind of synchronization.

  • @igemnace
    link
    41 year ago

    I agree with @glad_cat@lemmy.sdf.org, all of these are just different ways to skin the cat. Whatever gets the files in the proper directories. Once you pick one (even arbitrarily, to a degree), you’ll very likely find no reason to push you toward another solution. I myself use symlinks with GNU cp -s

    • umbraklatOP
      link
      41 year ago

      I’ve never heard of cp -faTs before. I did some experimenting and was surprised that it was recursive. I thought you needed an -R for that, but you don’t. So, cp -faRTs appears to do the same thing, but is funnier.

      In any case, thanks for sharing your repo. I take it, that after the initial install, you can just repeatedly git pull https://git.sr.ht/~igemnace/vim-config and then run vim-config/scripts/install-cfg to keep your config files up-to-date.

      • @igemnace
        link
        2
        edit-2
        1 year ago

        Right! Recursive is implied by -a

        Yep. There’s a single ./install script in project root that calls install-cfg and install-plugins. I only really need to run it once (first time I set up on a machine), and every time I add a new file. If all I’ve done is update existing files, a simple git pull will update my dotfiles’ content automatically, as everything is symlinked already.

    • @nsp
      link
      11 year ago

      Nice! I never knew cp could do that. No more struggling to remember in which order the ln parameters should be!

      • @igemnace
        link
        2
        edit-2
        1 year ago

        Worth noting that this is GNU-specific! For macOS for example, you’d have to install GNU userland (e.g. from homebrew) to get the flag. There’s still value in using other solutions (such as ln), portability-wise.

        As an aside: I mostly think of the ln param orders as exactly the same as cp and mv:

        cp FROM TO
        mv FROM TO
        ln [-s] FROM TO
        

        Maybe that could help!

    • umbraklatOP
      link
      11 year ago

      Cool, thanks for sharing the repo. I’m reading through your vimrc file, I always find these interesting. I like what you did in “Open new line and stay in normal mode,” “Exit insert mode faster,” and “Navigate buffers.” I’m going add those now!

  • @Drakulad3a
    link
    31 year ago

    I have been using GNU Stow for about a year and it’s great.

  • @suprjami
    link
    21 year ago

    I’ve been meaning to look into this too. A single dotfile is easy. I also want to submodule all my plugins and have a single command to deploy an entire ~/.vim on a new system.

  • @jaj
    link
    21 year ago

    Waow, this is really the first time I heard about GNU stow 🤔

  • @zahren
    link
    21 year ago

    Oh wow - this is incredibly helpful! I have been working on some shell scripts to do this over the last week and just replaced the majority of the script with GNU stow and it is much more elegant in its simplicity. Kind of surprised I have not heard of this tool.

    Using https://github.com/Czahrien/shell-config-files if you are curious. I settled on having a main dotfiles folder containing packages that will always be stowed, a platform folder with a name derived from uname -s -m and a host folder derived from the hostname.

    • umbraklatOP
      link
      21 year ago

      I’ve never seen that in a .gitignore, seems straightforward enough. I guess most people prefer to use the git config option, but this works!

  • EamonnMR
    link
    11 year ago

    I just simlink from my home dir to my settings repo.