Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


delete buffer on C-d #81

wants to merge 1 commit into from

2 participants

Pavel Gabriel Stephen Bach
Pavel Gabriel

I noticed that very often when I'm in buffer list I need to delete (unload buffer and remove from buffer list) some buffers.

It's a first attempt to update lusty. Could you guide me to update it correctly?

Stephen Bach

For consistency with the other values, this should be the decimal value for Ctrl-D, which is 4.

Stephen Bach

To avoid ambiguity around the word "delete", let's rename this function unload_selected_buffer

Stephen Bach

Think it would be good to rename this to unload_buffer.

Stephen Bach

Hi, sorry for the delay in responding. Your patch looks good -- thanks! Could you please update your pull request to apply your changes to the source files in src/ rather than the generated .vim file in plugin/?

Pavel Gabriel

I have updated code in this PR: #100

Pavel Gabriel alovak closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 21, 2012
  1. Pavel Gabriel

    delete buffer on C-d

    alovak authored
This page is out of date. Refresh to see the latest.
Showing with 18 additions and 0 deletions.
  1. +18 −0 plugin/lusty-explorer.vim
18 plugin/lusty-explorer.vim
@@ -898,6 +898,8 @@ class Explorer
refresh_mode = :no_recompute
when 15 # C-o choose in new horizontal split
+ when 7 # C-d delete buffert in new horizontal split
+ delete()
when 20 # C-t choose in new tab
when 21 # C-u clear prompt
@@ -963,6 +965,14 @@ class Explorer
+ def delete
+ entry = @current_sorted_matches[@selected_index]
+ return if entry.nil?
+ delete_buffer(entry)
+ refresh(:full)
+ run()
+ end
def choose(open_mode)
entry = @current_sorted_matches[@selected_index]
return if entry.nil?
@@ -1078,6 +1088,13 @@ class BufferExplorer < Explorer
+ def delete_buffer(entry)
+ cleanup()
+ number = entry.vim_buffer.number
+ LustyE::assert(number)
+ VIM::command "silent bdelete! #{number}"
+ end
def open_entry(entry, open_mode)
LustyE::assert($curwin == @calling_window)
@@ -1941,6 +1958,7 @@ class Display
VIM::command "#{map} <C-t> :call <SID>#{prefix}KeyPressed(20)<CR>"
VIM::command "#{map} <C-v> :call <SID>#{prefix}KeyPressed(22)<CR>"
VIM::command "#{map} <C-e> :call <SID>#{prefix}KeyPressed(5)<CR>"
+ VIM::command "#{map} <C-d> :call <SID>#{prefix}KeyPressed(7)<CR>"
VIM::command "#{map} <C-r> :call <SID>#{prefix}KeyPressed(18)<CR>"
VIM::command "#{map} <C-u> :call <SID>#{prefix}KeyPressed(21)<CR>"
VIM::command "#{map} <Esc>OD :call <SID>#{prefix}KeyPressed(2)<CR>"
Something went wrong with that request. Please try again.