On a hosted system I logged in via SSH and edited a file with vim. Usually once I'm in insert mode I can just paste from my local clipboard into the ssh window and VIM accepts it fine, but for some reason things go wonky on this system and the text is all over the place.

I typed :set to get the list of options and this is what came back:

--- Options ---                               
filetype=php        history=50  ruler         ttyfast      viminfo='20,"50     t_Sf=^[[3%dm
helplang=en         hlsearch    syntax=php    ttymouse=xterm2     t_Sb=^[[4%dm

On other systems I usually just see this:

--- Options ---                                
background=dark     history=50    ruler        ttyfast      viminfo='20,"50     t_Sf=^[[3%dm
filetype=php        hlsearch      syntax=php   ttymouse=xterm2     t_Sb=^[[4%dm

I tried adding these lines to ~/.vimrc:

:set comments=
:set formatoptions=
:set include=
:set indentexpr=
:set indentkeys=
:set iskeyword=
:set omnifunc=

The file is being read (if there is a syntax error vim complains) but this is not helping unset any of these options. These options are also only present when editing a .php file.

How can I get rid of these extra options in vim without manually typing in the commands listed above every time?

  • I tried set option= syntax here, and was able to get a previously-set option shown in the set output to stop appearing. Maybe you just have to move those commands farther down in your .vimrc? Mar 1, 2012 at 23:19
  • 2
    are you using :set paste when pasting? Its possible their vim is loading a syntax file and so its trying to be smart.
    – phemmer
    Mar 1, 2012 at 23:37
  • @Patrick no, i was not using :set paste but i will add that to my list of tricks. i think you're correct that their vim is loading a syntax file - which is apparently getting loaded after my .vimrc, so I'm still trying to figure out how I can disable their syntax file using my .vimrc. Thoughts?
    – cwd
    Mar 3, 2012 at 18:55

2 Answers 2


Drop the : within your ~/.vimrc. You only need it from within vim, it's implied in scripts like that.

  • thanks, although i believe it does work either way. anyhow, as the things in the .vimrc were already being loaded this doesn't help resolve the issue.
    – cwd
    Mar 3, 2012 at 18:54

While not a direct answer to restore all vim options to defaults, you can use :set paste to solve your issue.

What is likely happening is that vim is loading in a syntax file which is automatically formatting the file as you type. You can temporarily disable this behavior with :set paste, which tells vim to not do any formatting at all.
After you have finished pasting, you can do :set nopaste or :set paste! to turn paste mode back off.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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