lib/textbringer/commands/windows.rb in textbringer-0.2.8 vs lib/textbringer/commands/windows.rb in textbringer-0.2.9
- old
+ new
@@ -80,9 +80,23 @@
else
raise EditorError, "No such buffer: #{buffer}"
end
end
+ define_command(:list_buffers, doc: <<~EOD) do
+ List the existing buffers.
+ EOD
+ buffer = Buffer.find_or_new("*Buffer List*",
+ undo_limit: 0, read_only: true)
+ buffer.apply_mode(BufferListMode)
+ buffer.read_only_edit do
+ buffer.clear
+ buffer.insert(Buffer.list.map(&:name).join("\n"))
+ buffer.beginning_of_buffer
+ end
+ switch_to_buffer(buffer)
+ end
+
define_command(:bury_buffer, doc: <<~EOD) do
Put buffer at the end of the buffer list.
EOD
|buffer = Buffer.current|
if buffer.is_a?(String)