15

I'm looking for an Emacs package or configuration that makes it possible to mark indentations with vertical lines, like those shown in the following screenshot of Sublime Text:

Sublime Text 2

I say Reinstate Monica
  • 25,487
  • 19
  • 95
  • 131
mfaerevaag
  • 283
  • 2
  • 7

3 Answers3

9

I guess this and this could be an answer to your question.

Installation is easy. Invoke git clone git@github.com:antonj/Highlight-Indentation-for-Emacs.git . in, say, ~/.emacs.d/highlight-indents and add

(add-to-list 'load-path "~/.emacs.d/packages/highlight-indents/")
(require 'highlight-indentation)

to your .emacs. Then, when visiting a file you can M-x highlight-indentation-mode RET to enable the minor mode.

Dror
  • 1,880
  • 3
  • 18
  • 28
  • PERFECT. Exactly what I was looking for. Thank you! – mfaerevaag Jun 18 '13 at 08:24
  • Hmm.. `indent-guide` highlights whole column and I'm seeking for a thin vertical lines like on screenshot in question. There is `indent-hint` by ran9er mentioned on wiki page, but it is not works out-of-box. Is there another solution? – Geradlus_RU Jun 07 '15 at 11:10
3

You can also use highlight-indent-guides-mode and add it as a hook to prog-mode, so that it gets loaded automatically.

In Spacemacs, I did it by first installing it with M-x package-install or adding it as a user-defined package in .spacemacs, then M-x customize-group, prog-mode, prog-mode hooks, "ins", enter highlight-indent-guides-mode.

You can configure it via M-x customize-group highlight-indent-guides and change the indent character, coloring, etc.

So far, it works wonders and renders quickly.

dennismayr
  • 31
  • 3
1

I think you may want to look at indent-guide mode. It gives indentation of code blocks dynamically when we move the cursor. Moreover, it is easy to set up your favorite indent characters like : and | as well as the background color of intentions.

jimtut
  • 1,608
  • 2
  • 11
  • 17
YulongNiu
  • 11
  • 1
  • I've briefly looked at `indent-guide` sources and README and found no way to set up indentation character, how can I do that? – Geradlus_RU Jun 10 '15 at 09:59
  • @Geradlus_RU Here are my Emacs configure:.`(require 'indent-guide) (set-face-background 'indent-guide-face "gray") (add-hook 'prog-mode-hook 'indent-guide-mode) (add-hook 'ess-mode-hook 'indent-guide-mode) (add-hook 'markdown-mode-hook 'indent-guide-mode)` – YulongNiu Jul 17 '15 at 08:45
  • Oh, I just realized that `indent-guide` is another package different from `highlight-indentation`. Thank you, the former is what I have looked for! – Geradlus_RU Jul 17 '15 at 19:47