mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-24 03:00:10 +00:00
Fix for evil-anzu
.
This commit is contained in:
parent
96d6fda059
commit
55269e7288
1 changed files with 59 additions and 57 deletions
116
doom-modeline.el
116
doom-modeline.el
|
@ -204,27 +204,29 @@ If STRICT-P, return nil if no project was found, otherwise return
|
||||||
|
|
||||||
;; anzu and evil-anzu expose current/total state that can be displayed in the
|
;; anzu and evil-anzu expose current/total state that can be displayed in the
|
||||||
;; mode-line.
|
;; mode-line.
|
||||||
(setq anzu-cons-mode-line-p nil
|
(when (feature 'evil-anzu)
|
||||||
anzu-minimum-input-length 1
|
(setq anzu-cons-mode-line-p nil
|
||||||
anzu-search-threshold 250)
|
anzu-minimum-input-length 1
|
||||||
|
anzu-search-threshold 250)
|
||||||
|
|
||||||
(defun doom-modeline-fix-anzu-count (positions here)
|
(defun doom-modeline-fix-anzu-count (positions here)
|
||||||
(cl-loop for (start . end) in positions
|
(cl-loop for (start . end) in positions
|
||||||
collect t into before
|
collect t into before
|
||||||
when (and (>= here start) (<= here end))
|
when (and (>= here start) (<= here end))
|
||||||
return (length before)
|
return (length before)
|
||||||
finally return 0))
|
finally return 0))
|
||||||
(advice-add #'anzu--where-is-here :override #'doom-modeline-fix-anzu-count)
|
(advice-add #'anzu--where-is-here :override #'doom-modeline-fix-anzu-count)
|
||||||
|
|
||||||
;; Avoid anzu conflicts across buffers
|
;; Avoid anzu conflicts across buffers
|
||||||
;; (mapc #'make-variable-buffer-local
|
(mapc #'make-variable-buffer-local
|
||||||
;; '(anzu--total-matched anzu--current-position anzu--state
|
'(anzu--total-matched anzu--current-position anzu--state
|
||||||
;; anzu--cached-count anzu--cached-positions anzu--last-command
|
anzu--cached-count anzu--cached-positions anzu--last-command
|
||||||
;; anzu--last-isearch-string anzu--overflow-p))
|
anzu--last-isearch-string anzu--overflow-p))
|
||||||
|
|
||||||
;; Ensure anzu state is cleared when searches & iedit are done
|
;; Ensure anzu state is cleared when searches & iedit are done
|
||||||
(add-hook 'isearch-mode-end-hook #'anzu--reset-status t)
|
(add-hook 'isearch-mode-end-hook #'anzu--reset-status t)
|
||||||
(add-hook 'iedit-mode-end-hook #'anzu--reset-status)
|
;; (add-hook '+evil-esc-hook #'anzu--reset-status t)
|
||||||
|
(add-hook 'iedit-mode-end-hook #'anzu--reset-status))
|
||||||
|
|
||||||
|
|
||||||
;; Keep `doom-modeline-current-window' up-to-date
|
;; Keep `doom-modeline-current-window' up-to-date
|
||||||
|
@ -498,50 +500,50 @@ Example:
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(doom-modeline-def-segment buffer-default-directory
|
(doom-modeline-def-segment buffer-default-directory
|
||||||
"Displays `default-directory'. This is for special buffers like the scratch
|
"Displays `default-directory'. This is for special buffers like the scratch
|
||||||
buffer where knowing the current project directory is important."
|
buffer where knowing the current project directory is important."
|
||||||
(let ((face (if (doom-modeline--active) 'doom-modeline-buffer-path)))
|
(let ((face (if (doom-modeline--active) 'doom-modeline-buffer-path)))
|
||||||
(concat (if (display-graphic-p) " ")
|
(concat (if (display-graphic-p) " ")
|
||||||
(doom-modeline-maybe-icon-octicon
|
(doom-modeline-maybe-icon-octicon
|
||||||
"file-directory"
|
"file-directory"
|
||||||
:face face
|
:face face
|
||||||
:v-adjust -0.05
|
:v-adjust -0.05
|
||||||
:height 1.25)
|
:height 1.25)
|
||||||
(propertize (concat " " (abbreviate-file-name default-directory))
|
(propertize (concat " " (abbreviate-file-name default-directory))
|
||||||
'face face))))
|
'face face))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
(doom-modeline-def-segment buffer-info
|
(doom-modeline-def-segment buffer-info
|
||||||
"Combined information about the current buffer, including the current working
|
"Combined information about the current buffer, including the current working
|
||||||
directory, the file name, and its state (modified, read-only or non-existent)."
|
directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
(concat (cond (buffer-read-only
|
(concat (cond (buffer-read-only
|
||||||
(concat (doom-modeline-maybe-icon-octicon
|
(concat (doom-modeline-maybe-icon-octicon
|
||||||
"lock"
|
"lock"
|
||||||
:face 'doom-modeline-warning
|
:face 'doom-modeline-warning
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" "))
|
" "))
|
||||||
((buffer-modified-p)
|
((buffer-modified-p)
|
||||||
(concat (doom-modeline-maybe-icon-faicon
|
(concat (doom-modeline-maybe-icon-faicon
|
||||||
"floppy-o"
|
"floppy-o"
|
||||||
:face 'doom-modeline-buffer-modified
|
:face 'doom-modeline-buffer-modified
|
||||||
:v-adjust -0.0575)
|
:v-adjust -0.0575)
|
||||||
" "))
|
" "))
|
||||||
((and buffer-file-name
|
((and buffer-file-name
|
||||||
(not (file-exists-p buffer-file-name)))
|
(not (file-exists-p buffer-file-name)))
|
||||||
(concat (doom-modeline-maybe-icon-octicon
|
(concat (doom-modeline-maybe-icon-octicon
|
||||||
"circle-slash"
|
"circle-slash"
|
||||||
:face 'doom-modeline-urgent
|
:face 'doom-modeline-urgent
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" "))
|
" "))
|
||||||
((buffer-narrowed-p)
|
((buffer-narrowed-p)
|
||||||
(concat (doom-modeline-maybe-icon-octicon
|
(concat (doom-modeline-maybe-icon-octicon
|
||||||
"fold"
|
"fold"
|
||||||
:face 'doom-modeline-warning
|
:face 'doom-modeline-warning
|
||||||
:v-adjust -0.05)
|
:v-adjust -0.05)
|
||||||
" ")))
|
" ")))
|
||||||
(if buffer-file-name
|
(if buffer-file-name
|
||||||
(doom-modeline-buffer-file-name)
|
(doom-modeline-buffer-file-name)
|
||||||
"%b")))
|
"%b")))
|
||||||
|
|
||||||
(doom-modeline-def-segment buffer-info-simple
|
(doom-modeline-def-segment buffer-info-simple
|
||||||
"Display only the current buffer's name, but with fontification."
|
"Display only the current buffer's name, but with fontification."
|
||||||
|
|
Loading…
Reference in a new issue