"============================================================================= " Copyright: Copyright (C) 2002 & 2003 Bindu Wavell " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, " minibufexplorer.vim is provided *as is* and comes with no " warranty of any kind, either expressed or implied. In no " event will the copyright holder be liable for any damamges " resulting from the use of this software. " " Name Of File: minibufexpl.vim " Description: Mini Buffer Explorer Vim Plugin " Maintainer: Bindu Wavell " URL: http://vim.sourceforge.net/scripts/script.php?script_id=159 " Last Change: Saturday, April 26, 2003 " Version: 6.2.8 " Derived from Jeff Lanzarotta's bufexplorer.vim version 6.0.7 " Jeff can be reached at (jefflanzarotta@yahoo.com) and the " original plugin can be found at: " http://lanzarotta.tripod.com/vim/plugin/6/bufexplorer.vim.zip " " Usage: Normally, this file should reside in the plugins " directory and be automatically sourced. If not, you must " manually source this file using ':source minibufexplorer.vim'. " " You may use the default keymappings of " " mbe - Opens MiniBufExplorer " " or you may want to add something like the following " key mapping to your _vimrc/.vimrc file. " " map b :MiniBufExplorer " " However, in most cases you won't need any key-bindings at all. " " is usually backslash so type "\mbe" (quickly) to open " the -MiniBufExplorer- window. " " Other keymappings include: mbc to close the Explorer " window, mbu to force the Explorer to Update and " mbt to toggle the Explorer window; it will open if " closed or close if open. Each of these key bindings can be " overridden (see the notes on mbe above.) " " You can map these additional commands as follows: " " map c :CMiniBufExplorer " map u :UMiniBufExplorer " map t :TMiniBufExplorer " " NOTE: you can change the key binding used in these mappings " so that they fit with your configuration of vim. " " You can also call each of these features by typing the " following in command mode: " " :MiniBufExplorer " Open and/or goto Explorer " :CMiniBufExplorer " Close the Explorer if it's open " :UMiniBufExplorer " Update Explorer without navigating " :TMiniBufExplorer " Toggle the Explorer window open and " closed. " " To control where the new split window goes relative to the " current window, use the setting: " " let g:miniBufExplSplitBelow=0 " Put new window above " " current. " let g:miniBufExplSplitBelow=1 " Put new window below " " current. " " The default for this is read from the &splitbelow VIM option. " " By default we are now (as of 6.0.2) forcing the -MiniBufExplorer- " window to open up at the edge of the screen. You can turn this " off by setting the following variable in your .vimrc: " " let g:miniBufExplSplitToEdge = 0 " " It is now (as of 6.1.1) possible to set a maximum height for " the -MiniBufExplorer- window. You can set the max height by " letting the following variable in your .vimrc: " " let g:miniBufExplMaxHeight = " " setting this to 0 will mean the window gets as big as " needed to fit all your buffers. " " As of 6.2.2 it is possible to set a minimum height for the " -MiniBufExplorer- window. You can set the min height by " letting the following variable in your .vimrc: " " let g:miniBufExplMinHeight = " " By default we are now (as of 6.0.1) turning on the MoreThanOne " option. This stops the -MiniBufExplorer- from opening " automatically until more than one eligible buffer is available. " You can turn this feature off by setting the following variable " in your .vimrc: " " let g:miniBufExplorerMoreThanOne=1 " " (The following enhancement is as of 6.2.2) " Setting this to 0 will cause the MBE window to be loaded even " if no buffers are available. Setting it to 1 causes the MBE " window to be loaded as soon as an eligible buffer is read. You " can also set it to larger numbers. So if you set it to 4 for " example the MBE window wouldn't auto-open until 4 eligibles " buffers had been loaded. This is nice for folks that don't " want an MBE window unless they are editing more than two or " three buffers. " " To enable the optional mapping of Control + Vim Direction Keys " [hjkl] to window movement commands, you can put the following into " your .vimrc: " " let g:miniBufExplMapWindowNavVim = 1 " " To enable the optional mapping of Control + Arrow Keys to window " movement commands, you can put the following into your .vimrc: " " let g:miniBufExplMapWindowNavArrows = 1 " " To enable the optional mapping of and to a " function that will bring up the next or previous buffer in the " current window, you can put the following into your .vimrc: " " let g:miniBufExplMapCTabSwitchBufs = 1 " " To enable the optional mapping of and to mappings " that will move to the next and previous (respectively) window, you " can put the following into your .vimrc: " " let g:miniBufExplMapCTabSwitchWindows = 1 " " " NOTE: If you set the ...TabSwitchBufs AND ...TabSwitchWindows, " ...TabSwitchBufs will be enabled and ...TabSwitchWindows " will not. " " It is possible to customize the the highlighting for the tabs in " the MBE by configuring the following highlighting groups: " " MBENormal - for buffers that have NOT CHANGED and " are NOT VISIBLE. " MBEChanged - for buffers that HAVE CHANGED and are " NOT VISIBLE " MBEVisibleNormal - buffers that have NOT CHANGED and are " VISIBLE " MBEVisibleChanged - buffers that have CHANGED and are VISIBLE " " You can either link to an existing highlighting group by " adding a command like: " " hi link MBEVisibleChanged Error " " to your .vimrc or you can specify exact foreground and background " colors using the following syntax: " " hi MBEChanged guibg=darkblue ctermbg=darkblue termbg=white " " NOTE: If you set a colorscheme in your .vimrc you should do it " BEFORE updating the MBE highlighting groups. " " If you use other explorers like TagList you can (As of 6.2.8) put: " " let g:miniBufExplModSelTarget = 1 " " into your .vimrc in order to force MBE to try to place selected " buffers into a window that does not have a nonmodifiable buffer. " The upshot of this should be that if you go into MBE and select " a buffer, the buffer should not show up in a window that is " hosting an explorer. " " MBE has had a basic debugging capability for quite some time. " However, it has not been very friendly in the past. As of 6.0.8, " you can put one of each of the following into your .vimrc: " " let g:miniBufExplorerDebugLevel = 0 " MBE serious errors output " let g:miniBufExplorerDebugLevel = 4 " MBE all errors output " let g:miniBufExplorerDebugLevel = 10 " MBE reports everything " " You can also set a DebugMode to cause output to be target as " follows (default is mode 3): " " let g:miniBufExplorerDebugMode = 0 " Errors will show up in " " a vim window " let g:miniBufExplorerDebugMode = 1 " Uses VIM's echo function " " to display on the screen " let g:miniBufExplorerDebugMode = 2 " Writes to a file " " MiniBufExplorer.DBG " let g:miniBufExplorerDebugMode = 3 " Store output in global: " " g:miniBufExplorerDebugOutput " " Or if you are able to start VIM, you might just perform these " at a command prompt right before you do the operation that is " failing. " " History: Moved to end of file " " Known Issues: When debugging is turned on and set to output to a window, there " are some cases where the window is opened more than once, there " are other cases where an old debug window can be lost. " " Several MBE commands can break the window history so p " might not take you to the expected window. " " Todo: Add the ability to specify a regexp for eligible buffers " allowing the ability to filter out certain buffers that " you don't want to control from MBE " "============================================================================= " " Has this plugin already been loaded? " if exists('loaded_minibufexplorer') finish endif let loaded_minibufexplorer = 1 let s:debugIndex = 0 " " If we don't already have keyboard " mappings for mbe then create them. " if !hasmapto('MiniBufExplorer') map mbe MiniBufExplorer endif if !hasmapto('CMiniBufExplorer') map mbc CMiniBufExplorer endif if !hasmapto('UMiniBufExplorer') map mbu UMiniBufExplorer endif if !hasmapto('TMiniBufExplorer') map mbt TMiniBufExplorer endif " " Setup