=== modified file 'lib/sup/modes/scroll-mode.rb'
--- lib/sup/modes/scroll-mode.rb	2007-11-08 02:24:33 +0000
+++ lib/sup/modes/scroll-mode.rb	2007-11-08 15:44:18 +0000
@@ -1,3 +1,4 @@
+require 'session'
 module Redwood
 
 class ScrollMode < Mode
@@ -26,6 +27,7 @@
     k.add :jump_to_left, "Jump to the left", '['
     k.add :search_in_buffer, "Search in current buffer", '/'
     k.add :continue_search_in_buffer, "Jump to next search occurrence in buffer", BufferManager::CONTINUE_IN_BUFFER_SEARCH_KEY
+    k.add :shell, "Execute shell command", '!'
   end
 
   def initialize opts={}
@@ -134,6 +136,21 @@
     ensure_mode_validity
   end
 
+  def shell
+    command = BufferManager.ask(nil, "shell command: ") or return
+    shell = Session::Shell.new
+    output, error = '', ''
+    shell.execute command, :stdout => output, :stderr => error
+    if !error.empty?
+      BufferManager.flash "Error: #{error}"
+    elsif output.empty?
+      BufferManager.flash "'#{command}' done"
+    else
+      b = BufferManager.spawn "output of '#{command}'", TextMode.new(output)
+      b.draw
+    end
+  end
+
 protected
 
   def find_text query, start_line

