Live data from Hacker News

Ask HN: What do you use to manage dotfiles?

news.ycombinator.com

61–70 of 97 posts

Re: Ask HN: What do you use to manage dotfiles?

#61
post #60

I use: git init --bare $HOME/.myconf alias config='/usr/bin/git --git-dir=$HOME/.myconf/ --work-tree=$HOME' config config status.showUntrackedFiles no where my ~/.myconf directory is a git bare repository. Then any file within the home folder can be versioned with normal commands like: config status config add .vimrc config commit -m "Add vimrc" config add .config/redshift.conf config commit -m "Add redshift config"…

You mean, you are also adding pushing your .ssh dir to a remote repo?

Not at all. You can 'git add' (or in the case of the technique above 'config add') only the files and folders that are safely stored in a repository. Because of the 'ShowUntrackedFiles' flag, git/config won't always show folders you don't want to track, which would be annoying.

Re: Ask HN: What do you use to manage dotfiles?

#62
post #61
post #60

Earlier quoted context omitted.

You mean, you are also adding pushing your .ssh dir to a remote repo?

Not at all. You can 'git add' (or in the case of the technique above 'config add') only the files and folders that are safely stored in a repository. Because of the 'ShowUntrackedFiles' flag, git/config won't always show folders you don't want to track, which would be annoying.

Perfect then,

Re: Ask HN: What do you use to manage dotfiles?

#64
post #59

Earlier quoted context omitted.

It's probably better if you do it then :-) I would probably skip some important parts trying to explain because I'm too much used to it already.

Working on it! I'll give you full credit for it and link to this thread for reference. Also let me know if you have a Twitter account you'd like me to reference.

Nice thanks. I don't have twitter. Also don't present me as the inventor of this technique because I'm not. I've read this long time ago on some dark corners of the internet :-) I'm just pointing it out.

Re: Ask HN: What do you use to manage dotfiles?

#65
post #59

Earlier quoted context omitted.

Working on it! I'll give you full credit for it and link to this thread for reference. Also let me know if you have a Twitter account you'd like me to reference.

Nice thanks. I don't have twitter. Also don't present me as the inventor of this technique because I'm not. I've read this long time ago on some dark corners of the internet :-) I'm just pointing it out.

Alright I'll be careful in my wording ;).

Re: Ask HN: What do you use to manage dotfiles?

#67
I've probably spent hundreds of hours across all my configs over the years. In the old days, I'd rsync config files manually. Having frustrating times where I had to start everything over again.

I have a lot to say on the subject.

1. Like other users here, git is a great way version your files. Not just that, it handles the issue you have with keeping the configs of various systems in sync.

1b. It doesn't have to be GitHub, but understand pushing to some remote gives you a backup, and a way to keep the latest configs you have in sync across multiple machines.

2. As a rule of thumb, the more POSIX compliant you are, the more cross-compatible your dot-configs will be. In my case, a great deal of my config works superbly across Ubuntu, FreeBSD and OS X with no modification whatsoever.

3. dotfiles (https://pypi.python.org/pypi/dotfiles) is very helpful for building those initial symlinks.

4. Tangentially related is PATH's. Definitely be sure you're not accidentally appending multiple one's over again or omitting ones you want to search. For this, I recommend a pathappend function like one used at http://superuser.com/a/753948.

5. As for managing vim / neovim, I'm coming to the realization the amount of time I've spent trying to configure completion / fix tiny things over the years probably makes me lose the net benefit vim has given me. Too bad there is no intellij for the CLI. In any event, I keep a vim config at https://github.com/tony/vim-config which I document extensively. It has quite a lot of bells and whistles, but lazy loads and checks the system before installing certain plugins. It should work with neovim too.

I keep my central dot-configs (along with its submodules) at https://github.com/tony/.dot-config. Its permissively licensed, so feel free to copy whatever you'd like.

Re: Ask HN: What do you use to manage dotfiles?

#69
post #51

Emacs Org-mode's org-babel functionality. I have a few org-mode files storing all the dotfiles, put under version control. I can update and deploy them from within Emacs.

Interesting approach! Think you can provide us with a small working example, especially the 'deploy' part?

This is what I came up with over lunch. I'm going to try keeping all my dotfiles in one org file. I have an init hook that runs org-bable-tangle to re-export all the dotfiles after saving.

  ** Meta
     If you place the following code into your emacs init when saving the
     ~/.dotfiles.org file the dotfiles will all be exported.

     #+BEGIN_SRC emacs-lisp :tangle yes
       (defun dotfiles-hook ()
         "If the current buffer is '~/.dotfiles.org' the code-blocks are
       tangled."
         (when (equal (buffer-file-name)
                      (expand-file-name (concat (getenv "HOME")
                                        "/.dotfiles.org")))
           (org-babel-tangle)))

       (add-hook 'after-save-hook 'dotfiles-hook)
     #+END_SRC

  ** bashrc
    #+BEGIN_SRC conf :tangle ~/.bashrc
      export PATH=$HOME/bin:$PATH
    #+END_SRC

  ** tmux
    #+BEGIN_SRC conf :tangle ~/.tmux.conf
      unbind C-b
      set -g prefix C-t
      bind C-t send-prefix
    #+END_SRC
Post reply on HN