Sublime Forum

Easy Copy File Path - Either Staged or Not Staged


I can’t seem to find a way to copy the file path prior to committing. I’ve tried highlighting, left click, right click, and a few other ways, but found no way to copy the file path. Is there a way to copy the file path prior to commit?

Use case for this is to collect commits as I’m making them for a change log or something similar to that such as communication of changes in release notes.

Workaround at the moment is to copy file path after commit has been made which requires a small amount of digging through commits and mapping the file path back to the commit message already in-hand.



You can create a file by the name of Diff Context.sublime-menu in your User folder (Preferences -> Browse Packages ... to get to the User folder) and then paste the following in

        "caption": "Copy File Path",
        "command": "copy_to_clipboard",
        "args": { "text": "$path" }

This should add the context menu item Copy File Path to the diff context menu, which is the same as Copy File Path you get in the ... context menu after commiting the changes.



I’m not a power user of Sublime Merge so this is interesting to see that this is available as a preference. Works for me as the solution inline with my goal.