Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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? – Warren Young Mar 1 '12 at 23:19
are you using :set paste when pasting? Its possible their vim is loading a syntax file and so its trying to be smart. – Patrick Mar 1 '12 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 '12 at 18:55
@Patrick - if you post your comment as an answer I will accept it. – cwd May 9 '12 at 2:07
up vote 0 down vote accepted

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.

share|improve this answer

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

share|improve this answer
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 '12 at 18:54

Your Answer


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.