Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy file name of currently opened file in sublime text 3?

How do you copy the file name of the currently opened file in sublime text 3 ? If this is not possible by default, perhaps you know some sublime extension which does that job using keyboard shortcut.

like image 796
DevWL Avatar asked Nov 01 '15 00:11

DevWL


2 Answers

You can do this if you have the SideBarEnhancements plugin installed.

  1. Open up the command palette with Ctrl+Shift+P (on Mac it is +Shift+P)

  2. Type File: Copy Name and press Enter

The file name has now been copied to your clipboard.


Setting a hotkey for this command:

  1. Go to your Key Bindings -> User file

  2. Add this line to your file: { "keys": ["ctrl+shift+l"], "command": "side_bar_copy_name" }

  3. Change "ctrl+shift+l" to whatever command you want to use.

like image 174
Saad Avatar answered Oct 15 '22 16:10

Saad


In Sublime Text 3 and 4, you can simply right-click within the file body itself and select Copy File Path.

Using the SideBarEnhancements plugin is also an option when you're browsing through files contained within folders that you have added to your project (that show on the lower part of the sidebar). There, just right-click on the file and select Copy Path or Copy Dir Path.

like image 20
MattDMo Avatar answered Oct 15 '22 15:10

MattDMo