LintaoAmons / scratch.nvim

Create temporary playground files effortlessly. Find them later without worrying about filenames or locations.
Other
246 stars 9 forks source link

[Feat]: Have an automatic backup option #29

Closed jay-babu closed 9 months ago

jay-babu commented 10 months ago

high level: on a scratch file save, write the output to some external service like github gists. on first init of this plugin, if the scratch save location is empty then pull from gists. if this implementation seems like too much maintenance then possibly provide some functions/autocommands that run on file save and on first load so this can be achieved.

LintaoAmons commented 10 months ago

Hi, Thanks for your ideas,

But sync ability is not my priority right now, you can use other service like google drive or syncthing etc. to sync the directory your are using for scratch files.

if this implementation seems like too much maintenance then possibly provide some functions/autocommands that run on file save and on first load so this can be achieved.

You can write a custom command to achieve this. Not limited to scratch.nvim, this command can be use under any buffer, to sync the file to the destination you want.

I recommend you to use my another plugin easy-command.nvim to achieve this, some thing like

function() 
  local editor = require("easy-commands.impl.util.editor")
  local sys = require("easy-commands.impl.util.base.sys")
  local path = editor.buf.read.get_buf_abs_path()
  sys.run_sync({"sync-command", path}, ".") -- change the sync-command to anything you like
end