sublime text 3插件改造之添加从模版新增文件到指定目录
简介:以前使用ST2里面的Sublime NFFT插件比较顺手,最近安装了ST3,但是Sublime NFFT插件不支持ST3,就下载了SublimeTmpl从模版新建文件插件。在使用时,习惯在侧边栏右击目录-新建模版文件,然后保存在右击的目录下。但是SublimeTmpl插件不支持这功能,非常蛋疼。花了一点时间研究Sublime NFFT插件源码,对SublimeTmpl进行了改造,详情如下:
SublimeTmpl插件安装之后,首选项>浏览程序包>SublimeTmpl>sublime-tmpl.py,该文件修改如下(左侧是原来代码,右侧红色部分是修改之处):
修改之后完整代码:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# + Python 3 support
# + sublime text 3 support import sublime
import sublime_plugin
# import sys
import os
import glob
import datetime
import zipfile
import re PACKAGE_NAME = 'SublimeTmpl'
TMLP_DIR = 'templates'
KEY_SYNTAX = 'syntax'
KEY_FILE_EXT = 'extension' # st3: Installed Packages/xx.sublime-package
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
PACKAGES_PATH = sublime.packages_path() # for ST2 # sys.path += [BASE_PATH]
# sys.path.append(BASE_PATH)
# import sys;print(sys.path) IS_GTE_ST3 = int(sublime.version()[0]) >= 3
DISABLE_KEYMAP = None class SublimeTmplCommand(sublime_plugin.TextCommand): def run(self, edit, type='html', dirs=[]):
view = self.view
opts = self.get_settings(type)
tmpl = self.get_code(type) # print('global', DISABLE_KEYMAP, IS_GTE_ST3);
if DISABLE_KEYMAP:
return False # print(KEY_SYNTAX in opts)
self.tab = self.creat_tab(view) self.set_syntax(opts)
self.set_code(tmpl, type, dirs) def get_settings(self, type=None):
settings = sublime.load_settings(PACKAGE_NAME + '.sublime-settings') if not type:
return settings # print(settings.get('html')['syntax'])
opts = settings.get(type, [])
# print(opts)
return opts def open_file(self, path, mode='r'):
fp = open(path, mode)
code = fp.read()
fp.close()
return code def get_code(self, type):
code = ''
file_name = "%s.tmpl" % type
isIOError = False if IS_GTE_ST3:
tmpl_dir = 'Packages/' + PACKAGE_NAME + '/' + TMLP_DIR + '/'
user_tmpl_dir = 'Packages/User/' + \
PACKAGE_NAME + '/' + TMLP_DIR + '/'
# tmpl_dir = os.path.join('Packages', PACKAGE_NAME , TMLP_DIR)
else:
tmpl_dir = os.path.join(PACKAGES_PATH, PACKAGE_NAME, TMLP_DIR)
user_tmpl_dir = os.path.join(
PACKAGES_PATH, 'User', PACKAGE_NAME, TMLP_DIR) self.user_tmpl_path = os.path.join(user_tmpl_dir, file_name)
self.tmpl_path = os.path.join(tmpl_dir, file_name) if IS_GTE_ST3:
try:
code = sublime.load_resource(self.user_tmpl_path)
except IOError:
try:
code = sublime.load_resource(self.tmpl_path)
except IOError:
isIOError = True
else:
if os.path.isfile(self.user_tmpl_path):
code = self.open_file(self.user_tmpl_path)
elif os.path.isfile(self.tmpl_path):
code = self.open_file(self.tmpl_path)
else:
isIOError = True # print(self.tmpl_path)
if isIOError:
sublime.message_dialog('[Warning] No such file: ' + self.tmpl_path
+ ' or ' + self.user_tmpl_path) return self.format_tag(code) def format_tag(self, code):
code = code.replace('\r', '') # replace \r\n -> \n
# format
settings = self.get_settings()
format = settings.get('date_format', '%Y-%m-%d')
date = datetime.datetime.now().strftime(format)
if not IS_GTE_ST3:
code = code.decode('utf8') # for st2 && Chinese characters
code = code.replace('${date}', date) attr = settings.get('attr', {})
for key in attr:
code = code.replace('${%s}' % key, attr.get(key, ''))
return code def creat_tab(self, view):
win = view.window()
tab = win.new_file()
return tab def set_code(self, code, type, dirs):
tab = self.tab
tab.set_name('untitled.' + type)
# insert codes
tab.run_command('insert_snippet', {'contents': code})
if len(dirs) == 1:
tab.settings().set('default_dir', dirs[0]) def set_syntax(self, opts):
v = self.tab
# syntax = self.view.settings().get('syntax') # from current file
syntax = opts[KEY_SYNTAX] if KEY_SYNTAX in opts else ''
# print(syntax) # tab.set_syntax_file('Packages/Diff/Diff.tmLanguage')
v.set_syntax_file(syntax) # print(opts[KEY_FILE_EXT])
if KEY_FILE_EXT in opts:
v.settings().set('default_extension', opts[KEY_FILE_EXT]) class SublimeTmplEventListener(sublime_plugin.EventListener):
def on_query_context(self, view, key, operator, operand, match_all):
settings = sublime.load_settings(PACKAGE_NAME + '.sublime-settings')
disable_keymap_actions = settings.get('disable_keymap_actions', '')
# print ("key1: %s, %s" % (key, disable_keymap_actions))
global DISABLE_KEYMAP
DISABLE_KEYMAP = False;
if not key.startswith('sublime_tmpl.'):
return None
if not disable_keymap_actions: # no disabled actions
return True
elif disable_keymap_actions == 'all' or disable_keymap_actions == True: # disable all actions
DISABLE_KEYMAP = True;
return False
prefix, name = key.split('.')
ret = name not in re.split(r'\s*,\s*', disable_keymap_actions.strip())
# print(name, ret)
DISABLE_KEYMAP = True if not ret else False;
return ret def plugin_loaded(): # for ST3 >= 3016
# global PACKAGES_PATH
PACKAGES_PATH = sublime.packages_path()
TARGET_PATH = os.path.join(PACKAGES_PATH, PACKAGE_NAME)
# print(BASE_PATH, os.path.dirname(BASE_PATH))
# print(TARGET_PATH) # auto create custom_path
custom_path = os.path.join(PACKAGES_PATH, 'User', PACKAGE_NAME, TMLP_DIR)
# print(custom_path, os.path.isdir(custom_path))
if not os.path.isdir(custom_path):
os.makedirs(custom_path) # first run
if not os.path.isdir(TARGET_PATH):
os.makedirs(os.path.join(TARGET_PATH, TMLP_DIR))
# copy user files
tmpl_dir = TMLP_DIR + '/'
file_list = [
'Default.sublime-commands', 'Main.sublime-menu',
# if don't copy .py, ST3 throw: ImportError: No module named
'sublime-tmpl.py',
'README.md',
tmpl_dir + 'css.tmpl', tmpl_dir + 'html.tmpl',
tmpl_dir + 'js.tmpl', tmpl_dir + 'php.tmpl',
tmpl_dir + 'python.tmpl', tmpl_dir + 'ruby.tmpl',
tmpl_dir + 'xml.tmpl'
]
try:
extract_zip_resource(BASE_PATH, file_list, TARGET_PATH)
except Exception as e:
print(e) # old: *.user.tmpl compatible fix
files = glob.iglob(os.path.join(os.path.join(TARGET_PATH, TMLP_DIR), '*.user.tmpl'))
for file in files:
filename = os.path.basename(file).replace('.user.tmpl', '.tmpl')
# print(file, '=>', os.path.join(custom_path, filename));
os.rename(file, os.path.join(custom_path, filename)) # old: settings-custom_path compatible fix
settings = sublime.load_settings(PACKAGE_NAME + '.sublime-settings')
old_custom_path = settings.get('custom_path', '')
if old_custom_path and os.path.isdir(old_custom_path):
# print(old_custom_path)
files = glob.iglob(os.path.join(old_custom_path, '*.tmpl'))
for file in files:
filename = os.path.basename(file).replace('.user.tmpl', '.tmpl')
# print(file, '=>', os.path.join(custom_path, filename))
os.rename(file, os.path.join(custom_path, filename)) if not IS_GTE_ST3:
sublime.set_timeout(plugin_loaded, 0) def extract_zip_resource(path_to_zip, file_list, extract_dir=None):
if extract_dir is None:
return
# print(extract_dir)
if os.path.exists(path_to_zip):
z = zipfile.ZipFile(path_to_zip, 'r')
for f in z.namelist():
# if f.endswith('.tmpl'):
if f in file_list:
# print(f)
z.extract(f, extract_dir)
z.close()
增加侧边栏右键新增模版文件功能:
- 首选项>浏览程序包,在打开的目录新建跟插件名称一样的目录,这里是新建"SideBarEnhancements"。
- 选择当前目录上一级(Sublime Text 3)>Installed Packages找到"SideBarEnhancements.sublime-package",复制一份该文件到任意目录,修改文件后缀为.zip,用软件解压。
- 找到解压目录中以".sublime-menu"为结尾的文件,这里是"Side Bar.sublime-menu",复制一份到第一步新建的目录SideBarEnhancements中。
- 修改复制的"Side Bar.sublime-menu"文件,添加如下内容:
{
"caption": "New File (SublimeTmpl)",
"id": "side-bar-new-file-SublimeTmpl",
"children": [
{
"caption": "HTML",
"command": "sublime_tmpl",
"args": {
"type": "html",
"dirs": []
}
},
{
"caption": "Javascript",
"command": "sublime_tmpl",
"args": {
"type": "js",
"dirs": []
}
},
{
"caption": "CSS",
"command": "sublime_tmpl",
"args": {
"type": "css",
"dirs": []
}
},
{
"caption": "PHP",
"command": "sublime_tmpl",
"args": {
"type": "php",
"dirs": []
}
},
{
"caption": "python",
"command": "sublime_tmpl",
"args": {
"type": "py",
"dirs": []
}
},
{
"caption": "ruby",
"command": "sublime_tmpl",
"args": {
"type": "rb",
"dirs": []
}
},
{"caption": "-"},
{
"command": "open_file",
"args": {"file": "${packages}/SublimeTmpl/Main.sublime-menu"},
"caption": "Menu"
}
]
},
修改之后完成代码:
[
{
"caption": "aaaaa_side_bar",
"id": "aaaaa_side_bar",
"command": "aaaaa_side_bar",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-start-separator"
},
{
"caption": "New File…",
"id": "side-bar-new-file",
"command": "side_bar_new_file",
"args": {
"paths": []
}
},
{
"caption": "New Folder…",
"id": "side-bar-new-directory",
"command": "side_bar_new_directory",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-start-separator"
},
{
"caption": "New File (SublimeTmpl)",
"id": "side-bar-new-file-SublimeTmpl",
"children": [
{
"caption": "HTML",
"command": "sublime_tmpl",
"args": {
"type": "html",
"dirs": []
}
},
{
"caption": "Javascript",
"command": "sublime_tmpl",
"args": {
"type": "js",
"dirs": []
}
},
{
"caption": "CSS",
"command": "sublime_tmpl",
"args": {
"type": "css",
"dirs": []
}
},
{
"caption": "PHP",
"command": "sublime_tmpl",
"args": {
"type": "php",
"dirs": []
}
},
{
"caption": "python",
"command": "sublime_tmpl",
"args": {
"type": "py",
"dirs": []
}
},
{
"caption": "ruby",
"command": "sublime_tmpl",
"args": {
"type": "rb",
"dirs": []
}
},
{"caption": "-"},
{
"command": "open_file",
"args": {"file": "${packages}/SublimeTmpl/Main.sublime-menu"},
"caption": "Menu"
}
]
},
{
"caption": "-",
"id": "side-bar-new-separator"
}, {
"caption": "Edit",
"id": "side-bar-edit",
"command": "side_bar_edit",
"args": {
"paths": []
}
},
{
"caption": "Edit to Right",
"id": "side-bar-edit-to-right",
"command": "side_bar_edit_to_right",
"args": {
"paths": []
}
},
{
"caption": "Open / Run",
"id": "side-bar-open",
"command": "side_bar_open",
"args": {
"paths": []
}
},
{
"caption": "Open In Browser",
"id": "side-bar-open-in-browser",
"children": [
{
"caption": "Default",
"command": "side_bar_open_in_browser",
"args": {
"paths": []
}
},
{
"caption": "-"
},
{
"caption": "Firefox",
"command": "side_bar_open_in_browser",
"args": {
"paths": [],
"type": "testing",
"browser": "firefox"
}
},
{
"caption": "-"
},
{
"caption": "Chromium",
"command": "side_bar_open_in_browser",
"args": {
"paths": [],
"type": "testing",
"browser": "chromium"
}
},
{
"caption": "Chrome",
"command": "side_bar_open_in_browser",
"args": {
"paths": [],
"type": "testing",
"browser": "chrome"
}
},
{
"caption": "Canary",
"command": "side_bar_open_in_browser",
"args": {
"paths": [],
"type": "testing",
"browser": "canary"
}
},
{
"caption": "-"
},
{
"caption": "Opera",
"command": "side_bar_open_in_browser",
"args": {
"paths": [],
"type": "testing",
"browser": "opera"
}
},
{
"caption": "Safari",
"command": "side_bar_open_in_browser",
"args": {
"paths": [],
"type": "testing",
"browser": "safari"
}
},
{
"caption": "-"
},
{
"caption": "Internet Explorer",
"command": "side_bar_open_in_browser",
"args": {
"paths": [],
"type": "testing",
"browser": "ie"
}
},
{
"caption": "Edge",
"command": "side_bar_open_in_browser",
"args": {
"paths": [],
"type": "testing",
"browser": "edge"
}
},
{
"caption": "-"
},
{
"caption": "Open In All Browsers",
"command": "side_bar_open_browsers"
}
]
},
{
"caption": "Open In New Window",
"id": "side-bar-open-in-new-window",
"command": "side_bar_open_in_new_window",
"args": {
"paths": []
}
},
{
"caption": "Open With Finder",
"id": "side-bar-open-with-finde",
"command": "side_bar_open_with_finder",
"args": {
"paths": []
}
},
{
"caption": "Open With",
"id": "side-bar-files-open-with", "children": [ {
"caption": "-",
"id": "side-bar-files-open-with-edit-application-separator"
},
{
"caption": "Edit Applications…",
"id": "side-bar-files-open-with-edit-applications",
"command": "side_bar_files_open_with_edit_applications",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-files-open-with-edit-applications-separator"
} ]
},
{
"caption": "Reveal",
"id": "side-bar-reveal",
"command": "side_bar_reveal",
"args": {
"paths": []
}
}, {
"caption": "-",
"id": "side-bar-edit-open-separator"
}, {
"caption": "Find & Replace…",
"id": "side-bar-find-selected",
"command": "side_bar_find_in_selected",
"args": {
"paths": []
}
},
{
"caption": "Find Files Named…",
"id": "side-bar-find-files",
"command": "side_bar_find_files_path_containing",
"args": {
"paths": []
}
},
{
"caption": "Find Advanced",
"id": "side-bar-find-advanced",
"children": [
{
"caption": "In Parent Folder…",
"id": "side-bar-find-parent",
"command": "side_bar_find_in_parent",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-find-parent-separator"
},
{
"caption": "In Project…",
"id": "side-bar-find-in-project",
"command": "side_bar_find_in_project",
"args": {
"paths": []
}
},
{
"caption": "In Project Folder…",
"id": "side-bar-find-project-folder",
"command": "side_bar_find_in_project_folder",
"args": {
"paths": []
}
},
{
"caption": "In Project Folders…",
"id": "side-bar-find-project-folders",
"command": "side_bar_find_in_project_folders"
},
{
"caption": "-",
"id": "side-bar-find-project-separator"
},
{
"id": "side-bar-find-in-files-with-extension",
"command": "side_bar_find_in_files_with_extension",
"args": {
"paths": []
}
},
{
"caption": "In Paths Containing…",
"id": "side-bar-find-files-path-containing",
"command": "side_bar_find_files_path_containing",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-mass-rename-separator"
},
{
"caption": "Mass Rename Selection…",
"id": "side-bar-mass-rename",
"command": "side_bar_mass_rename",
"args": {
"paths": []
}
} ]
},
{
"caption": "-",
"id": "side-bar-find-separator"
},
{
"caption": "Cut",
"id": "side-bar-clip-cut",
"command": "side_bar_cut",
"args": {
"paths": []
}
},
{
"caption": "Copy",
"id": "side-bar-clip-copy",
"command": "side_bar_copy",
"args": {
"paths": []
}
},
{
"caption": "Copy Name",
"id": "side-bar-clip-copy-name",
"command": "side_bar_copy_name",
"args": {
"paths": []
}
},
{
"caption": "Copy Path",
"id": "side-bar-clip-copy-path",
"command": "side_bar_copy_path_absolute_from_project_encoded",
"args": {
"paths": []
}
},
{
"caption": "Copy Path (Windows)",
"id": "side-bar-clip-copy-path-windows",
"command": "side_bar_copy_path_absolute_from_project_encoded_windows",
"args": {
"paths": []
}
},
{
"caption": "Copy Dir Path",
"id": "side-bar-clip-copy-dir-path",
"command": "side_bar_copy_dir_path",
"args": {
"paths": []
}
},
{
"caption": "Copy as Text",
"id": "side-bar-clip-copy-as",
"children": [
{
"caption": "Relative Path From View Encoded",
"id": "side-bar-clip-copy-path-relative-from-view-encoded",
"command": "side_bar_copy_path_relative_from_view_encoded",
"args": {
"paths": []
}
},
{
"caption": "Relative Path From View",
"id": "side-bar-clip-copy-path-relative-from-view",
"command": "side_bar_copy_path_relative_from_view",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-clip-copy-path-relative-from-view-separator"
}, {
"caption": "Relative Path From Project Encoded",
"id": "side-bar-clip-copy-path-relative-from-project-encoded",
"command": "side_bar_copy_path_relative_from_project_encoded",
"args": {
"paths": []
}
},
{
"caption": "Relative Path From Project",
"id": "side-bar-clip-copy-path-relative-from-project",
"command": "side_bar_copy_path_relative_from_project",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-clip-copy-path-relative-from-project-separator"
}, {
"caption": "Absolute Path From Project Encoded",
"id": "side-bar-clip-copy-path-absolute-from-project-encoded",
"command": "side_bar_copy_path_absolute_from_project_encoded",
"args": {
"paths": []
}
},
{
"caption": "Absolute Path From Project",
"id": "side-bar-clip-copy-path-absolute-from-project",
"command": "side_bar_copy_path_absolute_from_project",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-clip-copy-path-absolute-from-project-separator"
}, {
"caption": "Path as URI",
"id": "side-bar-clip-copy-path-encoded",
"command": "side_bar_copy_path_encoded",
"args": {
"paths": []
}
},
{
"caption": "Path",
"id": "side-bar-clip-copy-path",
"command": "side_bar_copy_path",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-clip-copy-path-separator"
}, {
"caption": "Name Encoded",
"id": "side-bar-clip-copy-name-encoded",
"command": "side_bar_copy_name_encoded",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-clip-copy-name-encoded-separator"
}, {
"caption": "URL",
"id": "side-bar-clip-copy-url",
"command": "side_bar_copy_url",
"args": {
"paths": []
}
},
{
"caption": "URL Decoded",
"id": "side-bar-clip-copy-url-decoded",
"command": "side_bar_copy_url_decoded",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-clip-copy-url-separator"
}, {
"caption": "Tag a",
"id": "side-bar-clip-copy-tag-a",
"command": "side_bar_copy_tag_ahref",
"args": {
"paths": []
}
},
{
"caption": "Tag img",
"id": "side-bar-clip-copy-tag-img",
"command": "side_bar_copy_tag_img",
"args": {
"paths": []
}
},
{
"caption": "Tag script",
"id": "side-bar-clip-copy-tag-script",
"command": "side_bar_copy_tag_script",
"args": {
"paths": []
}
},
{
"caption": "Tag style",
"id": "side-bar-clip-copy-tag-style",
"command": "side_bar_copy_tag_style",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-clip-copy-tag-separator"
},
{
"caption": "Project Folders",
"id": "side-bar-clip-copy-project-directories",
"command": "side_bar_copy_project_directories",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-clip-copy-project-directories-separator"
},
{
"caption": "Content as UTF-8",
"id": "side-bar-clip-copy-content-utf8",
"command": "side_bar_copy_content_utf8",
"args": {
"paths": []
}
},
{
"caption": "Content as Data URI",
"id": "side-bar-clip-copy-content-base-64",
"command": "side_bar_copy_content_base64",
"args": {
"paths": []
}
}
]
}, {
"caption": "Paste",
"id": "side-bar-clip-paste",
"command": "side_bar_paste",
"args": {
"paths": [],
"in_parent": "False"
}
},
{
"caption": "Paste in Parent",
"id": "side-bar-clip-paste-in-parent",
"command": "side_bar_paste",
"args": {
"paths": [],
"in_parent": "True"
}
},
{
"caption": "-",
"id": "side-bar-clip-separator"
},
{
"caption": "Duplicate…",
"id": "side-bar-duplicate",
"command": "side_bar_duplicate",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-duplicate-separator"
}, {
"caption": "Rename…",
"id": "side-bar-rename",
"command": "side_bar_rename",
"args": {
"paths": []
}
},
{
"caption": "Move…",
"id": "side-bar-move",
"command": "side_bar_move",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-rename-move-separator"
}, {
"caption": "Delete",
"id": "side-bar-delete",
"command": "side_bar_delete",
"args": {
"paths": []
}
},
{
"caption": "Empty",
"id": "side-bar-empty",
"command": "side_bar_empty",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-delete-separator"
}, {
"caption": "Refresh",
"id": "side-bar-refresh",
"command": "refresh_folder_list"
},
{
"caption": "-",
"id": "side-bar-refresh-separator"
},
{
"caption": "Project",
"id": "side-bar-project",
"children": [
{
"caption": "Edit Project",
"id": "side-bar-project-open-file",
"command": "side_bar_project_open_file",
"args": {
"paths": []
}
},
{
"caption": "Edit Preview URLs",
"id": "side-bar-preview-edit-urls",
"command": "side_bar_preview_edit_urls",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-project-open-file-separator"
},
{
"command": "prompt_add_folder",
"caption": "Add Folder to Project…",
"mnemonic": "d"
},
{
"caption": "-",
"id": "side-bar-promote-as-project-folder-separator"
},
{
"caption": "Promote as Project Folder",
"id": "side-bar-project-item-add",
"command": "side_bar_project_item_add",
"args": {
"paths": []
}
},
{
"caption": "Hide From Sidebar (In theory exclude from project)",
"id": "side-bar-project-item-exclude",
"command": "side_bar_project_item_exclude",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-project-item-separator"
},
{
"id": "side-bar-project-item-exclude-from-index-item",
"command": "side_bar_project_item_exclude_from_index",
"args": {
"paths": [],
"type": "item"
}
},
{
"id": "side-bar-project-item-exclude-from-index-relative",
"command": "side_bar_project_item_exclude_from_index",
"args": {
"paths": [],
"type": "relative"
}
},
{
"id": "side-bar-project-item-exclude-from-index-directory",
"command": "side_bar_project_item_exclude_from_index",
"args": {
"paths": [],
"type": "directory"
}
},
{
"id": "side-bar-project-item-exclude-from-index-file",
"command": "side_bar_project_item_exclude_from_index",
"args": {
"paths": [],
"type": "file"
}
},
{
"id": "side-bar-project-item-exclude-from-index-extension",
"command": "side_bar_project_item_exclude_from_index",
"args": {
"paths": [],
"type": "extension"
}
},
{
"caption": "-",
"id": "side-bar-project-item-separator"
},
{
"caption": "Remove Folder from Project",
"id": "side-bar-project-item-remove-folder",
"command": "side_bar_project_item_remove_folder",
"args": {
"paths": []
}
} ]
},
{
"caption": "-",
"id": "side-bar-donate-separator"
},
{
"caption": "Donate",
"command": "side_bar_donate",
"args": {
"paths": []
}
},
{
"caption": "-",
"id": "side-bar-end-separator"
},
{
"caption": "zzzzz_side_bar",
"id": "zzzzz_side_bar",
"command": "zzzzz_side_bar",
"args": {
"paths": []
}
},
]
总结: 本人python语言完全不懂,根据Sublime NFFT插件修改,不妥之处欢迎拍砖。
sublime text 3插件改造之添加从模版新增文件到指定目录的更多相关文章
- sublime text 3插件改造之AutoFileName去掉.vue文件中img标签后面的width和height,完全去掉!!
在.vue文件中img标签使用autofilename提示引入文件时,会在文件后面插入宽度高度,如下图: 文件后面会自动插入height和width,其实这两玩意儿在大多数时候并没卵用,然后就开始了百 ...
- Sublime Text通过插件编译Sass为CSS及中文编译异常解决
虽然PostCSS才是未来,但是Sass成熟稳定,拥有一大波忠实的使用者,及开源项目,且最近Bootstrap 4 alpha也从Less转到Sass了.所以了解Sass还是非常有必要的. 基于快速开 ...
- 推荐!Sublime Text 最佳插件列表
本文由 伯乐在线 - 艾凌风 翻译,黄利民 校稿.英文出处:ipestov.com.欢迎加入翻译组. 本文收录了作者辛苦收集的Sublime Text最佳插件,很全. 最佳的Sublime Text ...
- Sublime Text各种插件使用方法
有快捷键冲突的时候可以修改快捷键,建议修改插件快捷键而不是Sublime Text的快捷键,我的有冲突的一律将插件快捷键设置成:Ctrl+Alt+A(B...) Package Control 通俗易 ...
- 转: sublime text常用插件和快捷键
Sublime Text 2是一个轻量.简洁.高效.跨平台的编辑器.博主之前一直用notepdd++写前端代码,用得也挺顺手了,早就听说sublime的大名,一直也懒得去试试看,认为都是工具用着顺手就 ...
- Sublime Text 最佳插件列表
http://blog.jobbole.com/79326/ 推荐!Sublime Text 最佳插件列表 2014/07/25 · 工具与资源 · 26.1K 阅读 · 2 评论 · Sublime ...
- 开发者最常用的 8 款 Sublime Text 3 插件
转载于:http://www.itxuexiwang.com/a/liunxjishu/2016/0228/177.html?1456925631Sublime Text作为一个尽为人知的代码编辑器, ...
- 安装Sublime Text 3插件的方法
直接安装 安装Sublime text 3插件很方便,可以直接下载安装包解压缩到Packages目录(菜单->preferences->packages). 使用Package Contr ...
- 8款实用Sublime text 3插件推荐
Sublime Text作为一个尽为人知的代码编辑器,其优点不用赘述.界面整洁美观.文本功能强大,且运行速度极快,非常适合编写代码,写文章做笔记.Sublime Text还支持Mac.Windows和 ...
随机推荐
- Hadoop2.x 集群搭建
Hadoop2.x 集群搭建 一些重复的细节参考Hadoop1.X集群完全分布式模式环境部署 1 HADOOP 集群搭建 1.1 集群简介 HADOOP 集群具体来说包含两个集群:HDFS 集群和YA ...
- How to do SSH Tunneling (Port Forwarding)
How to do SSH Tunneling (Port Forwarding) In this post we will see how ssh works?, what is SSH tunne ...
- 2019 前程无忧java面试笔试题 (含面试题解析)
本人3年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.前程无忧等公司offer,岗位是Java后端开发,最终选择去了前程无忧. 面试了很多家公司,感觉大部分公司考察的点 ...
- 小知识:讲述Linux命令别名与资源文件的区别
别名 别名是命令的快捷方式.为那些需要经常执行,但需要很长时间输入的长命令创建快捷方式很有用.语法是: alias ppp='ping www.baidu.com' 它们并不总是用来缩短长命令.重要的 ...
- html5的基本介绍
前言 (1)什么是HTML? 指超文本标记语言(Hyper Text Markup Language); 是用来描述网页的一种语言: 不是编程语言,是一种标记语言: (更多详细内容,百度:https: ...
- react新旧生命周期
React16.3.0之前生命周期 16.3开始建议使用新的生命周期
- honeyd路由拓扑
create router //创建路由器模版 set router personality "Cisco 7206 running IOS 11.1(24)" //指纹 add ...
- 大数据集群环境 zookeeper集群环境安装
大数据集群环境 zookeeper集群环境准备 zookeeper集群安装脚本,如果安装需要保持zookeeper保持相同目录,并且有可执行权限,需要准备如下 编写脚本: vi zkInstall.s ...
- linux中的【;】【&&】【&】【|】【||】说明与用法
原文 “;”分号用法 方式:command1 ; command2 用;号隔开每个命令, 每个命令按照从左到右的顺序,顺序执行, 彼此之间不关心是否失败, 所有命令都会执行. “| ”管道符用法 上一 ...
- 树莓派配置wifi网络+更换镜像源
刚安装完系统后,采用的是树莓派通过网线连接笔记本wifi共享方式联网,后面考虑不使用网线,让树莓派使用wifi联网. 一.配置无线网络 1.通过ssh登录树莓派,输入用户名和密码后,输入如下命令进入图 ...