views:

144

answers:

2

Its a bit weird, I wanted to deactivate automatic backups in gVIM when saving, so I placed set nobackup in the top of the file _vimrc and it didn't work. Then I placed that line below the following lines:

set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

and it worked.

basically set nobackup doesn't works like this:

set nobackup

 set nocompatible
    source $VIMRUNTIME/vimrc_example.vim
    source $VIMRUNTIME/mswin.vim
    behave mswin

and but works like this:

 set nocompatible
    source $VIMRUNTIME/vimrc_example.vim
    source $VIMRUNTIME/mswin.vim
    behave mswin

set nobackup

Is this normal? Do VIM settings interfere with other settings?

+1  A: 

vimrc_example.vim contains:

if has("vms")
  set nobackup      " do not keep a backup file, use versions instead
else
  set backup        " keep a backup file
endif

you could have easily checked this yourself, you know. ;)

edit

oh, and I'd suggest getting rid of the includes and the behave mswin directive. it makes vim turns vim into a different text editor. one of vim's great strengths is that it works the same everywhere: MS Windows, X Windows, unix terminal... mswin voids this feature.

if you get used to ^S for :w and ^Q for ^V, you'll weep when you try to use vim in a unix terminal (they mean something to the terminal, and vim won't see the keystrokes at all); backspace is also troublesome (^H on most systems, ^? on GNU/Linux, different terminals have different defaults), ditto for delete and alt. etc.

just somebody
+4  A: 
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim

means that vim runs the configuration in those files before loading the lines after. As "just somebody" said, in vimrc_example.vim, the backup is activated, so, in your first example, your first set the nobackup and then it's unactivated by the .vim file.

Valentin Rocher