LoginSignup
18
18

More than 5 years have passed since last update.

Sublime Text 2で全角スペースをハイライト表示するプラグインを作る

Last updated at Posted at 2012-08-16

pythonわかんないしpluginも作ったことないしtextmateの拡張かなんかが使えるらしいとかあったのけど、
とりあえずやってみた

参考サイト:
http://dev.ariel-networks.com/wp/archives/2419
https://gist.github.com/3338888

FullPitchWhiteSpaceHighlight.py
#!/usr/bin/python
# -*- coding: utf8 -*-
import sublime
import sublime_plugin

class FullPitchWhiteSpaceHighlightListener(sublime_plugin.EventListener):
    # highlight full-pitch white spaces
    def highlight_fullpitch_spaces(self, view):
        view.add_regions('FullPitchWhiteSpaceHighlight',
                         view.find_all(u' +'),
                         "invalid",
                         sublime.DRAW_EMPTY_AS_OVERWRITE)
    # Called after changes have been made to a view.
    # @override
    def on_modified(self, view):
        self.highlight_fullpitch_spaces(view)

    # Called when a view gains input focus.
    # @override
    def on_activated(self, view):
        self.highlight_fullpitch_spaces(view)

    # Called when the file is finished loading.
    # @override
    def on_load(self, view):
        self.highlight_fullpitch_spaces(view)

コメントの中でもチェックしちゃうけど、まぁ、習作ということでご勘弁下さい(;´Д`)

18
18
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
18