AdvancedNewFile
AdvancedNewFile copied to clipboard
Alternate way to open ANF, with current clipboard item used as initial file contents
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 :)
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.
Good to know these things. Definitely helpful.Thank you.
After using your suggestions for a few months, I do not need this feature-request anymore. Thanks again.
Related to what I proposed in https://github.com/SublimeText/AdvancedNewFile/issues/183#issuecomment-1189403037, this could be implemented by accepting an argument to allow a custom command to be executed inside the ~~input field~~new file's view after it has been opened and using that to run the built-in paste
command.
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
- creating a new view,
- pasting your contents from the clipboard,
- 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.