Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
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? –  Chris Johnsen Feb 25 '11 at 5:38
add comment

2 Answers

up vote 6 down vote accepted

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.

share|improve this answer
    
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 Feb 25 '11 at 22:48
    
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 Mar 3 '12 at 5:56
add comment

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

" Disable annoying auto line break
fu! local: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 local:disableBr()

This should disable unwanted auto line breaks for all file types

share|improve this answer
    
Works in .vimrc.after when using Janus –  Eric Yang Oct 3 '12 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 Apr 3 '13 at 10:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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