Skip to content

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

Open

Description

@aliteralmind

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 :)

Activity

  1. 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[/+] on Jan 6, 2015
  2. skuroda commented on Jan 6, 2015

    @skuroda
    Contributor

    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.

  3. aliteralmind commented on Jan 6, 2015

    @aliteralmind
    Author

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

  4. aliteralmind commented on Feb 11, 2015

    @aliteralmind
    Author

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

  5. FichteFoll commented on Jul 19, 2022

    @FichteFoll
    Member

    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.

  6. FichteFoll commented on Jul 19, 2022

    @FichteFoll
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions