.vimrc文件中的错误

时间:2010-11-11 08:14:21

标签: vim

e
n  " Automatically detect file types.
set nocompatible  " We don't want vi compatibility.

" Add recently accessed projects menu (project plugin)
set viminfo^=!

" Minibuffer Explorer Settings
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1

" alt+n or alt+p to navigate between entries in QuickFix
map <silent> <m-p> :cp <cr>
map <silent> <m-n> :cn <cr>

" Change which file opens after executing :Rails command
let g:rails_default_file='config/database.yml'

syntax enable

这是我得到的错误:

Espresso:ruby PowerBook$ vim .vimrc
".vimrc" [New File]
Error detected while processing /Users/PowerBook/.vimrc:
line    2:
E163: There is only one file to edit
Press ENTER or type command to continue

我是vi的新手。有人能给我一个所有这些语法的参考意思吗?现在它对我来说太过分了。

2 个答案:

答案 0 :(得分:0)

它是n字符,这是一个转到下一个文件的命令。另外e.vimrc中没有多大意义,因为它只是重新加载刚刚加载的文件...

.vimrc的语法只是普通的vim命令 - 您可以手动输入文件,将:添加到每行的开头。

您可能希望配置文件如下所示:

" Automatically detect file types.
set nocompatible  " We don't want vi compatibility.

" Add recently accessed projects menu (project plugin)
set viminfo^=!

" Minibuffer Explorer Settings
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1

" alt+n or alt+p to navigate between entries in QuickFix
map <silent> <m-p> :cp <cr>
map <silent> <m-n> :cn <cr>

" Change which file opens after executing :Rails command
let g:rails_default_file='config/database.yml'

syntax enable

这个旧的question及其评分最高的答案可能是对vim最有说服力的参考。我建议也阅读一些vim tutorials

答案 1 :(得分:0)

在您的情况下,问题出在第1行和第2行。

e
n  " Automatically detect file types.

这些en是行开头的Vi(m)(ex)命令(但在.vimrc中它们不需要:前缀。

请参阅http://www.polarhome.com/vim/manual/v72/editing.html#:edit_fhttp://www.polarhome.com/vim/manual/v72/editing.html#:next上的文档。

所以他们的意思是e编辑文件,但是没有参数,所以这可能是一个错误(通常大多数人都没有在e中指定.vimrc个命令

n表示下一个(缓冲区),但是就你没有在命令行上指定更多文件来启动vim而言,它不起作用,因为没有更多缓冲区。

恕我直言,您应该从.vimrc删除这些命令。

HTH