For a long time I’ve toyed with the idea of replacing Simplenote with a Fossil repo of text files, more from an “owning your own data” point of view than anything else, but more “recently” since I stopped using Vim and switched to Helix. It’s probably not happening any time soon as Simplenote is still too convienent on mobile, but I thought I’d have a little play just because Fossil’s auto-sync is really neat.
- Created a repo on my (this) server, but a private one for now, not public
- Cloned that via
sshto my local machine:fossil clone ssh://me@linode/Code/fossil/repos/notes.fossil -
Then added a little “hook” to Helix via my mksh config like so:
function hx { /usr/pkg/bin/hx $@ if [[ $(pwd) == '/home/simon/Code/fossil/checkouts/notes' ]] then if [[ $(fossil extras) != "" ]] then fossil add $(fossil extras) fi fossil commit -m 'Auto-sync notes' fi }The idea being that if I am editing a note and then exit and save, Fossil will then automatically sync changes, including adding it if it’s a new note. The only downside to this is that if I suspend Helix (Ctrl+z) then that also triggers this and if I resume (
fg) and then quit it won’t automatically sync. -
So I’ve also added a keybinding of
fsto Helix to manually trigger a sync:[keys.normal.f] s = [":write", ':sh if [ "$(fossil extras)" != "" ]; then fossil add $(fossil extras); fi; fossil commit -m "Auto-sync notes"'](Slightly different syntax as it’s
shas opposed tomksh)
I can’t see me fully switching from Simplenote yet as I don’t have a good mobile solution (apart from using a sftp client on Android… hmmm… maybe), but it’s interesting to play about.