I have this on my 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.
How to fix it? Thanks.
command
未映射,因此您不需要<CR>
:
command! BO :call CloseAllBuffersButCurrent()
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.