Sublime快速删除注释内容

Sublime删除注释内容

利用Sublime自带的语法高亮, 对注释进行识别, 进而删除

Preferences ==> Browse Packages
创建文件:
User/remove_comments.py

import sublime_plugin

# 自动删除注释命令
class RemoveCommentsCommand(sublime_plugin.TextCommand):
	def run(self, edit):
		comments = self.view.find_by_selector('comment')
		for region in reversed(comments):
			self.view.erase(edit, region)

Ctrl+` 呼出控制台, 输入命令:

view.run_command('remove_comments')

绑定快捷键

Preferences ==> Key Bindings
添加:

{ "keys": ["ctrl+alt+shift+d"], "command": "remove_comments" },
原文地址:https://www.cnblogs.com/jrri/p/14600945.html