sponsor Vim development Vim logo Vim Book Ad

DumbBuf : simple buffer manager like QuickBuf.vim

 script karma  Rating 5/4, Downloaded by 2781  Comments, bugs, improvements  Vim wiki

created by
tyru
 
script type
utility
 
description
latest version at http://github.com/tyru/DumbBuf.vim/
including missing versions, all versions are mirrored at http://github.com/tyru/DumbBuf.vim/downloads
Japanese description is here: http://vim.g.hatena.ne.jp/tyru/20091030
screenshot is here: http://f.hatena.ne.jp/tyru/20091031002751


My .vimrc:
  let dumbbuf_hotkey = '<Leader>b'
  " sometimes I put <Esc> to close dumbbuf buffer,
  " which was mapped to close QuickBuf's list :)
  let dumbbuf_mappings = {
      'n': {
          '<Esc>': {'alias_to': 'q'},
      \}
  \}

  let dumbbuf_wrap_cursor = 0
  let dumbbuf_remove_marked_when_close = 1


Mappings:
  please define g:dumbbuf_hotkey at first.
  if that is not defined, this script is not loaded.

  Visual Mode:
      x
          mark buffers on selected region.
          see Normal Mode's xx for details.

  Normal Mode:
      q
          :close dumbbuf buffer.
      g:dumbbuf_hotkey
          toggle dumbbuf buffer.
      <CR>
          :edit buffer.
      u
         open one by one. this is same as QuickBuf's u.
      s
         :split buffer.
      v
         :vspilt buffer.
      t
         :tabedit buffer.
      d
         :bdelete buffer.
      w
         :bwipeout buffer.
      l
         toggle listed buffers or unlisted buffers.
      c
         :close buffer.
      x
          mark buffer.
          if one or more marked buffers exist,
          's', 'v', 't', 'd', 'w', 'c'
          get to be able to execute for that buffers at a time.

  and, if you turn on 'g:dumbbuf_single_key',
  you can use single key mappings like QuickBuf.vim.
  see 'g:dumbbuf_single_key' at 'Global Variables' for details.


Global Variables:
  g:dumbbuf_hotkey (default: no default value)
      a mapping which calls dumbbuf buffer.
      if this variable is not defined, this plugin will be not loaded.

  g:dumbbuf_open_with (default: 'botright')
      open dumbbuf buffer with this command.

  g:dumbbuf_vertical (default: 0)
      if true, open dumbbuf buffer vertically.

  g:dumbbuf_buffer_height (default: 10)
      dumbbuf buffer's height.
      this is used when only g:dumbbuf_vertical is false.

  g:dumbbuf_buffer_width (default: 25)
      dumbbuf buffer's width.
      this is used when only g:dumbbuf_vertical is true.

  g:dumbbuf_listed_buffer_name (default: '__buffers__')
      dumbbuf buffer's filename.
      set this filename when showing 'listed buffers'.
      'listed buffers' are opposite of 'unlisted-buffers'.
      see ':help unlisted-buffer'.

      NOTE: DON'T assign string which includes whitespace, or any special
      characters like "*", "?", ",".
      see :help file-pattern

  g:dumbbuf_unlisted_buffer_name (default: '__unlisted_buffers__')
      dumbbuf buffer's filename.
      set this filename when showing 'unlisted buffers'.

      NOTE: DON'T assign string which includes whitespace, or any special
      characters like "*", "?", ",".
      see :help file-pattern

  g:dumbbuf_cursor_pos (default: 'current')
      jumps to this position when dumbbuf buffer opens.
      this is useful for deleting some buffers continuaslly.

      'current':
          jump to the current buffer's line.
      'keep':
          keep the cursor pos.
      'top':
          always jump to the top line.
      'bottom':
          always jump to the bottom line

  g:dumbbuf_shown_type (default: '')
      show this type of buffers list.

      '':
          if current buffer is unlisted, show unlisted buffers list.
          if current buffer is listed, show listed buffers list.
      'unlisted':
          show always unlisted buffers list.
      'listed':
          show always listed buffers list.
      'project':
          show buffers each project.

  g:dumbbuf_close_when_exec (default: 0)
      if true, close when execute local mapping from dumbbuf buffer.

  g:dumbbuf_remove_marked_when_close (default: 0)
      remove all marked buffers on closing dumbbuf buffer.
      this default value is for only backward compatibility.
      (if I could fix this variable name...
       'dumbbuf_close_when_exec' => 'dumbbuf_close_on_exec')

  g:dumbbuf_downward (default: 1)
      if true, go downwardly when 'u' mapping.
      if false, go upwardly.

  g:dumbbuf_hl_cursorline (default: "guibg=Red  guifg=White")
      local value of highlight 'CursorLine' in dumbbuf buffer.

  g:dumbbuf_wrap_cursor (default: 1)
      wrap the cursor at the top or bottom of dumbbuf buffer.

  g:dumbbuf_all_shown_types (default: ['listed', 'unlisted', 'project'])
      all available shown types.

  g:dumbbuf_timeoutlen (default: 0)
      local value of &timeoutlen in dumbbuf buffer.


  For The Experienced User:
      g:dumbbuf_disp_expr (default: see the definition)
          this variable is for the experienced users.

          'v:val' has buffer's info.
          NOTE: 'val' does NOT work now.

      g:dumbbuf_options (default: see the definition)
          this variable is for the experienced users.
          dumbbuf buffer will be set up with these options.

      g:dumbbuf_mappings (default: see the definition)
          this variable is for the experienced users.
          these settings will override default value.

          if your .vimrc setting is

            let g:dumbbuf_mappings = {
                'n': {
                    '<Esc>': {'alias_to': 'q'}
                \}
            \}

          you can type <Esc> to close dumbbuf buffer.
          no influences for other default mappings.

          and there are some special keys:
              'alias_to': 'map'
                  make an alias for 'map'.
              'swap_with': 'map'
 
