Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate way to open ANF, with current clipboard item used as initial file contents #121

Open
aliteralmind opened this issue Jan 6, 2015 · 5 comments

Comments

@aliteralmind
Copy link

ANF is one of my primary plugins (Windows ST3), but only after I started using Clipboard Manager (CM) with it. I find myself more often than not, having the initial contents for the file in the clipboard. But this conflicts with the fact that I most often create the path by copying it from an existing folder (either in the sidebar or externally), and then tailor it in the ANF dialog. Because of this conflict, before CM, I ended up not using AdvancedNewFile at all.

Now with CM, I have the initial contents in the clipboard, I copy the folder path, paste it into the ANF dialog, tailor it, then

"Package Control > Clipboard Manager: Choose and Paste > down arrow for item 2 (the 1st is the path), enter".

Not great, but much smoother!

I wish ANF had an optional feature that would make this even better. It's the ONLY reason I use CM to begin with. Specifically, I'm thinking a new command called something like "open_advanced_new_file_use_clip_as_initial_contents". I would call this with an alternative key command (likely ctrl+shift+N--I call ANF normally with ctrl+n, and the original File>New with ctrl+alt+n).

It would copy the current clipboard text into this special initial-file-contents-buffer, and then open the ANF dialog as usual. I would then copy and then tailor the path and hit enter. The file is created as normal, but, in this case the contents of that buffer (the text previously in the clipboard) would be immediately pasted into the new file.

I hope I've been clear. This would dramatically increase ANF's usage, and it's already really useful!

Thanks for listening :)

@aliteralmind aliteralmind changed the title Hold the previous clipboard item in memory (which contains contents), checkbox to use it as initial new file contents Alternate way to open ANF, with current clipboard item used as initial file contents Jan 6, 2015
@skuroda
Copy link
Contributor

skuroda commented Jan 6, 2015

If you are using the "New file at" command (see https://github.com/skuroda/Sublime-AdvancedNewFile/wiki/Menu-Entries#side-bar-menu), it should populate with the selected directory. If you are using the normal command, you may want to try the special alias :. This will create a structure relative to the directory of the current project. Alternatively, you could try using ./ if relative_from_current is set to true in your settings.

Obviously not an exact match, but may get you closer. I've been busy so haven't been able to work on the plugin much. So some alternative solutions may help.

@aliteralmind
Copy link
Author

Good to know these things. Definitely helpful.Thank you.

@aliteralmind
Copy link
Author

After using your suggestions for a few months, I do not need this feature-request anymore. Thanks again.

@FichteFoll
Copy link
Member

FichteFoll commented Jul 19, 2022

Related to what I proposed in #183 (comment), this could be implemented by accepting an argument to allow a custom command to be executed inside the input fieldnew file's view after it has been opened and using that to run the built-in paste command.

@FichteFoll
Copy link
Member

FichteFoll commented Jul 19, 2022

Actually, re-reading the initial post, this isn't what you're requesting. What you want is to insert the contents of the clipboard first and then name your file. I don't think the standard workflow can be easily catered to that use case, but as an alternative, how about

  1. creating a new view,
  2. pasting your contents from the clipboard,
  3. invoking "ANF: Rename File" and set the target file name in the input in standard ANF fashion as opposed to using ST's save dialog?

Note: Requires #135 to be fixed first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants