Author Topic: Copy path to clipboard  (Read 1480 times)

jc44

  • Senior Community Member
  • Posts: 218
  • Hero Points: 15
Copy path to clipboard
« on: October 02, 2012, 11:08:23 am »
I would appreciate "copy path to clipboard" in the the right-click menu of the buffers dialog (Brief: Alt+b) like it is in the edit file dialog (Brief: Alt+e).  I find myself wanting it surprisingly often.

hs2

  • Senior Community Member
  • Posts: 2740
  • Hero Points: 288
Re: Copy path to clipboard
« Reply #1 on: October 02, 2012, 11:43:43 pm »
Although not provided in the context menu it's supported by 'CTRL-C' copying the full path of the current file. (Brief 'PAD-PLUS' can be added with little macro support.)
HS2

rowbearto

  • Senior Community Member
  • Posts: 1597
  • Hero Points: 116
Re: Copy path to clipboard
« Reply #2 on: June 03, 2013, 02:47:07 pm »
There is currently an option when we right click on a tab to "Copy Full Path to Clipboard".

I'd like to have a similar option added that is just "Copy file name to clipboard".

The reason that I like it is that when I write new C code and build it for the first time, I sometimes get errors that I forgot to #include some header file.

When this happens, I press "Ctrl+." on the symbol which brings me to the header file where it is declared.

Then to get the filename into the clipboard for using it inside a #include, the only option right now is to put the full path into the clipboard.

But for the #include, I need the filename only, and not the full path.

So it would be great if we could also just put the filename (without the full path) into the clipboard for this reason.

rowbearto

  • Senior Community Member
  • Posts: 1597
  • Hero Points: 116
Re: Copy path to clipboard
« Reply #3 on: June 17, 2013, 03:22:00 pm »
In the smart open dialog, both the top window (files+dirs) and bottom window (dir tree), it would be nice to add 2 options to the right click menu to copy to the clipboard:

1) file name only (or directory name)
2) Full path to the file or directory

Thanks!
Rob

MindprisM

  • Senior Community Member
  • Posts: 127
  • Hero Points: 8
Re: Copy path to clipboard
« Reply #4 on: September 28, 2013, 10:59:49 pm »
Ctrl-C while on line zero should do what? ;)

Graeme

  • Senior Community Member
  • Posts: 2422
  • Hero Points: 320
Re: Copy path to clipboard
« Reply #5 on: October 01, 2013, 11:05:38 am »
Ctrl-C while on line zero should do what? ;)
I give up.  What should it do and how do you get to line zero?

MindprisM

  • Senior Community Member
  • Posts: 127
  • Hero Points: 8
Re: Copy path to clipboard
« Reply #6 on: October 01, 2013, 03:17:37 pm »
There is something in the options, 'top of file line', that will give you a virtual line zero. I think a nice Easter egg would be to copy the file path on ctrl-c there. Put a message() for discoverability.

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Copy path to clipboard
« Reply #7 on: October 01, 2013, 05:02:31 pm »
There is something in the options, 'top of file line', that will give you a virtual line zero. I think a nice Easter egg would be to copy the file path on ctrl-c there. Put a message() for discoverability.
Just an observation:  Yikes, that seems destined to create weird problems in macros and recorded macros, and support calls and confusion.  It also seems like a really complicated and obscure way to get the filename into the clipboard.  How about just making a macro.

MindprisM

  • Senior Community Member
  • Posts: 127
  • Hero Points: 8
Re: Copy path to clipboard
« Reply #8 on: October 02, 2013, 08:45:58 am »
Its an idea about UI, not macros. The behavior can be disabled if there is a macro running. I don't see how this really creates more confusion than "Ctrl-C with no selection copies the line".
I am looking at v17 interface right now and there is no item I can see to copy the filename. Nor do I see a copy-filename macro that ships.
Surely that creates some frustration.
It could also be a smart-paste, pasting as the proper #include or <script format according to doc types.
Come on now, don't be such a poopy-pants. :)

mwb1100

  • Senior Community Member
  • Posts: 143
  • Hero Points: 13
Re: Copy path to clipboard
« Reply #9 on: October 02, 2013, 06:29:29 pm »
I am looking at v17 interface right now and there is no item I can see to copy the filename.

