Giter VIP home page Giter VIP logo

buffet.vim's Introduction

Buffet is a plugin for the vim editor for listing and switching buffers, windows and tabs.(vim.org)

New in version 2.65.2

You can now use the '>' or the :Buffettogglesort command to switch between mru / alphabetical order

New in version 2.60(Screenshot)

  • Added two new keyboard commands to mark a buffer in the list of displayed Buffers.
  • Use 'm' to toggle mark on a single buffer, and 'M' to clear all the previously set marks.
  • The two new commands for this operation are 'Buffettogglemark' and 'Buffetclearmarks'

New in version 2.50

With this version you can format the display of buffer list using a callback function. Set the call back using the line in your vimrc

let g:Buffetbufferformatfunction = "s:callback"

You can replace s:callback with your callback function name. The call back function accept following parameters and must return a one dimensional list of columns. If empty list is returned, the entry is not displayed.

Parameters:

  • Buffer No, The buffer number

  • Tab No, Tab no where this buffer is displayed. Blank if it is not displayed in a tab.

  • Window No. Window no where this buffer is displayed. Blank if not displayed.

  • Source tab: The tab from which the bufet was invoked. This can be used to mark the current buffer in the list

  • Source window: Same as above, but from window.

  • Is parent. This is 1 if this is a first entry for a buffer in the list. If buffer is showing in multiple tabs and windows, those entries will have this value 0.

You can disable default maps if you set this line in vimrc

let g:buffetdisabledefaultmaps = 1

You can now set your own maps to the commands given below.

  • Buffetclosewindow - Close the corresponding window

  • BuffetclosewindowF - Close the window even if the contents are not saved

  • Buffetcleardiff - Clears diff flag of all displayed windows

  • Buffetdelete - Delete the selected buffer

  • Buffetdeletef - Delete the buffer even if contents are not saved

  • Buffetload - Load the selected buffer to current windows

  • Buffetloadonly - Load the selected buffer to current window and make it the only one displayed

  • Buffetgoto - Go to the selected tab/window/buffer

  • Buffetopentab - Open the selected buffer in a new tab

  • Buffetopenh - Open the buffer in a horizintal split

  • Buffetopenv - Open the buffer in a vertical split

  • Buffetrefresh - Refresh the buffer list.

  • Buffetdiffsplit - Open a diff window with difference between current buffer and selected buffer shown

  • Buffettoggledetail - Toggle detailed display of file path

  • Buffettogglemark - Toggle a mark on a buffer

  • Buffetclearmarks - Clear all marks set on the buffers

New in version 2.10(Screenshot)

  • Layout change for buffer list.Made columns to correctly align on top of each other.
  • Removed the highlight for current window/buffer. Current window is enclosed in a > < instead.(Screenshot)
  • Made a shorter version of path to show initially, Can toggle detail view using 'm' key.

In version 2.0

  • Added support for multiple windows showing same buffer.
  • Removed file type and file encoding information from buffer list.
  • Fixed an issue when vim is invoked from command line with multiple arguments
  • Added 'x' command to close a window in what ever tab it is displayed.
  • Changed the 'h' command to 'hh' to prevent accidental opening when moving across the list.

Screenshot: http://i43.tinypic.com/33kadsx.png

The plugin exports two command Bufferlist and Bufferlistsw.

Commands for invoking this plugin.

:Bufferlist - Opens the buffer list window at the very top with maximum width.

:Bufferlistsw - Opens the buffer list window at the top of the current window, with same width as that of current window.

When the plugin is invoked, it opens a horizontal window at the top. This window contains a list of buffers, sorted in the most recently used order. The cursor is placed on the line of the buffer that user accessed before the current buffer. This is to make switching between two buffers very fast.

If a buffer is displayed in more than one window, those windows are listed below the buffer entry with tab number and window number.

The window and tab from which the plugins was invoked is shown enclosed in a pair of > ... <

Please see screenshot

User can move up or down in the list using navigation keys to select a buffer/window.

When user is on a buffer/window, there is a set of commands he can execute on the buffer by pressing the corresponding key. The available commands are,

Enter(Replace current buffer)

Pressing the enter key loads the selected buffer into the window from which the plugin was called.

hh (Was originally h,changed to hh in version 2)

Splits the window from which the plugin was invoked horizontally , and loads the selected buffer into the new window.

v

Splits the window from which the plugin was invoked vertically, and loads the selected buffer into the new window.

-

Loads a diff view of the selected buffer with the buffer from which the plugin was called. The two windows will be scroll binded.

c

The above - command may cause some windows to retain the diff flag even after the paired window is closed. The 'c'
command clears the diff flag for all windows in the current tab.

