简体   繁体   中英

error in .vimrc file

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

and here's the error I got:

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

I'm new to vi.Could anyone give me a reference of all this syntaxes mean? It's so overwhelming for me right now.

it's the n character, which is a command to go to next file. Also e does not make much sense in .vimrc as it just reloads the file you just loaded...

The syntax of the .vimrc is just normal vim commands - you can think of it as you'd enter the file by hand, adding : to the beginning of every line.

You probably want your config file to look like:

" 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

This old question and it's top rated answers are probably the most mindblowing reference to vim. I suggest also reading some vim tutorials

In your case the problem is in the 1st and 2nd line.

e
n  " Automatically detect file types.

These e and n are Vi(m) (ex) commands on the start of the lines (but in .vimrc they don't need the : prefix.

See their documentation at http://www.polarhome.com/vim/manual/v72/editing.html#:edit_f and http://www.polarhome.com/vim/manual/v72/editing.html#:next .

So they mean e edit file but there is no argument, so it's probably an error (usually most of the people doesn't specify e command(s) in their .vimrc

n means next (buffer), but as far as You does not specify more files on the commandline to start vim , it can't work, as there are no more buffers.

IMHO you should delete those commands from your .vimrc .

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM