textwidth=0 and wrapwidth=0 in .vimrc.local not being respected
To find out where 'textwidth' and 'wrapmargin' were set last, execute
:verbose set tw? wm?
To see what files have been sourced, execute
:scriptnames
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'
P.S.
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.
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
endfu
" Disable line breaks for all file types
:au BufNewFile,BufRead *.* call DisableBr()
This should disable unwanted auto line breaks for all file types