2

http://i.imgur.com/3wZ7XKs.png

How can I turn off this highlighting of empty lines/spaces?

I am using spacemacs, so I would appreciate if answers could tell me how to disable the highlighting through the spacemacs infrastructure rather than through vanilla Emacs.

  • 1
    That is whitespace-mode. I'm posting this as a comment and not an answer because I don't know enough about Spacemacs to tell you how to turn it off. – Aaron Harris Jun 30 '16 at 14:19
  • The image you linked is no longer available. Please replace it with an actual image in the post for the benefit of future readers. – Dan Sep 8 '16 at 16:26
3

How to disable whitespace highlight in Spacemacs

smartparens

smartparens is an Emacs package for intelligent manipulation of pairs of delimiters such as [], {}, (), <>, "", etc. It is enabled by default in Spacemacs. When you type an open delimiter such as {, it automatically adds a closing delimiter such as }. If you press Enter several times, the delimiters with all space between them including other characters will be highlighted. If you move cursor outside the delimiters, the highlight will disappear. It seems that this is your problem.

I don't use smartparens, so I don't know whether this highlighting is an important feature of smartparens that helps use it, so if somebody can explain why this highlighting may be important as a separate answer, that would be informative.

In any case, if this highlighting really annoys you, you can turn it off buy customizing a specific smartparens variable called sp-highlight-pair-overlay. You can either set this variable to nil manually, or use easy customization interface (read more on how to use it by following the link).

To customize this variable, execute customize-group, select smartparens, find an entry that says “Sp Highlight Pair Overlay”, and toggle the variable. Don't forget to save changes when customizing variables using customize-group interface! The button to save is on top.

whitespace-mode

There is another case of whitespace highlight that might bother you. If you have whitespace-mode turned on, every whitespace character in your text buffer is replaced: space with centered dot, non-breaking space with currency sign, newline with dollar sign, tab with left quote mark. They also get different colors too. So it might look something like this:

data·Player·=$
»   {·health·::·Int$
»   ,·mana·::·Int$
}

If you just want to toggle this mode on/off in the particular buffer, just press Space t w (spacemacs/toggle-whitespace). If you want to toggle this mode globally so that it's always on/off every time you start Emacs, put (spacemacs/toggle-whitespace-globally-on) or (spacemacs/toggle-whitespace-globally-off) in your .spacemacs file.

If you want to read more about different toggles, press Space h Space and select “Spacemacs documentation”, this is the canonical way to read the docs for Spacemacs. If you want to see which toggles are currently on, press Space h t.

show-trailing-whitespace

There is another highlight for the so called trailing space, when you have extra space characters at the end of the line. In my theme it is highlighted somewhat dark cyan. It has to do with show-trailing-whitespace variable that you can also read about in Section “Useless Whitespace” of Emacs Manual. Something sets this variable to t for most programming buffers and I don't know how to turn it off globally, but I guess it has to do with this snippet in spacemacs-base layer.

  • Where in the config file do you customize sp-highlight-pair-overlay? I'm new to spacemacs. There aren't any default variables starting with sp-, so I'm not sure where to place this. – steel Aug 8 '16 at 21:35
1

You have to set:

(setq-default spacemacs-show-trailing-whitespace nil)

See this discussion on turning off whitespace-mode on the Spacemacs github site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.