I'd like to disable whitespace-mode
while in evil insert state. The following hooks work, but require refreshing all font colors with (font-lock-fontify-buffer)
, and even then- sometimes it fails to refresh properly to show trailing whitespace.
While this example uses evil-mode, similar logic applies to any other hook.
(defun i42/enter-insert-mode ()
(whitespace-mode -1)
(font-lock-fontify-buffer))
(defun i42/exit-insert-mode ()
(whitespace-mode 1)
(font-lock-fontify-buffer))
(add-hook 'evil-insert-state-entry-hook 'i42/enter-insert-mode)
(add-hook 'evil-insert-state-exit-hook 'i42/exit-insert-mode)
Is there a better way to toggle white space mode?
redraw-display
orredisplay
fix this issue? These functions should redraw the display and possibly fix your problem.whitespace-mode
without usingevil
, does the screen refresh properly without any extra steps?redraw-display
,redraw
& manually togglingwhitespace-mode
- none of them properly refresh the background color of trailing space, found a workaround, temporarily change the theme color - will post as a possible answer.