As @drew asked me to do here I'm asking one question per problem

I'm trying to enable/disable visual-fill-column when there is one window/multiple windows.

(defun my-visual-fill-one-window ()
  (global-visual-fill-column-mode -1)
  (if (one-window-p)
      (global-visual-fill-column-mode 1)
    (global-visual-fill-column-mode -1)

(add-hook 'window-state-change-hook 'my-visual-fill-one-window)

I'm hooking it to window-state-changed-hook because it looked like the most suited one but maybe I could do better (the main problem being that if I use ivy-posframe it's considered as a second window, the mode is disabled, the text is instantly flushed to the left and as soon as the posframe is closed the mode is enabled again and the text centered)

  • I added an ivy tag. Because the question / answer appears to be dependent upon ivy familiarity, and also upon a forum participant who either has that package (and dependencies, if any) already installed or is willing to install it/those so that a proposed solution can be tested, a generic answer (if available) may not be forthcoming ... – lawlist Jan 16 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.