On 18/12/08 04:47, sc wrote: > On Wednesday 17 December 2008 9:14 pm, pravim wrote: >> Hi, >> >> i normally open more than 1 file in the same vim editor session using " :e >> filename2 " and so on... >> >> Sometimes i need to close ONE particular file out of the list that is >> opened; is there any way i can do that? >> >> >> regards, >> Pravin > > to be sure, there are dozens of ways > > the simplest is to use the > > :ls > > command to list open buffers, make note of the buffer number > of the one you want to close -- it's the first number on the > left of the list -- then issue a > > :bd # > > command, where bd is short for buffer-delete, and replace > the # with the number of the buffer you want closed > > a more fun method is to download and install BufExplorer: > > " http://www.vim.org/scripts/script.php?script_id=42 > > with a map to it, for example: > > nmap<F2> :BufExplorer<CR> > > you can hit F2, get the cursor on the buffer you want > deleted, and hit D > > a third way is to simply :bnext to the buffer you want gone > and enter :bdelete -- these are actions so frequently > performed by me i keep mappings in my .vimrc: > > nmap<silent> <F3> :silent bdelete<CR> > imap<F3> <ESC>:bdelete<CR> > nmap<S-F3> :qall<CR> > imap<S-F3> <ESC>:qall<CR> > > and > > nmap<silent> <F6> :silent bnext<CR> > imap<silent> <F6> <ESC>:silent bnext<CR> > nmap<silent> <S-F6> :silent bprev<CR> > imap<silent> <S-F6> <ESC>:silent bprev<CR> > > i'm sure there are other ways, but this will get you > started... > > sc
The :bdel command can also accept a buffer name (see ":help E93"), except that if the buffer name (the file name) is a number, ":bdel 12" will close the 12th buffer, not the buffer for the file named 12. And filename completion (from the buffer list, after entering part of the name at the command-line) works here. Best regards, Tony. -- If mathematically you end up with the wrong answer, try multiplying by the page number. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
