我想我已经在我的_vimrc中尝试了这四个命令的每个直观组合,有无冒号:
syntax enable
syntax on
set filetype=r
set syntax=r
但是当我在gVim中打开一个脚本时,它只是一个纯色。在会话中,两者都是':set syntax = r'和':设置filetype = r'工作正常,而另外两个什么都不做。
我的完整_vimrc如下:
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set keymodel-=stopsel
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
"show line numbers
set number
"syntax highlighting for R
"syntax enable
syntax on
set filetype=r
"set syntax=r
colorscheme elflord
"see commands as they're being typed
set showcmd
"change the key combo for normal mode to 'jk'
inoremap jk <ESC>
"add line below cursor in insert mode
:autocmd InsertEnter * set cul
:autocmd InsertLeave * set nocul