修改dired插件
sublime text中有个仿emacs中的dired插件,可以方便的访问文件夹及文件。在打开文件时,都是在sublime text中,如果要开word文档,需要修改写插件,如下:
class DiredSelect(TextCommand, DiredBaseCommand):
def run(self, edit, new_view=False):
path = self.path
filenames = self.get_selected()
# If reuse view is turned on and the only item is a directory, refresh the existing view.
if not new_view and reuse_view():
if len(filenames) == 1 and isdir(join(path, filenames[0])):
fqn = join(path, filenames[0])
show(self.view.window(), fqn, view_id=self.view.id())
return
for filename in filenames:
fqn = join(path, filename)
if isdir(fqn):
show(self.view.window(), fqn, ignore_existing=new_view)
+ elif os.path.splitext(fqn)[1] in (".doc", ".docx"):
+ subprocess.Popen(['C:\Program Files\Microsoft Office\Office12\WINWORD.exe', fqn])
else:
self.view.window().open_file(fqn)