o

This command maximizes the window to fill the current tab page, hiding all the windows of the current tab.

g

This command switches focus to the selected window if it is visible in any of the tabs. This is different from the 'enter' command in the sense that it does not loads the contents of the buffer into the current window. If a buffer is being displayed in more than a window, then all those windows will be represented by the lines under the entry for that buffer. Executing the g command on those entries switches the user to the corresponding window and tab.

d

This command deletes the selected buffer from the buffer list. Buffer list window is not closed.

x

This command closes the selected window. It does not matter if the window is open in another tab. Buffer is not removed from the list. The buffer list window remains open. With this you can use the buffer list window as a remote control to navigate to or close any window in any tab.

a

Toggles the detailed view for file paths.

m

Toggles a mark on the buffer

M

Clears all marks set on the buffers

buffet.vim's People

Contributors

graudeejs avatar petelewis avatar sras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

buffet.vim's Issues

Wrong version number in the title string

Confusing version number in the title string "Buffet-2.10 ( Enter Number to search for a buffer number )". Should be 2.50 according to the source code.
IMO is simpler to use a global var for this purpose.

Single click buffer opening support

Hello again! Here I have written a small patch to implement an opportunity to use a single click instead of a double click when opening a buffer.

This patch adds a global variable g:Buffetsingleclickloading. When it's empty the default behaviour (double click) is used, else a single click will take place.

The patch: https://gist.github.com/gonsiorovsky/6000233.

Regards,
Denis.

Alphabetical sorting

It would be nice to have an opportunity to sort the list of buffers alphabeticaly or at least display them always in the same order, because searching every time through the new list to find a proper buffer is a bit complicated.

Plugin errors when launching

Using vim 7.2 on a headless Ubuntu server , more exactly 7.2.330, via SSH when I try to open Buffet.vim with ether the :Bufferlist or the :Bufferlistsw command the screen gets filled with the following errors:

"buflisttempbuffer412393" [New File]                                                    
Error detected while processing function <SNR>31_toggletop..<SNR>31_toggle..<SNR>31_open_new_wind
ow:
line    3:
E518: Unknown option: nornu
Error detected while processing function <SNR>31_toggletop..<SNR>31_toggle..<SNR>31_display_buffe
r_list..<SNR>31_process_callback:
line    8:
E117: Unknown function: strwidth
E15: Invalid expression: strwidth(l:i)
line    9:
E121: Undefined variable: l:temp
E116: Invalid arguments for function add
line   10:
E121: Undefined variable: l:temp
E15: Invalid expression: (s:columnwidths[l:cn] < l:temp ) 
line    8:
E117: Unknown function: strwidth
E15: Invalid expression: strwidth(l:i)
line    9:
E121: Undefined variable: l:temp
E116: Invalid arguments for function add
line   10:
E121: Undefined variable: l:temp
E15: Invalid expression: (s:columnwidths[l:cn] < l:temp ) 
line    8:
E117: Unknown function: strwidth
E15: Invalid expression: strwidth(l:i)
line    9:
E121: Undefined variable: l:temp
E116: Invalid arguments for function add
line   10:
E121: Undefined variable: l:temp
E15: Invalid expression: (s:columnwidths[l:cn] < l:temp ) 
line    8:
E117: Unknown function: strwidth
E15: Invalid expression: strwidth(l:i)
line    9:
E121: Undefined variable: l:temp
E116: Invalid arguments for function add
line   10:
E121: Undefined variable: l:temp
E15: Invalid expression: (s:columnwidths[l:cn] < l:temp ) 
line    8:
E117: Unknown function: strwidth
E15: Invalid expression: strwidth(l:i)
line    9:
E121: Undefined variable: l:temp
E116: Invalid arguments for function add
line   10:
E121: Undefined variable: l:temp
E15: Invalid expression: (s:columnwidths[l:cn] < l:temp ) 
line    8:
E117: Unknown function: strwidth
E15: Invalid expression: strwidth(l:i)
line    9:
E121: Undefined variable: l:temp
E116: Invalid arguments for function add
line   10:
E121: Undefined variable: l:temp
E15: Invalid expression: (s:columnwidths[l:cn] < l:temp ) 
line    8:
E117: Unknown function: strwidth
E15: Invalid expression: strwidth(l:i)
line    9:
E121: Undefined variable: l:temp
E116: Invalid arguments for function add
line   10:
E121: Undefined variable: l:temp
E15: Invalid expression: (s:columnwidths[l:cn] < l:temp ) 
Error detected while processing function <SNR>31_toggletop..<SNR>31_toggle..<SNR>31_display_buffe
r_list:
line   55:
E684: list index out of range: 0
E116: Invalid arguments for function repeat(' ',s:columnwidths[l:cc] - l:column_widths[l:cc])
E15: Invalid expression: l:linecontent . l:column . repeat(' ',s:columnwidths[l:cc] - l:column_wi
dths[l:cc])
E684: list index out of range: 1
E116: Invalid arguments for function repeat(' ',s:columnwidths[l:cc] - l:column_widths[l:cc])
E15: Invalid expression: l:linecontent . l:column . repeat(' ',s:columnwidths[l:cc] - l:column_wi
dths[l:cc])
E684: list index out of range: 2
E116: Invalid arguments for function repeat(' ',s:columnwidths[l:cc] - l:column_widths[l:cc])
E15: Invalid expression: l:linecontent . l:column . repeat(' ',s:columnwidths[l:cc] - l:column_wi
dths[l:cc])
E684: list index out of range: 3
E116: Invalid arguments for function repeat(' ',s:columnwidths[l:cc] - l:column_widths[l:cc])
E15: Invalid expression: l:linecontent . l:column . repeat(' ',s:columnwidths[l:cc] - l:column_wi
dths[l:cc])
E684: list index out of range: 4
E116: Invalid arguments for function repeat(' ',s:columnwidths[l:cc] - l:column_widths[l:cc])
E15: Invalid expression: l:linecontent . l:column . repeat(' ',s:columnwidths[l:cc] - l:column_wi
dths[l:cc])
E684: list index out of range: 5
E116: Invalid arguments for function repeat(' ',s:columnwidths[l:cc] - l:column_widths[l:cc])
E15: Invalid expression: l:linecontent . l:column . repeat(' ',s:columnwidths[l:cc] - l:column_widths[l:cc])
E684: list index out of range: 6
E116: Invalid arguments for function repeat(' ',s:columnwidths[l:cc] - l:column_widths[l:cc])
E15: Invalid expression: l:linecontent . l:column . repeat(' ',s:columnwidths[l:cc] - l:column_wi
dths[l:cc])

After scrolling through and hitting enter the split at the top of the screen appears and I can see the interface for Buffet.vim but the list of buffers is empty. I take it as the plugin can not determine the width it needs to open for the split? The reason why I came to that is because it works fine on my host machine running VIM 7.3. If this is so is there a way to override the width detection?

In Terminal Emulators <F2> Toggle Inserts Text

In my .vimrc I have the following

nnoremap <silent> <F2> :Bufferlist<CR>

When I hit F2 to toggle the buffer list, it shows the list just fine, but when I toggle out it ends up inserting some text.

It ends up adding a new line with Q

Before

i am foo bar

Press F2 twice

Q
i am foo bar

When I bind to other keys I get different results.

Bound to F5 it changes toggles case of words.

Before:

abcdefghijklmnop

After:

ABCDEfghijklmnop

One more time:

abcdefghijklmnop

Now the weird part is that in MacVim with the GUI (I haven't checked gvim on Linux) it works perfectly... and if I run the same binary /Applications/MacPorts/MacVim.app/Contents/MacOS/Vim I get the weird behavior again.

Oddly enough I use the same toggles for other plugins with no issues either.

Example:

nnoremap <silent> <F3> :TMToggle<CR>

works just fine.

Allow j/k keys for up/down movment

My setup is Gvim portable 7.3 running on Windows XP. When I try to use the j/k keys for up/down movement, the plugin appears to enter an loop (just guessing, the cursor flashes unusually) which can only be exited by pressing CTRL-C. The l key appears to work properly for moving to the right, but j/k would be great to have.

":e file" while in buffet window causes SIGSEGV

I've reproduced this both on MacVim 7.3 pl 315 and Apple's vim 7.3 that ships with Lion. If I've brought up buffet and accidentally open a file for edit using :e then vim dies a horrible death. Interestingly this doesn't occur with :split or :vsplit.

Enter loads window into hidden buffer

If NERDTree (I suspect this is generic to any hidden buffer) is active, then :Bufferlist is shown, pressing ENTER causes a buffer to be loaded into the hidden buffer window.

As initially the NERDTree window is not shown in the buffer list, either an arbitrary active not hidden buffer window can be used or the same behavior single 'all wide' window could be shown (great if a global setting in vimrc could tweak this behaviour).

Steps to reproduce:

  1. Load multiple files
  2. Show :NERDTree window (or any window from any plug in that hides its buffer)
  3. :Bufferlist
  4. Select a valid buffer name
  5. Press ENTER

Result: The file buffer is loaded into helper hidden buffer window (left sized NERDTree file list window).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.