意外令牌'newline'附近的语法错误?

我的.vimrc文件中写了以下内容

set number 

set hlsearch

set mouse=a

map F2 :bprev CR

采购.vimrc文件时出现以下错误

-bash: .vimrc: line 4: syntax error near unexpected token `newline'
-bash: .vimrc: line 4: `map <F2> :bprev <CR>'
评论
  • et_qui
    et_qui 回复

    .vimrc isn't a shell script; it's a vim script. Both programs have a set command (though each does something very different than the other), which is how you get to line 4 at all. The problem here is that the shell sees the < and > as redirection operators, and the final > is followed by a newline, not a file name; hence, the syntax error.