18
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

updated at

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

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)

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
18
Help us understand the problem. What are the problem?