diff options
-rw-r--r-- | init.el | 2 | ||||
-rw-r--r-- | lisp/acdw-modeline.el | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/init.el b/init.el index e495803..4395c64 100644 --- a/init.el +++ b/init.el | |||
@@ -1275,7 +1275,7 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
1275 | simple-modeline-segments '((acdw-modeline/modified | 1275 | simple-modeline-segments '((acdw-modeline/modified |
1276 | acdw-modeline/buffer-name | 1276 | acdw-modeline/buffer-name |
1277 | acdw-modeline/vc-branch | 1277 | acdw-modeline/vc-branch |
1278 | simple-modeline-segment-position) | 1278 | acdw-modeline/position) |
1279 | (simple-modeline-segment-misc-info | 1279 | (simple-modeline-segment-misc-info |
1280 | acdw-modeline/erc | 1280 | acdw-modeline/erc |
1281 | acdw-modeline/word-count | 1281 | acdw-modeline/word-count |
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 104ea28..4e6b002 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el | |||
@@ -94,6 +94,35 @@ indicator in the mode-line." | |||
94 | 'mouse-2 #'mode-line-widen)) | 94 | 'mouse-2 #'mode-line-widen)) |
95 | 'mouse-face 'mode-line-highlight)))) | 95 | 'mouse-face 'mode-line-highlight)))) |
96 | 96 | ||
97 | (defun acdw-modeline/position () | ||
98 | "Displays the current cursor position in the mode-line. | ||
99 | |||
100 | Unlike `simple-modeline-segment-position', this changes the first | ||
101 | character from '+' to '-' if the region goes 'backward' -- that | ||
102 | is, if point < mark." | ||
103 | `((line-number-mode | ||
104 | ((column-number-mode | ||
105 | (column-number-indicator-zero-based | ||
106 | (8 " %l:%c") | ||
107 | (8 " %l:%C")) | ||
108 | (5 " L%l"))) | ||
109 | ((column-number-mode | ||
110 | (column-number-indicator-zero-based | ||
111 | (5 " C%c") | ||
112 | (5 " C%C"))))) | ||
113 | ,(if (region-active-p) | ||
114 | (propertize (format "%s%s" | ||
115 | (if (and (mark) | ||
116 | (< (point) (mark))) | ||
117 | "-" | ||
118 | "+") | ||
119 | (apply #'+ (mapcar | ||
120 | (lambda (pos) | ||
121 | (- (cdr pos) | ||
122 | (car pos))) | ||
123 | (region-bounds)))) | ||
124 | 'font-lock-face 'font-lock-variable-name-face)))) | ||
125 | |||
97 | (defun acdw-modeline/text-scale () | 126 | (defun acdw-modeline/text-scale () |
98 | ;; adapted from https://github.com/seagle0128/doom-modeline | 127 | ;; adapted from https://github.com/seagle0128/doom-modeline |
99 | (when (and (boundp 'text-scale-mode-amount) | 128 | (when (and (boundp 'text-scale-mode-amount) |