insanum / sncli

Simplenote CLI
MIT License
396 stars 34 forks source link

Saving files while in vim edit mode doesn't result in synch #72

Closed jul-reb closed 5 years ago

jul-reb commented 5 years ago

Notes are only synched upon exiting, rather than saving, this made for an awkward situation where I saved my note, expecting it to be synched, but upon power loss I lost all of my work since the files are stored in /tmp/ and this automatically empties itself on most distros.

samuelallan72 commented 5 years ago

Unfortunately this is unavoidable due to how different editors interact with the filename given. The only reliable way is to reread the file after the editor has exited.

If you want the temporary files stored somewhere on-disk to survive a reboot or power loss, you can set the cfg_tempdir option to a custom directory.

Perhaps it would be worthwhile documenting this behaviour with a warning as well as the cfg_tempdir option in the readme or wiki?

jul-reb commented 5 years ago

Perhaps you could set the standard directory to something other than /tmp? Maybe ~/.sncli/tmp would be a possibility for future releases? (then behaviour could be set to clean the tmp notes X days after they are synched?)

samuelallan72 commented 5 years ago

I'd rather document the cfg_tempdir option in the readme than change the default. The default is the simplest option and most effective for most cases.