LintaoAmons / scratch.nvim

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

Remove files elegantly and support Windows #25

Closed OliverChao closed 10 months ago

OliverChao commented 10 months ago

Hey, I find one easy and elegant way to remove files and it should support Windows.

Instead of Unix command rm/rmdir, os.remove should support Windows.

=======

And ScratchOpenFzf needs telescope check also.

OliverChao commented 10 months ago

One more thing, I noticed that ScratchOpen would use native vim.ui if use_telescope is false even though telescope is installed.

There exists one buggy thing that ScratchOpen will fail user who never has telescope but sets use_telescope(by default is true).

In my opinion, Scratch should always use telescope if it is installed, thus the use_telescope should be removed and Scratch auto chooses the selection ui.

====

But, I don't want to introduce to breaking changes, and it deserves future talk. So, I just add some info messages for every function using telescope.

LintaoAmons commented 10 months ago

Oh, this one need to consider, because I don't want to have a quite big behaviour change unless see quite a lot of users require to change. So want to stick with the current behaviour and have an option to let them choose change or not.

And I haven't figured out how to like sort the files by modification date desc when open a telescope finder, and also how to register local keybindings.

But yes, I would say telescope should be a better solution to find and open files, and just because at the very beginning I just want to have some MVP version so I didn't pay more attention to telescope integration.

Sorry for late reply, quite a lot work to do recently~

OliverChao commented 10 months ago

Yep, I got it. This PR has no breaking change. It uses os.remove system call instead of rm/rmdir for supporting Windows. It should be OK.

=====

Maybe scratch.nvim will add an telescope extension later for totally supporting telescope. And it works fine anyway currently.

LintaoAmons commented 10 months ago

thx!