开发者

Does settings in Vim's configuration file '_vimrc ' follow an order according to the document's flow (top to bottom)?

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.vi开发者_运维技巧m
    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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