Skip to content

mrBliss/highlight-leading-spaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

highlight-leading-spaces melpa

Overview

screenshot

This minor-mode highlights leading spaces with a face and replaces them with a special character so they can easily be counted (this can be disabled).

The whitespace.el package that is built-in to Emacs can be used to accomplish the same effect, but for all spaces, including non-leading spaces between words. This minor-mode only highlights leading spaces that are part of the indentation.

The face to highlight leading spaces with can be customised by changing the highlight-leading-spaces face. The character to replace leading spaces with can be customised by changing highlight-leading-spaces-char. If you do not wish to them to be replaced with a special character, set it to a space.

This minor-mode is quite efficient because it doesn't use overlays but text properties for the leading spaces. Furthermore, the highlights are correctly and efficiently kept up-to-date by plugging in to font-lock, not by adding various hooks.

Installation

  1. Install the highlight-leading-spaces package.

  2. Use the highlight-leading-spaces-mode hook to enable this minor-mode:

    (add-hook 'prog-mode-hook 'highlight-leading-spaces-mode)

Users of use-package can add the following lines to their config:

(use-package highlight-leading-spaces
  :ensure t
  :defer t
  :init (add-hook 'prog-mode-hook 'highlight-leading-spaces-mode))

Manual

Download this package and add the following lines to your config.

(add-to-list 'load-path "/path/to/highlight-leading-spaces")
(require 'highlight-leading-spaces)
(add-hook 'prog-mode-hook 'highlight-leading-spaces-mode)

Licence

Distributed under the GNU General Public License.

About

Higlight leading spaces that are part of the indentation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published