By josh / March 29, 2014

How to easily get the path of the file you’re editing in Sublime Text

I got an email recently from Jesse, a subscriber who says he “pretty much lives in Sublime.”

Still, he had a minor bone to pick:

Often I’ll need to do something in the command line with the file I’m currently in. There’s no convenient way (that I’m aware of) to copy the full path to the clipboard.

To cope with this, he adopted a workaround:

I always end up hovering on the tab and doing some short-term mental memorization and then switching to the command line and typing it in.

So painful! I can’t begin to count the number of times I’ve done similar things.

Fortunately, there IS a way to easily grab the full path of the file you’re editing.

Ready?

Just right-click in the editor panel and select Copy File Path.

Boom.

It took me a while to find it when I first switched to Sublime, because other editors tend to stash this feature in a right-click menu that hangs off of the current file’s tab.

If that’s what you’re used to, you can easily add Copy File Path to the tab right click menu.

Open a new tab and paste the following:

[
    { "command": "copy_path", "caption": "Copy File Path" }
]

Save this in a new file named Tab Context.sublime-menu in your Packages/User folder.

For more ways to streamline your Sublime Text workflow, check out:

http://sublimetexttips.com/newsletter

About the author

josh

Click here to add a comment

Leave a comment: