sponsor Vim development Vim logo Vim Book Ad

bufmru.vim : switch to a most recently used buffer quickly

 script karma  Rating 38/13, Downloaded by 4049  Comments, bugs, improvements  Vim wiki

created by
Andy Wokula
 
script type
utility
 
description
Switch between MRU buffers from the current session. Like CTRL-^, but reach
more buffers (and maintain only one global list, not one list per window).

Usage:

  Press  <Space>  to show the most recently used buffer and enter Bufmru mode.

  In Bufmru mode:
  Press  f  or  b  (forward/backward) to reach more MRU buffers.
  Press  e  or  <Enter>  to accept the current choice.
  Press  q  or  <Esc>  to quit the mode and to go back to the start buffer
  Press  y  to copy a file name

Configuration:
  :let g:bufmru_switchkey = "<Space>"
      (checked once) Key to enter Bufmru mode.

  :let g:bufmru_confclose = 0
      (always) Use :confirm (1) when abandoning a modified buffer.
      Otherwise (0, default) you'll get an error message, unless 'hidden'
      is set.

  :let g:bufmru_bnrs = []
      (always) The internal stack of buffer numbers.  Normally, you'll
      leave this alone, but you can manually add or remove buffer numbers
      or initialize the list.  Don't worry about wrong numbers.

  :let g:bufmru_read_nummarks = 0
      (once) Put the number mark '0 ... '9 buffers in g:bufmru_bnrs.  This adds
      buffers to the buffer list!

wildmenu version only:

  g:bufmru_wildmenu   (dictionary, initially not defined)
      (always) Instance of autoload/wildmenu.vim to show buffer names in a
      wildmenu-like list.  If not defined, bufmru tries to load the autoload
      script.  If that fails the value becomes empty ({}) -- and bufmru
      quite unusable.

  :let g:bufmru_wilditems = "bufnr,shortpath"
      (always) How to display entries in the "wildmenu":
      "bufnr"         with prepended buffer number
      "shortpath"     with pathshorten() applied to the bufname()
      There is no error message for wrong items.

splashbufs version only:

  :let g:bufmru_lazy_filetype = 0
      (checked always) If 1, do lazy filetype detection when going through
      the buffers with f and b.  Not used if 'hidden' is set.


special buffer: 'buftype' not empty or 'previewwindow' set

Related:
http://vim.wikia.com/wiki/Easier_buffer_switching

Where it began:
http://groups.google.com/group/vim_use/msg/adb4f35772ecbcbe

Another MRU buffers script!  But it requires Ruby (that I haven't installed):
LustyJuggler vimscript #2050
 
install details
bufmru 2.x
        wildmenu version.  Buffers are shown in a wildmenu like list in the
        cmdline area.
        Unpack the archive into ~\vimfiles or a similar folder from your
        'runtimepath'.  Files in the archive:
            plugin/bufmru.vim
            autoload/anwolib.vim
            autoload/wildmenu.vim
            doc/bufmru.txt

bufmru 3.x
        splashbufs version.  It is just the plugin file without external
        dependencies.  Buffers are switched instantly like with CTRL-^; but
        switching is meant to be a preview as long as Bufmru is active.
        Copy bufmru.vim to ~\vimfiles\plugin or a similar plugin folder.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
bufmru.vim 3.3 2009-05-10 7.0 Andy Wokula splashbufs only version, option g:splashbufs gone
similar to v2.7, but no change of 'timeoutlen' for Bufmru mode
NF: variable g:bufmru_lazy_filetype
bufmru_2.7.zip 2.7 2009-05-10 7.0 Andy Wokula wildmenu only version, option g:splashbufs gone
BF: 'fileformat' of wildmenu.vim and anwolib.vim set to unix !
BF: now works better with 'lazyredraw' set
BF: g:bufmru_limit=0 now means unlimited (0 makes no sense otherwise)
NF: variable g:bufmru_wilditems to customize wildmenu entries
NF: 'timeoutlen' of Bufmru Mode set to 60000 ms
bufmru_2.0.zip 2.0 2009-03-05 7.0 Andy Wokula like 1.0 but includes a help file and uses autoload/wildmenu.vim to show buffer names in a wildmenu like list
bufmru.vim 1.0 2009-03-05 7.0 Andy Wokula New Variables: g:bufmru_splashbufs
Changed Variables: g:bufmru_confclose, g:bufmru_nummarks renamed to g:bufmru_read_nummarks
Added Keys: y  !  f
Changed Keys: <Space> replaced with  f  in Bufmru mode
New Functions: Bufmru_Read_Nummarks()
Behaviour:
* no more cycling: going forward/backward stops at either end of the MRU list
* Valid buffer number: now also 'buflisted' required
Bug fixes ...
bufmru.vim 0.3 2008-08-29 7.0 Andy Wokula now truncates too long buffer names
added g:bufmru_nummarks
bufmru.vim 0.2 2008-08-19 7.0 Andy Wokula some config added, keys added, some obvious bugs fixed. recommended update
bufmru.vim 0.1 2008-08-18 7.0 Andy Wokula Initial upload
ip used for rating: 142.132.191.50

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github