MiniBufExplorer questions (closing a buffer, making it invisible, etc.)

797 views
Skip to first unread message

madiyaan

unread,
Nov 16, 2008, 12:02:06 PM11/16/08
to vim_use
I have some questions about the MiniBufExplorer plugin:

1. How do I close buffers when using this plugin? Sometimes I open
10-15 buffers and I really don't want to keep all of them open so I
use :bdelete right now. The reason for that is that I want to remove
the buffer from the MiniBufExplorer list as well as not showing it.
However, when I do that, the next buffer to be displayed loses it's
syntax highlighting. I solved that problem by doing :syntax on in my
shortcut to close the buffer (along with :bdelete), but there is
another issue: the MiniBufExplorer window loses it's syntax
highlighting and doesn't show me the currently active buffer in a
different color. Have a look at this picture. The above screenshot
shows when 3 windows were open, and the below one shows when that last
window was closed. Notice that the MiniBufExplorer window loses color
highlighting.

2. How do I navigate around buffers even with changes made to the
current buffer? Currently it doesn't allow me to switch to a different
buffer as long as the current buffer has unsaved changes. Strangely
enough when I jump to a different buffer using :tselect <tag_name> it
happily navigates to a new file with the tag even if the current
buffer has unsaved changes. I am guessing when I jump to a tag, it
makes the current buffer invisible and then switches over to the other
buffer. Is that correct? If so, how do I change my buffer switch macro
(currently set to ctrl+vim navigation keys) to allow me to navigate to
different buffers while having unsaved changes to the current one?

A related question would be how to save all unsaved changes to all
open buffers?

Thanks,

madiyaan

unread,
Nov 16, 2008, 12:04:01 PM11/16/08
to vim_use


On Nov 16, 12:02 pm, madiyaan <ahmadsha...@gmail.com> wrote:
> I have some questions about the MiniBufExplorer plugin:
>
> 1. How do I close buffers when using this plugin? Sometimes I open
> 10-15 buffers and I really don't want to keep all of them open so I
> use :bdelete right now. The reason for that is that I want to remove
> the buffer from the MiniBufExplorer list as well as not showing it.
> However, when I do that, the next buffer to be displayed loses it's
> syntax highlighting. I solved that problem by doing :syntax on in my
> shortcut to close the buffer (along with :bdelete), but there is
> another issue: the MiniBufExplorer window loses it's syntax
> highlighting and doesn't show me the currently active buffer in a
> different color. Have a look at this picture.

Here is the aforementioned screenshot:

img82.
imageshack.
us/
my.php?image=minibufclosingln1.png

concatenate these for the link. For some reason Google doesn't allow
me to post links.

John Beckett

unread,
Nov 16, 2008, 5:21:34 PM11/16/08
to vim...@googlegroups.com
madiyaan wrote:
> I have some questions about the MiniBufExplorer plugin:
>
> 1. How do I close buffers when using this plugin?

I don't use MBE but I needed to look at it recently and I infer (from a quick look
at minibufexpl.vim) that you find the buffer in the plugin's window, then press 'd'.

> 2. How do I navigate around buffers even with changes made to
> the current buffer?

Use ':set hidden' command (e.g. in vimrc).

> A related question would be how to save all unsaved changes
> to all open buffers?

:wa

John

StarWing

unread,
Nov 17, 2008, 4:54:13 AM11/17/08
to vim_use


On 11月17日, 上午1时02分, madiyaan <ahmadsha...@gmail.com> wrote:
> I have some questions about the MiniBufExplorer plugin:
>
> 1. How do I close buffers when using this plugin? Sometimes I open
> 10-15 buffers and I really don't want to keep all of them open so I
> use :bdelete right now. The reason for that is that I want to remove
> the buffer from the MiniBufExplorer list as well as not showing it.
> However, when I do that, the next buffer to be displayed loses it's
> syntax highlighting. I solved that problem by doing :syntax on in my
> shortcut to close the buffer (along with :bdelete), but there is
> another issue: the MiniBufExplorer window loses it's syntax
> highlighting and doesn't show me the currently active buffer in a
> different color. Have a look at this picture. The above screenshot
> shows when 3 windows were open, and the below one shows when that last
> window was closed. Notice that the MiniBufExplorer window loses color
> highlighting.


just press 'd' on tab window. lost color is because minibuf's little
bug, and you just add one line in script file:
function! <SID>AutoUpdate(delBufNum) "<<<= this is the line 1205
call <SID>DEBUG('===========================',10)
call <SID>DEBUG('Entering AutoUpdate('.a:delBufNum.') : '.bufnr
('%').' : '.bufname('%'),10)
call <SID>DEBUG('===========================',10)

if (g:miniBufExplInAutoUpdate == 1)
call <SID>DEBUG('AutoUpdate recursion stopped',9)
call <SID>DEBUG('===========================',10)
call <SID>DEBUG('Terminated AutoUpdate()' ,10)
call <SID>DEBUG('===========================',10)
return
else
let g:miniBufExplInAutoUpdate = 1
endif

" Don't bother autoupdating the MBE window
if (bufname('%') == '-MiniBufExplorer-')
" If this is the only buffer left then toggle the buffer
if (winbufnr(2) == -1)
call <SID>CycleBuffer(1)
exec 'syntax enable' " <<<<<==== add this line into script
call <SID>DEBUG('AutoUpdate does not run for cycled windows',
9)
else
call <SID>DEBUG('AutoUpdate does not run for the MBE window', 9)
endif

and you will find, it won't be lost color.
Reply all
Reply to author
Forward
0 new messages