Home Download Buy Blog Forum Support

File Name and Full Path to Clipboard

File Name and Full Path to Clipboard

Postby dasspunk on Tue Mar 06, 2012 10:51 pm

I'm often in need of either the full path+filename or just the filename for copy/pasting. I see that full path is available via right click in the document body. I'd love to see both of these options added to the file name in the Side Bar, file name in the tabs AND in the body (or at least one of the three).

Brilliant app btw...
dasspunk
 
Posts: 11
Joined: Fri Mar 02, 2012 4:38 pm

Re: File Name and Full Path to Clipboard

Postby jbjornson on Wed Mar 07, 2012 8:05 am

It is available when you right click inside the view as "Copy File Path"
jbjornson
 
Posts: 335
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland

Re: File Name and Full Path to Clipboard

Postby dasspunk on Sat Mar 17, 2012 3:41 pm

As I said, full path is available; I want full path AND just the filename as I use both often. It would be nice if they were both available via right click anywhere the name of the file is. Eg. in the sidebar and on the tab when the file is open.

Thanks.
Brian
dasspunk
 
Posts: 11
Joined: Fri Mar 02, 2012 4:38 pm

Re: File Name and Full Path to Clipboard

Postby C0D312 on Sat Mar 17, 2012 4:11 pm

Why not make it yourself? Sounds simple enough. Just create a small plugin the copies the filename to the clipboard and add it to the context menu.

- set_clipboard(string)
- file_name() #returns full path, just parse to get the filename
- Create a file named: Context.sublime-menu to add an option the the context menu

http://www.sublimetext.com/docs/2/api_reference.html
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: File Name and Full Path to Clipboard

Postby Jim on Sat Mar 17, 2012 5:00 pm

C0D312 wrote:- Create a file named: Context.sublime-menu to add an option the the context menu


COOL, what i am locking for, thanks.

http://www.sublimetext.com/docs/menus
Jim (on Windows XP and Win7)
Jim
 
Posts: 16
Joined: Sun Feb 26, 2012 5:21 pm

Re: File Name and Full Path to Clipboard

Postby tito on Sat Mar 17, 2012 8:26 pm

SideBarEnhancements package already add the menus to the sidebar. And now these are available via: Tools -> Commands Palette or via the shortcut which is faster.
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 706
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: File Name and Full Path to Clipboard

Postby tito on Sat Mar 17, 2012 8:47 pm

If you still want these in some menu, with that package installed, you can copy the file

"../Packages/SideBarEnhancements/Commands.sublime-commands"

to

"../Packages/User/Context.sublime-menu"
"../Packages/User/Tab Context.sublime-menu"

and customize the entries ( deleting these you don't use).
( notice these files ends with "sublime-menu" instead of "sublime-commands"
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 706
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: File Name and Full Path to Clipboard

Postby dasspunk on Wed Mar 28, 2012 4:44 pm

Thanks Tito... that did the trick.

Solution:
First install SideBarEnhancements

Then copy:
"../Packages/SideBarEnhancements/Commands.sublime-commands"
to
"../Packages/User/Context.sublime-menu"
"../Packages/User/Tab Context.sublime-menu"
dasspunk
 
Posts: 11
Joined: Fri Mar 02, 2012 4:38 pm

Re: File Name and Full Path to Clipboard

Postby robertcollier4 on Wed Feb 27, 2013 10:23 am

Just made a plugin command for this in case it helps anyone else.

Code: Select all
{ "keys": ["ctrl+alt+c"], "command": "filename_to_clipboard" },
{ "keys": ["ctrl+alt+shift+c"], "command": "path_to_clipboard" },


Code: Select all
import sublime, sublime_plugin, os

class FilenameToClipboardCommand(sublime_plugin.TextCommand):
   def run(self, edit):
      sublime.set_clipboard(os.path.basename(self.view.file_name()))

class PathToClipboardCommand(sublime_plugin.TextCommand):
   def run(self, edit):
      sublime.set_clipboard(self.view.file_name())
robertcollier4
 
Posts: 153
Joined: Sun Feb 24, 2013 5:37 pm

Re: File Name and Full Path to Clipboard

Postby IGRACH on Wed Nov 20, 2013 9:03 am

robertcollier4 wrote:Just made a plugin command for this in case it helps anyone else.

Code: Select all
{ "keys": ["ctrl+alt+c"], "command": "filename_to_clipboard" },
{ "keys": ["ctrl+alt+shift+c"], "command": "path_to_clipboard" },


Code: Select all
import sublime, sublime_plugin, os

class FilenameToClipboardCommand(sublime_plugin.TextCommand):
   def run(self, edit):
      sublime.set_clipboard(os.path.basename(self.view.file_name()))

class PathToClipboardCommand(sublime_plugin.TextCommand):
   def run(self, edit):
      sublime.set_clipboard(self.view.file_name())


just found this http://superuser.com/questions/636057/how-to-set-shortcut-for-copy-file-path-in-sublime-text-3/636175#636175, the code for copy file path is "copy_path"
IGRACH
 
Posts: 18
Joined: Tue Oct 02, 2012 1:05 am


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests