Sync aspell dictionary between different machines via Dropbox

Table of contents:

Motivation

aspell is a noice command-line spell checker I use for various things, including this blog post, readme and other docs in open and private source projects, etc.

I use it on multiple machines and it'd be stupid to not sync my dictionary between them.

Dropbox or any other file sync service (Google Drive, Yandex.Disk, Box, etc) is a pretty easy solution for this problem.

Implementation

 

Discover where aspell stores dictionaries

aspell seems to store user's dictionaries directly in $HOME (at least aspell installed from Homebrew on macOS).

ie:

$ ls -la ~
-rw-r--r--    1 user  group          24 May  7 13:45 .aspell.en.prepl
-rw-r--r--@   1 user  group         781 May  7 13:45 .aspell.en.pws

In this example ~/.aspell.en.pws is my custom EN dictionary.

To sync it between machines via Dropbox you need to:

  1. Move dictionary file to Dropbox
  2. Symlink dictionary file(s) from Dropbox back to $HOME

Move dictionary file to Dropbox

I use following Dropbox folder structure:

$ mkdir -p ~/Dropbox/shared-env/aspell

Moving dictionary:

$ mv ~/.aspell.en.pws ~/Dropbox/shared-env/aspell/aspell.en.pws

Symlink dictionary from Dropbox

$ ln -s ~/Dropbox/shared-env/aspell/aspell.en.pws ~/.aspell.en.pws

Add another machine

On another machine, you'll need to remove existing dictionary file(s) (make sure to merge them with ones from Dropbox if needed) and symlink the ones from Dropbox.

Remove existing dictionary file:

$ rm ~/.aspell.en.pws

Then repeat Symlink dictionary from Dropbox step.

That's it.

comments powered by Disqus