Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
18
Help us understand the problem. What is going on with this article?
@kuronekomichael

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

More than 5 years have passed since last update.

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
Help us understand the problem. What is going on with this article?
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

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
18
Help us understand the problem. What is going on with this article?