I have the following lines at the bottom of my .vimrc.local:

set textwidth=0 
set wrapmargin=0

However, whenever I open a new file, both these values are set to their defaults (72 and 2, respectively) and not my custom settings. The other settings in my .vimrc.local file appear to be set (tabs, etc) but just these two keep being reset. If I enter :source ~/.vimrc.local the settings change and work correctly.

Is there a way to look at what is setting anything when vim starts up? I suspect that some plugin or setting that came with MacVim or Janus is setting these options, but I don't know how to look at every setting at once.

  • I had never seen ~/.vimrc.local before. The version of Janus that I found sources it (if it exists) at the end of its vimrc file (which is the destination of the ~/.vimrc symlink that it installs, if you use its installation method). Maybe not all versions of Janus do this—many people seem to merge the one I found into their forks, but I have no idea if this is the “official” one or not. Just to clarify, where did you get your Janus? If it is a Git-based one, which commit are you using? Commented Feb 25, 2011 at 5:38
  • Worth reading this defaul formatoptions
    – anishjp
    Commented Jul 10, 2019 at 10:55

3 Answers 3


To find out where 'textwidth' and 'wrapmargin' were set last, execute

:verbose set tw? wm?

To see what files have been sourced, execute


If those aren't enough to find the problem, you can use the -V option when Vim starts and log the various startup events to a file. See

:help -V

Also, the default values for 'textwidth' and 'wrapmargin' are both 0, not 72 and 2, so already something is setting them to non-default values. For the default values, see

:help 'textwidth'
:help 'wrapmargin'

Something else to check is the possibility that a filetype plugin is making those settings. The :verbose set ... command should show where those settings are being made, but you could also execute

:set filetype?

to see the current filetype, then open $VIMRUNTIME/ftplugin/<filetype>.vim, where <filetype> is the value of the 'filetype' option found above, to see if those settings are being made there. You can override settings made by a filetype plugin by putting your settings in a file you create, named ~/.vim/after/ftplugin/<filetype>.vim. See

:help filetype-overrule

item #3.

  • Turns out the issue was in ~/.vimrc, which came from Janus. I expected the source ~/.vimrc.local to be the last thing that executed, but it was setting those two with the au command. It seems like the settings in ~/.vimrc contain a lot of stylistic choices of the people who maintain Janus. Thank you for writing an answer that will help me troubleshoot these problems for myself in the future. :)
    – Ian Potter
    Commented Feb 25, 2011 at 22:48
  • 1
    I also came here due to this issue in Janus. But note, in the latest Janus ~/.vimrc.after does get run last, however there was, for example, a python specific action happening, so I had to use au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=0 rather than simply set textwidth=0 in that file.
    – philfreo
    Commented Mar 3, 2012 at 5:56

I solved this by adding the following to my .vimrc.local file:

" Disable annoying auto line break
fu! DisableBr()
    set wrap
    set linebreak
    set nolist  " list disables linebreak
    set textwidth=0
    set wrapmargin=0
    set fo-=t

" Disable line breaks for all file types
:au BufNewFile,BufRead *.* call DisableBr()

This should disable unwanted auto line breaks for all file types

  • 1
    Works in .vimrc.after when using Janus
    – Eric Yang
    Commented Oct 3, 2012 at 21:04
  • 1
    Huzzah, thanks! This was the only thing that worked for me. For some reason (I couldn't work out) macvim was overriding the textwidth in my vimrc for .txt files.
    – matt burns
    Commented Apr 3, 2013 at 10:15

This should help:

(Maybe BufAdd and BufCreate is redundant, but I added it just in case)

function! DisableWrap()
    set nowrap
    set nolinebreak
    set formatoptions-=cro
autocmd BufNew,BufAdd,BufCreate,VimEnter * call DisableWrap()

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .