Skip to content

integration with Editorconfig

JD Smith edited this page Sep 13, 2024 · 3 revisions

I wrote this snippet to make the indent-bars follow indentation settings from editorconfig package.

  (use-package editorconfig
    :demand t
    :config
    (defun oxcl/update-indent-bars-with-editorconfig (size)
      (when (bound-and-true-p indent-bars-mode)
        (setq indent-bars-spacing-override size)
        (indent-bars-reset)))
    (dolist (_mode editorconfig-indentation-alist)
      (let ((_varlist (cdr _mode)))
        (setcdr _mode (append '((_ . oxcl/update-indent-bars-with-editorconfig))
                                  (if (listp _varlist) _varlist `(,_varlist))))))
        (editorconfig-mode 1))
Clone this wiki locally