Skip to content

Latest commit

 

History

History
153 lines (127 loc) · 6.16 KB

examples.md

File metadata and controls

153 lines (127 loc) · 6.16 KB

Example indent-bars color/layout possibilities

Old Default:

ib_default
   (setq
    indent-bars-color '(highlight :face-bg t :blend 0.3)
    indent-bars-pattern " . . . . ." ; play with the number of dots for your usual font size
    indent-bars-width-frac 0.25
    indent-bars-pad-frac 0.1)

Minimal:

ib_minimal

Narrow bars without much adornment.

   (setq
    indent-bars-color '(highlight :face-bg t :blend 0.2)
    indent-bars-pattern "."
    indent-bars-width-frac 0.1
    indent-bars-pad-frac 0.1
    indent-bars-zigzag nil
    indent-bars-color-by-depth nil
    indent-bars-highlight-current-depth nil
    indent-bars-display-on-blank-lines nil)

Zebra:

ib_zebra

Note alternating space and . in the pattern string.

  (setq
   indent-bars-color '(highlight :face-bg t :blend 0.25)
   indent-bars-pattern ". .. .  "
   indent-bars-zigzag nil
   indent-bars-width-frac 0.4
   indent-bars-pad-frac 0.1
   indent-bars-color-by-depth '(:palette ("black" "white") :blend 0.65)
   indent-bars-highlight-current-depth '(:color "red" :blend 0.15))

Simple:

ib_simple

We keep all the defaults but turn off depth-based coloring and change the bar size a bit. Current depth highlighting is achieved with a higher than default blend (making the bar "brighter").

   (setq
    indent-bars-pattern "."
    indent-bars-width-frac 0.5
    indent-bars-pad-frac 0.25
    indent-bars-color-by-depth nil
    indent-bars-highlight-current-depth '(:face default :blend 0.4))

Zig-zag:

ib_zz

The zig-zag option moves the bitmap pattern alternately left and right for blocks of contiguous matching characters in the pattern string. Note that you must leave room given pad-frac and width to see the entire pattern (but it's also fine not to for "interesting" zig-zags).

  (setq
   indent-bars-pattern ". . . . "
   indent-bars-width-frac 0.25
   indent-bars-pad-frac 0.2
   indent-bars-zigzag 0.1
   indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 1)
   indent-bars-highlight-current-depth '(:pattern "." :pad 0.1 :width 0.45))

Zig-zag Smooth:

zz_smooth

The length of the pattern string (and height of a character) determines how "thick" the pattern appears.

(setq
 indent-bars-pattern ".*.*.*.*.*.*.*.*"
 indent-bars-width-frac 0.25
 indent-bars-pad-frac 0.2
 indent-bars-zigzag 0.1
 indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 0.5)
 indent-bars-highlight-current-depth '(:face default :blend 0.7))

Background zig-zag:

ib_bgzz

Current depth highlight is fully flexible and all style options are available.

  (setq
   indent-bars-color '(highlight :face-bg t :blend 0.2)
   indent-bars-pattern ".*.*.*.*"
   indent-bars-width-frac 0.5
   indent-bars-pad-frac 0.2
   indent-bars-zigzag 0.1
   indent-bars-color-by-depth '(:palette ("red" "green" "orange" "cyan") :blend 1)
   indent-bars-highlight-current-depth '(:background "gray10"))

Minimal colorpop:

image

Showcasing :blend-only current-depth coloring (no change in color, just make it more saturated).

(setq
    indent-bars-color '(highlight :face-bg t :blend 0.15)
    indent-bars-pattern "."
    indent-bars-width-frac 0.1
    indent-bars-pad-frac 0.1
    indent-bars-zigzag nil
    indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 1) ; blend=1: blend with BG only
    indent-bars-highlight-current-depth '(:blend 0.5) ; pump up the BG blend on current
    indent-bars-display-on-blank-lines t)

In terminal:

ib_term

Note that terminal use implicitly implies indent-bars-prefer-character.

  (setq
   indent-bars-color '(highlight :face-bg t :blend 0.75)
   indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 1)
   indent-bars-unspecified-fg-color "white"
   indent-bars-unspecified-bg-color "black")"

Note: indent-bars-prefer-character need not be set unless you prefer to use character display in GUI as well.

With prism-whitespace-mode:

image

This config (contributed by @alphapapa) shows using the faces from another mode to coordinate text and bar color. Note the faces could also have been configured using the :regexp option prism-level-\([0-9]+\).

Quiet/Loud (with treesitter scope-focus):

image

Here we dial down the out-of-scope treesitter bars to be very muted, and then amp-up the default in-scope bars with a zig-zag pattern on the current selection and saturated colors.

	(setopt
		indent-bars-color '(highlight :face-bg t :blend 0.8)
		indent-bars-pattern "."
		indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 0.8)
		indent-bars-highlight-current-depth '(:blend 1.0 :width 0.4 :pad 0.1 :pattern "!.!.!." :zigzag 0.1)
		indent-bars-pad-frac 0.3
		indent-bars-ts-highlight-current-depth '(no-inherit) ; equivalent to nil
		indent-bars-ts-color-by-depth '(no-inherit)
		indent-bars-ts-color '(inherit fringe :face-bg t :blend 0.2))