Guest User

Untitled

a guest
Apr 27th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. ;; mode line modes
  2. (line-number-mode t)
  3. (column-number-mode t)
  4. (size-indication-mode t)
  5.  
  6. ;; diff-hl reducer used ro replace the git-gutter reducer
  7. (defun ww/diff-hl-reducer (acc it)
  8. "A reducer to count added, removed, and modified lines for diff-hl."
  9. (cl-destructuring-bind (added removed modified) acc
  10. (let ((lines (nth 1 it))
  11. (type (nth 2 it)))
  12. (pcase type
  13. ('insert (list (+ added lines) removed modified))
  14. ('delete (list added (+ removed lines) modified))
  15. ('change (list added removed (+ modified lines)))))))
  16.  
  17. ;; spaceline
  18. (use-package spaceline
  19. :ensure t
  20. :config
  21. ;; spaceline-all-the-icons does not come with diff-hl support out of the box so
  22. ;; we redefine it's git-stat function to gather diff info from diff-hl instead
  23. ;; of git-gutter.
  24. (defun spaceline-all-the-icons--git-statistics ()
  25. "Return a list of added, removed, and modified lines in the current file.
  26. Uses diff-hl as oppose to the default git-gutter functions."
  27. (cond
  28. ((bound-and-true-p diff-hl-mode)
  29. (cl-reduce 'ww/diff-hl-reducer (diff-hl-changes) :initial-value '(0 0 0)))
  30. (t '(0 0 0)))))
  31.  
  32. ;; ... with all the icons
  33. (use-package spaceline-all-the-icons
  34. :ensure t
  35. :config
  36. (setq spaceline-all-the-icons-separator-type 'arrow)
  37. (spaceline-all-the-icons-theme))
Add Comment
Please, Sign In to add comment