[PYTHON] I tried to make it on / off by setting "Create a plug-in that highlights double-byte space with Sublime Text 2".

This plugin itself can be switched on and off with the following settings. Because there was something that was highlighted each time when editing the text.

Create a plugin to highlight double-byte spaces in Sublime Text 2 http://qiita.com/items/865e1a6605b1146d4341

Well, it's not that difficult, just add if or something to the highlight_fullpitch_spaces method of the FullPitchWhiteSpaceHighlightListener class and do the following:

FullPitchWhiteSpaceHighlight.py


class FullPitchWhiteSpaceHighlightListener(sublime_plugin.EventListener):
    # highlight full-pitch white spaces
    def highlight_fullpitch_spaces(self, view):
        if view.settings().get('fullwhitespace_viewable') == True:
            view.add_regions('FullPitchWhiteSpaceHighlight',
                             view.find_all(u' +'),
                             "entity.name.class",
                             sublime.DRAW_OUTLINED)
        else:
            view.erase_regions('FullPitchWhiteSpaceHighlight')

It feels like fetching fullwhitespace_viewable settings with view.settings (). Get ('fullwhitespace_viewable', True). If not, the value of the second argument of get will be returned. You can switch on and off by writing the following in the configuration file.

hoge.sublime-settings


{
	…
	"fullwhitespace_viewable" : True,
	//"fullwhitespace_viewable" : Flase,
	…
}

something like that.

Recommended Posts

I tried to make it on / off by setting "Create a plug-in that highlights double-byte space with Sublime Text 2".
I tried to create a server environment that runs on Windows 10
I tried to create a plug-in with HULFT IoT Edge Streaming [Development] (2/3)
I tried to make a calculator with Tkinter so I will write it
I tried to create a plug-in with HULFT IoT Edge Streaming [Execution] (3/3)
I tried to create a plug-in with HULFT IoT Edge Streaming [Setup] (1/3)
Create a plugin that allows you to search Sublime Text 3 tabs in Python
When I tried to make a VPC with AWS CDK but couldn't make it
When I tried to create a virtual environment with Python, it didn't work
I tried to make a translation BOT that works on Discord using googletrans
I tried to create a table only with Django
I tried to make it easy to change the setting of authenticated Proxy on Jupyter
When I tried to create a project using Python on Docker with PyCharm, it didn't work, but it worked with Docker Compose.
I tried to automatically create a report with Markov chain
I tried to make a simple text editor using PyQt
[1 hour challenge] I tried to make a fortune-telling site that is too suitable with Python
I tried to make a generator that generates a C # container class from CSV with Python
I tried to make Othello AI that I learned 7.2 million hands by deep learning with Chainer
It's getting cold, so I tried to make it possible to turn on / off the AC heater automatically with Raspberry Pi!
[5th] I tried to make a certain authenticator-like tool with python
I tried to make a site that makes it easy to see the update information of Azure
I tried to create a simple credit score by logistic regression.
I tried to make a system that fetches only deleted tweets
[2nd] I tried to make a certain authenticator-like tool with python
A memorandum when I tried to get it automatically with selenium
[3rd] I tried to make a certain authenticator-like tool with python
[Python] A memo that I tried to get started with asyncio
I tried to create a list of prime numbers with python
I tried to make a periodical process with Selenium and Python
I tried to make a 2channel post notification application with Python
I tried to create Bulls and Cows with a shell program
I tried to make a todo application using bottle with python
[4th] I tried to make a certain authenticator-like tool with python
[Python] I tried to make a simple program that works on the command line using argparse.
[1st] I tried to make a certain authenticator-like tool with python
I tried to make a strange quote for Jojo with LSTM
I tried to make a mechanism of exclusive control with Go
Python: I tried to make a flat / flat_map just right with a generator
I tried to communicate with a remote server by Socket communication with Python.
I tried to implement a blockchain that actually works with about 170 lines
I tried to create a program to convert hexadecimal numbers to decimal numbers with python
I tried to make "Sakurai-san" a LINE BOT with API Gateway + Lambda
I tried to draw a system configuration diagram with Diagrams on Docker
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
[Outlook] I tried to automatically create a daily report email with Python
I tried to make a skill that Alexa will return as cold
[Zaif] I tried to make it easy to trade virtual currencies with Python
I tried to make a url shortening service serverless with AWS CDK
I tried to create a linebot (implementation)
I tried to create a linebot (preparation)
I tried to make a Web API
I refactored "I tried to make a script that saves posted images at once by going back to the tweets of a specific user on Twitter".
I wanted to quickly create a mail server that can be used freely with postfix + dovecot on EC2
I tried to make a periodical process with CentOS7, Selenium, Python and Chrome
I tried to make a simple mail sending application with tkinter of Python
I tried to create a class that can easily serialize Json in Python
[Patent analysis] I tried to make a patent map with Python without spending money
I tried to make a castle search API with Elasticsearch + Sudachi + Go + echo
When I tried to connect with SSH, I got a warning about free space.
I tried to easily create a fully automatic attendance system with Selenium + Python
[Python] I tried to make a Shiritori AI that enhances vocabulary through battles