Saturday, February 27, 2010

Re: close file but not the tab

rameo <raiwil@gmail.com>:
> I have read the help pieces you've mentioned but not found the answer
> to my questions.
>
> What do I have to do?

Put this into your .vimrc:

" delete buffer without closing window
function! Bclose()
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")

if buflisted(l:alternateBufNum)
buffer #
else
bnext
endif

if bufnr("%") == l:currentBufNum
new
endif

if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum)
endif
endfunction

and assign a mapping to it:

nmap <F8> :call Bclose()<cr>


Jan

--
OpenPGP Key-ID: 00A0FD5F
"Religion is regarded by the common people as true, by the wise as false,
and by the rulers as useful." -- Seneca

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment