1

I have not been able to reproduce this on another machine, but I am completely stumped by this, so I hope someone else has run into this issue before, and knows the root cause and how to fix it.

Here is my vimrc:

set autoindent
set formatoptions=tcq
set fo+=n

When I start vim using the just vim with no argument, and then I type :set fo, the response is formatoptions=tcqn.

When I start vim with a file, such as vim /tmp/out, and then I type :set fo, the response is formatoptions=tcql.

My only reasonable conclusion is that $HOME/.vimrc is not loaded when I start vim with a file.

Has anyone seen this issue before or know of a good workaround?

Here is my vim --version output:

VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Feb 17 2012 10:23:31)
Included patches: 1-411
Modified by <bugzilla@redhat.com>
Compiled by <bugzilla@redhat.com>
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent 
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic 
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path 
+float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand 
+jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap 
+menu +mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm 
-mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte 
+multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra +perl +postscript 
+printer +profile +python +quickfix +reltime +rightleft -ruby +scrollbind 
+signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax 
+tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse 
+textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual 
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup 
-X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save 
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -O2 -g -pipe -Wall  -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64  -D_FORTIFY_SOURCE=1    -D_REENTRANT -D_GNU_SOURCE  -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -I/usr/lib64/perl5/CORE  -I/usr/include/python2.6 -pthread   
Linking: gcc   -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE   -L/usr/local/lib -o vim       -lselinux  -lncurses -lacl -lgpm   -Wl,-E -Wl,-rpath,/usr/lib64/perl5/CORE  -fstack-protector  -L/usr/lib64/perl5/CORE -lperl -lresolv -lutil -lc -L/usr/lib64/python2.6/config -lpython2.6 -lutil -lm -Xlinker -export-dynamic    
merlin2011
  • 71,677
  • 44
  • 195
  • 329
  • Possibly see this question: http://stackoverflow.com/questions/6076592/vim-set-formatoptions-being-lost – nobody Apr 03 '14 at 19:08
  • @AndrewMedico, Thanks for the link. One of the answers functions as a workaround, but it does not seem to explain how a C plugin could affect an arbitrary file. – merlin2011 Apr 03 '14 at 19:19
  • 1
    I agree that ftplugin files should not be loaded, since you have no `ftplugin on` line in your vimrc file. The main tools for debugging problems like this are `:scriptnames` and `verbose set fo?`. At least one of those is mentioned in the question mentioned above. – benjifisher Apr 03 '14 at 19:56
  • break your .vimrc (put snthsnth on a line or something) and see if it complains when you're loading a file. – acushner Apr 07 '14 at 13:49

0 Answers0