mistricky / codesnap.nvim

📸 Snapshot plugin with rich features that can make pretty code snapshots for Neovim
MIT License
473 stars 15 forks source link

save_path is not a path but a specific filename #59

Closed dch closed 2 months ago

dch commented 2 months ago

I was expecting save_path to take a directory as parameter, not a specific filename.

e.g. save_path = /home/me/snapshots/"

and for it to auto-generate filenames for that directory.

Instead it seems to take a specific named file only:

require("codesnap").setup({
    save_path = "/tmp/snap.png"
})

Which seems a lot less useful?

Could we either add a auto_save_dir parameter which does what I expected, or is it possible to change the behaviour for save_path, after it's been shipped?

mistricky commented 2 months ago

Hi there, sounds a great idea, but what should be the auto-generate filename?

mistricky commented 2 months ago

The CodeSnapSave command act like download, whenever you use browser or something download file, the browser will always prompt a dialog to ask you to enter the desired filename for downloading or the filename is already specified by that website.

If we provide a save_path parameter for CodeSnapSave command, would it be better? like:

CodeSnapSave ~/Pictures/xxxx.png

If you not pass the save_path to CodeSnapSave, the CodeSnap.nvim will read the save_path item in config instead.

CodeSnapSave
vinniefranco commented 2 months ago

You could have a sane default and allow a config to override it. Use strftime formatting to do something like "Codesnap-%Y-%m-%d-%H%M%S.png"