jrri

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" },

分类:

技术点:

相关文章:

  • 2021-10-03
  • 2021-10-03
  • 2021-12-31
  • 2021-04-30
  • 2021-12-06
  • 2021-12-25
  • 2021-12-31
  • 2021-10-03
猜你喜欢
  • 2021-12-19
  • 2021-09-19
  • 2021-08-02
  • 2021-12-05
  • 2021-12-19
  • 2019-03-25
  • 2021-02-17
相关资源
相似解决方案