In v18 you can right click on the tab to get a menu with "Copy Full Path to Clipboard" and "Copy Name to Clipboard".  I don't know if they're there in v17.

They invoke the macros copy_buf_name() and copy_buf_name_only().

chrisant

  • Senior Community Member
  • Posts: 1410
  • Hero Points: 131
Re: Copy path to clipboard
« Reply #10 on: October 02, 2013, 07:47:42 pm »
Its an idea about UI, not macros. The behavior can be disabled if there is a macro running. I don't see how this really creates more confusion than "Ctrl-C with no selection copies the line".
I am looking at v17 interface right now and there is no item I can see to copy the filename. Nor do I see a copy-filename macro that ships.
Surely that creates some frustration.
It could also be a smart-paste, pasting as the proper #include or <script format according to doc types.
Come on now, don't be such a poopy-pants. :)
A couple ways off the top of my head in v17:
  • right click a file tab and choose "Copy Full Path to Clipboard"
  • hit Ctrl+C on a file in the Buffers tab of the Files pane
(I didn't know about the second one until just now -- I just looked at where filenames appear in the UI, and tried an intuitive action and sure enough it worked :)).

Copying the current line when there's no selection is highly discoverable -- the cursor is on the line, it follows naturally that hitting Copy will copy the line.

It's hard for me to imagine anyone would think "How can I copy the filename?  Oh, I bet if I turn on a phantom top line, move the cursor there, and hit Ctrl+C that would copy the filename...let's see...wow, yeah it sure did, excellent!" :)

Just to clarify -- I think it's a great brainstorming exercise, it just seems like some refinement could come up with an approach that's discoverable and therefore useful for a broader set of people.  (Btw, disabling the feature while recording a macro introduces an inconsistency, making it more complicated to explain/understand, and for example causing yet another case where playing back a recorded macro doesn't do the same thing as what was originally done).
« Last Edit: October 02, 2013, 07:53:59 pm by chrisant »

JimmieC

  • Senior Community Member
  • Posts: 432
  • Hero Points: 16
Re: Copy path to clipboard
« Reply #11 on: February 06, 2015, 08:37:20 pm »
Copy\get file name. See the Boxer text editor for a reference. This one catches me a lot. If you use Boxer, and switch you realize how handy this is. Basically a menu item\key stroke to get the file name. Boxer retrieves it with the full path information.

Phil Barila

  • Senior Community Member
  • Posts: 742
  • Hero Points: 61
Re: Copy path to clipboard
« Reply #12 on: February 06, 2015, 10:35:56 pm »
Copy\get file name. See the Boxer text editor for a reference. This one catches me a lot. If you use Boxer, and switch you realize how handy this is. Basically a menu item\key stroke to get the file name. Boxer retrieves it with the full path information.
Right-click on the file tab, and there is a menu option for both filename and full path.  Figure out what command(s) that/those is/are, and bind that/them to whatever accelerator(s) make you happy, happy, happy.

JimmieC

  • Senior Community Member
  • Posts: 432
  • Hero Points: 16
Re: Copy path to clipboard
« Reply #13 on: February 09, 2015, 12:03:18 am »
>> Right-click on the file tab, and there is a menu option for both filename and full path.  Figure out what command(s)
>> that/those is/are, and bind that/them to whatever accelerator(s) make you happy, happy, happy.

Thanks. I did not know about that. I only have Copy Full Path in version 2011, but that is good enough. Of course, the option for both is even better. You must have a newer version.

I probably won't bind it to any keyboard shortcuts as I don't use this feature enough (2 - 3 times\month) to commit the shortcut to memory. This is why my philosophy is that utilitarian functions should be exposed through the GUI by default. That way they can be found through by browsing the menus a little bit. Just providing a function call for the user to key-bind to is not satisfactory.

JimmieC

  • Senior Community Member
  • Posts: 432
  • Hero Points: 16
Re: Copy path to clipboard
« Reply #14 on: February 26, 2015, 09:35:09 pm »
Copy full path and file name of project by 1) right-clicking on project name in Projects tool window 2) menu entry.

I guess some would like a command line option too. I prefer 1 & 2.
« Last Edit: February 26, 2015, 09:41:50 pm by JimmieC »