I would like visual-line-mode to be always on.

For this reason I put in the very end of my init.el file the following line of code (global-visual-line-mode 1) (as suggested here).

Anyway, the above code does not work and so. I still have to enable visual-line-mode for every buffer I need it.

How can I have it permanently on? Why is the above code not working?

  • The behavior you describe is not the default behavior as far as I am aware. With zero user-configuration (aka emacs -Q), please give us a step-by-step example of how you encounter the behavior you wish to change. And, tell us what version of Emacs you are using and what OS. In general, a minor-mode such as visual-line-mode will be enabled after a major-mode has been enabled. So, if a major-mode sets truncate-lines to t, the minor-mode of visual-line-mode will then come along and change truncate-lines to nil value. If a major-mode sets word-wrap to nil, the minor-mode ....
    – lawlist
    Commented Oct 16, 2018 at 1:50
  • you could try adding hooks temporarily till you find the conflicts in your config.. (add-hook 'prog-mode-hook 'turn-on-visual-line-mode) or (add-hook 'text-mode-hook 'turn-on-visual-line-mode)
    – jun
    Commented Oct 16, 2018 at 9:10

2 Answers 2


I have no experience with emacs.. I merely use it for just org mode. But I did manage to permanently enable visual-line mode (aka proper line wrapping) globally, here is what i did:

The website OP mentioned (http://ergoemacs.org/emacs/emacs_long_line_wrap.html) instructs that the snippet

(global-visual-line-mode 1)

be written somewhere in the .emacs file (which is in the usually in C:\Users\"your user name"\AppData\Roaming directory). I don't know where exactly to put that snippet in .emacs file because, well, I am using Spacemacs so I edited the .spacemacs file. Towards the end of the text inside the .spacemacs file there is the following code, where I added the additional line (global-visual-line-mode 1) as shown:

(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
  (global-visual-line-mode 1))

All - I am new to EMACS but it is awesome. I have been adding things to my ~/.emacs file I finally just put the (global-linum-mode t) and (global-visual-line-mode 1) at the top of the file and now it is working. I am on Linux Mint and have Emacs version 26.3. hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.