install details
move to your plugin's directory(~/.vim/plugin/).
write g:dumbbuf_hotkey setting to your .vimrc like below:
  let g:dumbbuf_hotkey = '<Leader>b'
 

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
dumbbuf.zip 0.0.9 2010-03-02 7.0 tyru - Add 'o' mapping to execute ':sbuffer'. Thanks to Jan Christoph.
- Fix bug to fail to restore original CursorLine highlight.
- Change default value of g:dumbbuf_options
- Allow to execute mappings even on noname buffer.
- Add '<Plug>(dumbbuf-open)'.
  g:dumbbuf_hotkey is not '',
  g:dumbbuf_hotkey is mapped to '<Plug>(dumbbuf-open)'.
- Write document
- etc.
dumbbuf.vim 0.0.8 2010-01-01 7.0 tyru Happy New Year, Vimmers ;)

- NOTE: If you want to use mapping
  2 more than characters to toggle dumbbuf buffer,
  you have to change g:dumbbuf_timeoutlen.
  for e.g.: let g:dumbbuf_timeoutlen = 100
  But you can always use 'q' to close buffer.
- Change default values of g:dumbbuf_disp_expr, g:dumbbuf_options
  (Options written in 'For The Experienced User' may be changed
  in the future. sorry)
- Implement g:dumbbuf_all_shown_types.
- Remove g:dumbbuf_single_key, g:dumbbuf_single_key_echo_stack,
  g:dumbbuf_updatetime
- Remove single key emulation.
  This emulates normal key input
  in order to prevent Vim from waiting candidate keys.
  Now I know I have invented the wheel :)
  (I changed &timeout, &timeoutlen)
- Suppress flicker when mapping executed.
- Some optimizations.
- Some fixes of minor bugs.
dumbbuf.vim 0.0.7 2009-10-30 7.0 tyru - highlight support
- add option g:dumbbuf_single_key_echo_stack,
  g:dumbbuf_hl_cursorline,
  g:dumbbuf_remove_marked_when_close.
- change g:dumbbuf_disp_expr's spec.
- fix minor bugs and do some optimizations.
- replace the words 'select' to 'mark' in document and source code.
  I would use 'select' for only visual mode's region.
dumbbuf.vim 0.0.6 2009-09-28 7.0 tyru 0.0.5:
    - fix bug: when using with another plugin that uses unlisted buffer,
      pressing <CR> in dumbbuf buffer jumps into that unlisted buffer.
      * Thanks to Bernhard Walle for reporting the bug :) *
    - add g:dumbbuf_open_with.
0.0.6:
    - fix bug: when there is no buffers in list,
      dumbbuf can't get selected buffer info.
    - add option g:dumbbuf_wrap_cursor, and allow 'keep' in
      g:dumbbuf_cursor_pos.
    - implement 'select' of buffers. mapping is 'xx'.
dumbbuf.vim 0.0.4 2009-09-26 7.0 tyru - implement single key mappings like QuickBuf.vim.
  'let g:dumbbuf_single_key = 1' to use it.
- add g:dumbbuf_single_key, g:dumbbuf_updatetime.
- map plain gg and G mappings in local buffer.
- fix bug of making a waste buffer when called from
  unlisted buffer.
dumbbuf.vim 0.0.3 2009-09-24 7.0 tyru - fix bug of trapping all errors(including other plugin error).
dumbbuf.vim 0.0.1 2009-09-13 6.0 tyru implement g:dumbbuf_cursor_pos, g:dumbbuf_shown_type, and 'tt' mapping.
and fix bug of showing listed buffers even if current buffer is unlisted.
dumbbuf.vim 0.0.0 2009-09-11 6.0 tyru 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