Created
September 25, 2012 02:23
-
-
Save dongyuwei/3779601 to your computer and use it in GitHub Desktop.
sublime text2 plugin, touch file if file does't exist before `save` file.
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_plugin | |
import os | |
class TouchFile(sublime_plugin.EventListener): | |
def on_pre_save(self, view): | |
view.run_command("touch_file") | |
class TouchFileCommand(sublime_plugin.TextCommand): | |
def run(self, text): | |
fn = self.view.file_name().encode("utf_8") | |
if not os.path.exists(fn): | |
os.system('sudo touch ' + fn) |
where this file must be copied?
~/Library/Application Support/Sublime Text 2/Packages/User/touch_file.py
@marcoautiero
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
plugin file:
~/Library/Application Support/Sublime Text 2/Packages/User/touch_file.py
fix sublime
Unable to save ....
error