简体   繁体   English

vim脚本抛出E488:尾随字符

[英]vim script throw E488: Trailing Characters

I have this on my vimrc: 我在vimrc上有这个:

" close all buffer except active buffer
function! CloseAllBuffersButCurrent()
  let l:curr = bufnr('%')
  let l:last = bufnr('$')
  if l:curr > 1 | silent! execute '1,'.(l:curr-1).'bd' | endif
  if l:curr < l:last | silent! execute (l:curr+1).','.l:last.'bd' | endif
endfunction
command! BO :call CloseAllBuffersButCurrent()<CR>

This was used to close all buffer except the active one. 这用于关闭除活动缓冲区之外的所有缓冲区。 Everytime I invoke it using :BO , the function worked but I always got "E488: Trailing Characters" message. 每次我使用:BO调用它时,该功能都有效,但始终收到“ E488:尾随字符”消息。

How to fix it? 如何解决? Thanks. 谢谢。

command未映射,因此您不需要<CR>

command! BO :call CloseAllBuffersButCurrent()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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