Using the Cloud to Sync Dotfiles (without using symlinks)
Updated  2022-March-7

Page contents

News

2021-December-1  Published this evolving⁠[1] article.

Prerequisites

Terminology

Traditionally a dotfile was a configuration file whose name started with a dot (.), for example:

  • .bashrc

  • .bash_profile

  • .vimrc

Nowadays it’s common to use the word dotfile to mean any configuration file and that’s the meaning I use in this article.

 

The trailing rc in .bashrc and .vimrc means “run commands.” Details are at wikipedia.org/wiki/Rc.

 

My directory and file naming conventions

I use the following naming conventions.

Naming ConventionExample(s)

Most directory names start with an upper case character and sometimes use PascalCase.⁠[2]

DotFiles
PowerShell
Sh
Vim

Most file names use all lower case characters.

vimrc.vim

A directory or file name that I want listed near the top of an alphanumeric sort starts with an underscore (_).

_README.txt

A directory or file name that I want to be really noticeable is in all caps.

_README.txt

 

Path separators

In the scenarios below, the Windows path separator can be either backslash (\) or forward slash (/). To learn about this, see:

Forward slash is also known as slash.

 

How I synchronize my dotfiles

This section describes how I use sync.com[3] to synchronize some of my dotfiles. This strategy should work with Dropbox and other file synchronization services.

 

First, create a DotFiles directory

In my Sync[4] directory, I create a directory named DotFiles.

 

Optionally, create a DOTFILESDIR environment variable

Since the path to my DotFiles directory is different on different devices, I create a DOTFILESDIR environment variable on each device. For example, on one of my Windows devices $DOTFILESDIR is:

C:\Users\USERNAME\Sync\DotFiles

And on another one of my Windows devices, it’s:

D:\Sync\DotFiles

 

Vim’s vimrc

Vim is a plain text editor that is available on many operating systems, including Li⁠nux, macOS, and Windows. For more about Vim and its dotfiles, see…

Below is how I set up my systems to synchronize some Vim settings across my devices.

 

  1. In my Sync/DotFiles directory, I create a directory named Vim.

  2. In this Sync/DotFiles/Vim directory, I create a file named vimrc.vim that contains my cross-⁠device Vim settings.

  3. On each of my devices, in Vim’s default vimrc file[5] (for example ~/VimFiles/vimrc[6] on Windows), I put something like this line:

    source $USERPROFILE/Sync/DotFiles/Vim/vimrc.vim
           ~~~~~~~~~~~~
           works on my Windows devices

    Or, if I’ve defined $DOTFILESDIR, something like this:

    source $DOTFILESDIR/Vim/vimrc.vim

    To learn about the source command, run :help source from within Vim.

  4. Let the cloud storage provider (Dropbox, Filen, sync.com, etc.) synchronize this file across my devices.

  5. Launch Vim on each of my devices and make sure this shared vimrc.vim file is sourced and works.

  6. Celebrate.🎉

 

💡

To help my future self remember how I’ve set things up, I create a README file that describes the above steps, especially step 3. Here is a fragment of my directory structure:

~
└── Sync/
    └── DotFiles/
        └── Vim/
            ├── _README.txt
            └── vimrc.vim

 

 

qutebrowser’s config.py

qutebrowser is a Chromium-based web browser that is available on many operating systems, including Li⁠nux, macOS, and Windows. Details are on Infinite Ink’s #qutebrowser Portal.

Below is how I set up my systems to synchronize some of my qutebrowser settings across my devices.

 

  1. In my Sync/DotFiles directory, I create a directory named Qutebrowser.

  2. In this Sync/DotFiles/Qutebrowser directory, I create a file named config-shared.py that contains my cross-⁠device qutebrowser settings.

  3. On each of my devices, in qutebrowser’s default config.py (for example ~/AppData/Roaming/qutebrowser/config/config.py on Windows), I put something like this line:

    config.source('C:/Full/Path/To/Sync/DotFiles/Qutebrowser/config-shared.py')

    To learn about this, see Infinite Ink’s qutebrowser Tips and Fragments.

  4. Let the cloud storage provider (Dropbox, Filen, sync.com, etc.) synchronize this file across my devices.

  5. Launch qutebrowser on each of my devices and make sure this config-shared.py file is sourced and works.

  6. Celebrate.🎉

 

💡

To help my future self remember how I’ve set things up, I create a README file that describes the above steps, especially step 3. Here is a fragment of my directory structure:

~
└── Sync/
    └── DotFiles/
        └── Qutebrowser/
            ├── _README.txt
            └── config-shared.py

 

See also

Endnotes


1. Many Infinite Ink articles, including this one, are evergreen and regularly updated.
3. This link to sync.com is a referral link. If you use this link to sign up, both you and I will get a free extra gigabyte of storage. To learn about sync.com, see Infinite Ink’s My Primary Cloud Storage Provider is sync.com⁠☁️.
4. The name of this directory depends on the cloud storage provider. Possible names include Dropbox, Filen Sync, and Sync.
5. Within Vim, use the :version command to view a list of possible default vimrc files and the :echo $MYVIMRC command to find out the current vimrc file.
6. Since the Windows file system is case insensitive, naming this default Vim directory VimFiles, rather than all lower case vimfiles, works.

Comments and questions 📝 🤔 👎 👍

Your public comment or question might immediately improve this page or help me to (eventually) improve this page.