Last active
August 29, 2015 13:57
-
-
Save ptim/9505770 to your computer and use it in GitHub Desktop.
ST3: Paste the current file's Relative Path From Project (Encoded). Requires https://github.com/titoBouzout/SideBarEnhancements be installed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
''' | |
Paste the current file's Relative Path From Project (Encoded). | |
Requires https://github.com/titoBouzout/SideBarEnhancements to be installed | |
First save this file as: | |
~/Library/Application Support/Sublime Text 3/Packages/User/paste-path.py | |
More details about writing plugins: http://docs.sublimetext.info/en/latest/reference/plugins.html | |
To trigger the command with 'Command Option Shift p', | |
add the following to your Sublime Text > Preferences > Keybindings - User | |
[ | |
{ "keys": ["super+option+shift+p"], "command": "paste_path"} | |
] | |
''' | |
class PastePathCommand(sublime_plugin.WindowCommand): | |
def run(self): | |
self.window.run_command("side_bar_copy_path_relative_from_project_encoded", {"paths": []}) | |
self.window.run_command("paste") |
And I do have SidebarEnhancements
intalled. (just to clarify)
Sorry, I left out some salient details!
You need to save this file as something like:
~/Library/Application Support/Sublime Text 3/Packages/User/paste-path.py
More information: http://docs.sublimetext.info/en/latest/reference/plugins.html
I've update the answer at http://stackoverflow.com/questions/22349600/st3-how-to-use-a-plugins-commands-in-a-macro/22351353#22351353
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I really want this but when I copy the command you provided into my Keybindings - User file, it doesn't work. What is up with the code
import sublime, sublime plugin
before and theclass
getting called at the end?