SublimeText / TrailingSpaces

Highlight trailing spaces and delete them in a flash.
MIT License
897 stars 94 forks source link

Can't turn highlighting off. Plus I hate pink. = Rather annoying. #24

Closed ar1403 closed 11 years ago

ar1403 commented 11 years ago

No matter what I do, I just can't "toggle" trailing space highlighting off. So now every document I work on is peppered with bright pink - even in places where I'm happy to let sleeping whitespace lie..

A few things I've tried:

This is where it gets good:

So a little perplexed as you can imagine. Not to mention a little pissed.

Anything I can do to remove this god-forsaken pink from my sights? Or am I doomed forever to have every Sublime document I ever work on lightly sprinkled with bright pink splodges?

FichteFoll commented 11 years ago

I just dropped into the code to see how it's doing things, but try running view.erase_regions('TrailingSpacesHighlightListener') in the console. That said, have you checked the console to see if there were errors while running this plugin?

If you want to change the color, add a new entry to your Color Scheme (with background) and change the trailing_spaces_highlight_color setting to that new entry's scope of yours.

ar1403 commented 11 years ago

Cheers. Though unfortunately calling .erase_regions(..) didn't work. I can live with the colour if I can just get the dam thing to turn off! Any other ideas? Thanks.


From: FichteFoll notifications@github.com To: SublimeText/TrailingSpaces TrailingSpaces@noreply.github.com Cc: ar1403 andyrowland14@yahoo.co.uk Sent: Tuesday, 4 December 2012, 13:41 Subject: Re: [TrailingSpaces] Can't turn highlighting off. Plus I hate pink. = Rather annoying. (#24)

I just dropped into the code to see how it's doing things, but try running view.erase_regions('TrailingSpacesHighlightListener') in the console. If you want to change the color, add a new entry to your Color Scheme (with background) and change the trailing_spaces_highlight_color setting. — Reply to this email directly or view it on GitHub.

kevinastone commented 11 years ago

+1, just wanted a command to remove trailing whitespaces (on-demand) without the highlighting.

"trailing_spaces_enabled": false didn't seem to work.

ticky commented 11 years ago

@ar1403 Sounds like this might be something to do with your syntax/colour scheme rather than TrailingSpaces if it persists with the plugin disabled and after a restart of Sublime. Attaching an image of your problem might help diagnose it.

kevinastone commented 11 years ago

In my case, the highlighting vanished after I removed the plugin (unlike the user above). I just want a way to use this plugin without highlighting...

ticky commented 11 years ago

@kevinastone Do you get any errors on launch/file open in the console? (Press Control+``` to open it)

kevinastone commented 11 years ago

Ah, nevermind. Didn't realize that Trailing Spaces: Toggle Trailing Spaces hides the syntax highlighting (for some reason, I assumed that added or removed trailing spaces like Toggle Comment).

This is great with that Command available.

I was trying to use the setting: trailing_spaces_enabled to get the safe effect.

ticky commented 11 years ago

@kevinastone Yeah, they're two slightly different things.

kevinastone commented 11 years ago

Can this Toggle state survive restarts? I have to toggle highlighting off each time I start Sublime.

ticky commented 11 years ago

@kevinastone I don't believe it can as it stands, however, it should be very simple to make a patch to allow this.

It'd just involve saving the preference whenever the highlighting is toggled, and more than likely, a setting to enable the saving of the state.

kevinastone commented 11 years ago

Yeah, I wrote a quick plugin (which I'm sure I found online somewhere) to toggle the whitespace setting between selection and all so I can quickly see all the whitespace at glance. I could see this similarly for highlight trailing whitespace.

import sublime
import sublime_plugin

class ToggleWhiteSpaceCommand(sublime_plugin.ApplicationCommand):
    def run(self):
        settings = sublime.load_settings("Preferences.sublime-settings")
        white_space = "selection" if settings.get("draw_white_space", "selection") != "selection" else "all"
        settings.set("draw_white_space", white_space)
        sublime.save_settings("Preferences.sublime-settings")

And then of course bound this command to a keyboard shortcut:


    {
        "keys": ["ctrl+a"],
        "command": "toggle_white_space"
    },
ticky commented 11 years ago

@kevinastone Great! If you can spare the time to fork the project and submit a pull request it might be useful for other people! :smiley:

kevinastone commented 11 years ago

Sounds good. I'll queue it up on my weekend projects...

chikamichi commented 11 years ago

@kevinastone nice feature. Feel free to make a pull request whenever you're ready with this.

Relates to #14.

chikamichi commented 11 years ago

Ok, I'm closing this issue as the core request is covered.

I agree the name of the toggling command, "Toggle Trailing Spaces", is misleading. I should have named it "Toggle Trailing Spaces Highlighting", but it's a bit late now so we will have to live with that :) Hopefully the documentation is clear enough.